All notes
Spring

Intro

github.com.

Spring is a Rails application preloader. It speeds up development by keeping your application running in the background so you don't need to boot it every time you run a test, rake task or migration.

Spring makes extensive use of Process.fork, so won't be able to provide a speed up on platforms which don't support forking (Windows, JRuby).

Installation



# Add in Gemfile:
# gem "spring", group: :development
bundle install

# This generates a bin/spring executable, and inserts a small snippet of code into relevant existing executables, e.g. bin/rake, bin/rails.
bundle exec spring binstub --all

bin/spring status

bin/spring stop

# 'Unspring' your bin/ executables:
bin/spring binstub --remove --all

# Temporarily disable Spring
export DISABLE_SPRING=1

If we edit any of the files which were used to start the application (configs, initializers, your gemfile, e.g. config/application.rb), the application needs to be fully restarted. This happens automatically.

Troubleshooting

If you want to get more information about what Spring is doing, you can run Spring explicitly in a separate terminal:


spring server

Logging output will be printed to stdout. You can also send log output to a file with the SPRING_LOG environment variable.

Compare to Zeus

Disadvantages: Spring lacks support for parallel_tests.