问题
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