Spork/Zeus/Spring ã«ãããã¹ãå®è¡æéã®ç縮
2013/10/09
ãã®é£è¼ã®ãã¯ããã«ãã§äºåããããã«ããããã Zeus ã«ã¤ãã¦æ¸ããããªã¨æã£ã¦ä¸èª¿ã¹ãå§ããã¨ãæè¿ã¯ Spring ã¨ããæ°é¡ãç»å ´ãã¦äººæ°ãåºã¦ãã¦ãããã¨ãåããã¾ãããããã§ãZeus 㨠Spring ã®ä¸¡æ¹ãç´¹ä»ãããã¨æãã¾ãã
Zeus ã Spring ã Rails application preloader ã¨ç·ç§°ãããã½ããã¦ã§ã¢ã®ä»²éã§ãããã¹ããå®è¡ãã度㫠Rails ã¢ããªã±ã¼ã·ã§ã³ããã¼ãããã®ã¯æéã®ç¡é§ãªã®ã§ããµã¼ãã¨ãã¦ããªãã¼ããã¦ããããã¹ãã®å®è¡æéç縮ãç®çã¨ãããã®ã§ããå¤ããã使ããã¦ãããã®ã¨ãã¦ã¯ãSpork ã¨ãããã®ãããã¾ããããããSpork ã«ã¤ãã¦ã¯ç°¡åã«è§¦ããã ãã«ã¨ã©ãã¾ãã
åèæç®ï¼
- Improving Rails boot time with Zeus (2013/01/10)
- Rails使ããspork, zeusããspringã¸ï¼ (2013/02/18)
- Fast Rails Commands (2013/04/04)
- spork, spring, zeus, 使ããªã, ... ã©ãããªã¹ã¹ã¡ã§ãã (2013/06/11)
Spork/Zeus/Spring ã®æ¯è¼
åºæ¬çãªãã¼ã¿ã§3ã¤ã®ã½ããã¦ã§ã¢ãæ¯è¼ãã¦ã¿ã¾ããããã¦ã³ãã¼ãæ°/æ¥ãã¯ãRubyGems.org ã«åºã¦ããææ°çã®ãã¦ã³ãã¼ãæ°ããªãªã¼ã¹æ¥ããã®çµéæ¥æ°ã§å²ã£ãæ°ã§ãã
å称 | æåã®ãªãªã¼ã¹æ¥ | æå¾ã®ãªãªã¼ã¹æ¥ | ãã¦ã³ãã¼ãæ°/æ¥ | èªåãªãã¼ãæ©è½ | JRuby/Windows ãµãã¼ã |
---|---|---|---|---|---|
Spork | 2009/05/30 | 2013/09/14 | 1,382 | No | Yes |
Zeus | 2012/07/25 | 2013/05/21 | 494 | Yes | No |
Spring | 2013/02/07 | 2013/06/21 | 159 | Yes | No |
Spork ã¯ãã§ã«4年以ä¸ã®æ´å²ãæã£ã¦ãã¾ãã1å¹´2ã¶æã®Zeusã8ã¶æã®Springã¨æ¯è¼ããã¨ããªãã®å¤æ ªã§ããSpork ã¯ãJRuby 㨠Windows ããµãã¼ããã¦ããç¹ãç¹é·ã§ãã
ããããZeus 㨠Spring ã«ã¯ Rails ã¢ããªã±ã¼ã·ã§ã³ã®ã½ã¼ã¹ã³ã¼ããç·¨éãããã¨ãã«ãèªåçã«åèªã¿è¾¼ã¿ãã¦ãããã¨ããéè¦ãªé·æãããã¾ããMac OS X ã¾ã㯠Linux ã使ç¨ãã¦ããæ¹ã«ã¯ Zeus ã Spring ããå§ãã§ãã
Zeus ã®ä½¿ãæ¹
ã¾ããgem
ã³ãã³ãã§ã¤ã³ã¹ãã¼ã«ãã¾ãï¼
$ gem install zeus
Gemfile
ã« gem 'zeus'
ãå ã㦠bundle install
ããæ¹æ³ã§ãã¤ã³ã¹ãã¼ã«ã§ãã¾ããããã®æ¹æ³ã¯æ¨å¥¨ããã¦ãã¾ããã
次㫠spec/spec_helper.rb
ãã次ã®ãããªè¡ãæ¢ããããã°åé¤ãã¾ãï¼
require 'rspec/autorun'
Zeus ã使ããªãå ´åã§ãããã®è¡ã¯ããããä¸è¦ã§ããruby -Ispec spec/models/customer_spec.rb
ã®ããã« ruby
ã³ãã³ãããç´æ¥å®è¡ããå ´åã«ã ããã®è¡ãå¿
è¦ã¨ãªãã¾ãã
è¨å®ãã¡ã¤ã«ãä½æãã¾ãï¼
$ zeus init
ã¨ãã£ã¿ã§ zeus.json
ãéãã¨ãåæç¶æ
ã¯æ¬¡ã®ããã«ãªã£ã¦ãã¾ãï¼
{ "command": "ruby -rubygems -r./custom_plan -eZeus.go", "plan": { "boot": { "default_bundle": { "development_environment": { "prerake": {"rake": []}, "runner": ["r"], "console": ["c"], "server": ["s"], "generate": ["g"], "destroy": ["d"], "dbconsole": [] }, "test_environment": { "cucumber_environment": {"cucumber": []}, "test_helper": {"test": ["rspec", "testrb"]} } } } } }
Cucumber ã使ããªã人ã¯ãä¸ãã7è¡ç®ãåé¤ãã¦ãã ããã
"cucumber_environment": {"cucumber": []},
Zeus ã使ç¨ããéã«ã¯ãã¿ã¼ããã«ã¦ã£ã³ãã¦ãå°ãªãã¨ã2åå¿ è¦ã§ãã1åã®ã¿ã¼ããã«ã§ Zeus ãµã¼ããåãããã以å¤ã®ã¿ã¼ããã«ã§ãã¹ããå®è¡ãã¾ãã
Zeus ãµã¼ããèµ·åãã¾ãã
$ zeus start
ããã¨ãã¿ã¼ããã«ã«æ¬¡ã®ããã«è¡¨ç¤ºããã¾ãï¼
Starting Zeus server [ready] [crashed] [running] [connecting] [waiting] boot âââ default_bundle âââ development_environment â âââ prerake âââ test_environment âââ test_helper Available Commands: [waiting] [crashed] [ready] zeus rake zeus runner (alias: r) zeus server (alias: s) zeus destroy (alias: d) zeus generate (alias: g) zeus console (alias: c) zeus dbconsole zeus test (alias: rspec, testrb)
å¥ã®ã¿ã¼ããã«ã§ããã¹ããå®è¡ãã¾ãï¼
$ zeus rspec spec/
ç¾è¡ã® Sinope ã®ãã¹ããç§ã® PC ã§å®è¡ãã¦ã¿ãã¨ãããZeus æãã§ã¯ 3.67 ç§ãããã¾ããããZeus ç°å¢ä¸ã§å®è¡ãã㨠2.58 ç§ã§çµããã¾ããã
Spring ã®ä½¿ãæ¹
ã¾ããGemfile
ã«ä»¥ä¸ã®ã³ã¼ãã追å ãã¾ãï¼
group :development do gem 'spring' gem 'spring-commands-rspec' end
ããã¦ãbundle install
ã³ãã³ããå®è¡ãã¾ãã
ä½ãæºåã¯è¦ãã¾ããããããªãããã¹ããå®è¡ã§ãã¾ãï¼
$ spring rspec spec/
Zeus ã®å ´åã¨ç°ãªããSpring ã¯ããã¯ã°ã©ã³ãã§é»ã£ã¦ãµã¼ããèµ·åããã®ã§ãç§ãã¡ãå¥ã¦ã£ã³ãã¦ã§æ示çã«ãµã¼ããèµ·åããå¿ è¦ããªãã®ã§ãã
常㫠Spring ã使ã£ã¦ RSpec ã®ãã¹ããå®è¡ããã®ãªããbin
ãã£ã¬ã¯ããªã® rspec
ã³ãã³ããæ¸ãæãã¦ãã¾ãã¨ããã§ãããã次ã®ã³ãã³ããå®è¡ããã¨ãèªåçã«æ¸ãæããå®äºãã¾ãï¼
$ spring binstub rspec
bundle binstub rspec
ãå®è¡ãã㨠bin/rspec
ã®ä¸èº«ãå
ã«æ»ã£ã¦ãã¾ãã®ã§æ³¨æãã¦ãã ããã
ããã¨ãä»å¾ã¯ Spring ã®åå¨ãæèããã« RSpec ã®ãã¹ããå®è¡ã§ãã¾ãï¼
$ bin/rspec spec/
ç¾è¡ã® Sinope ï¼ãã®é£è¼ã§ä½ã£ã¦ãã Rails ã¢ããªã±ã¼ã·ã§ã³ï¼ã®ãã¹ããç§ã® PC ã§å®è¡ãã¦ã¿ãã¨ãããååã¯ãµã¼ãã®èµ·åã«æéãããããã 4.03 ç§ãããã¾ãããã2åç®ãã㯠2.74 ç§ã§çµããã¾ããã
Zeus vs. Spring
ç§ã®ç°å¢ã«ããã¦ã¯ Zeus ã®æ¹ãè¥å¹²éãã£ãã®ã§ãããSpring ã®æ¹ãã¤ã³ã¹ãã¼ã«æã使ç¨æãæéããããã¾ããã§ãããã¾ããbin/rspec
ãæ¸ãæãã¦ãããæ©è½ã便å©ã§ãã
é·æã«æ¸¡ã£ã¦ä½¿ç¨ãã¦ã¿ãªããã¨ã«ã¯ä½ã¨ãè¨ãã¾ããããSpring ã®ç¬¬ä¸å°è±¡ã¯ç´ æ´ããããã®ã§ããã
ã¨ã¯ãããçµè«ãåºãã«ã¯ææå°æ©ã§ããããRuby æ¥çã«ããããã®ç¨®ã®ãã¼ã«ã®æ æ¯çè¡°ã¯é常ã«æ¿ããã®ã§ãã¾ãåå¹´å¾ã«ã¯ã©ããªã£ã¦ãããåããã¾ããã
次åã¯
次åããã¯ãããã®ã¨ããåºçªã®ãªãã£ã Capybara å çã«åç»å ´ããã ãäºå®ã§ããã§ã¯ãã¾ãã
[æ´æ°] spring
㨠spring-commands-rspec
ã Gemfile
çµç±ã§ã¤ã³ã¹ãã¼ã«ããããã«è¨è¿°ãå¤æ´ãã¾ããã(2013/11/11)