spring using by default

故事扮演 提交于 2019-12-25 03:59:07

问题


I upgraded rails to 4.1.0 & installed gem "spring"

After it, I patched bundle exec spring binstub --all. Now, all my bin/* includes

begin
  load File.expand_path("../spring", __FILE__)
rescue LoadError
end

But, if I run, saying time spring rake -T & time rake -T times 1 second & 3 seconds! It seems that spring not used by default in my application. What's going wrong? It's bad thing that I need to write annoying spring ..command.. before any rake task, rails server or rspec. What I need to do to avoid spring command with spring worked by default?


回答1:


You don't need to prepend spring everytime. I'm not sure why you're getting those numbers but try the following.

# make sure that spring server is stopped
>> spring stop

# take note of the time here
>> time bin/rake routes

# start spring server
>> spring

# test routes again
>> time bin/rake routes

The second bin/rake routes should be very fast. In one of our apps, without spring, it takes 8 seconds to show the routes. With spring, it's less than a second.

For rspec, you need to install an additional gem for that. Look at the additional commands section of the spring gem



来源:https://stackoverflow.com/questions/23234045/spring-using-by-default

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!