spring: add Spring to binstubs of default commands

Binstubs generated with `bundle exec spring binstub --all`.

This allows to type `bin/rails`, `bin/rake` or `bin/rspec` and have it
using Spring (rather than `bin/spring rails`).

On my machine it produces a nice speedup:

- `rake -T`: 5.6s
- `bin/rake -T`: 0.25s

The startup speedup for `rails` and `rspec` is similar.
This commit is contained in:
Pierre de La Morinerie 2018-06-18 11:14:46 +00:00
parent c2bc151803
commit ae5754e6c6
4 changed files with 16 additions and 0 deletions

View file

@ -4,6 +4,7 @@ require:
AllCops: AllCops:
Exclude: Exclude:
- "db/schema.rb" - "db/schema.rb"
- "bin/*"
Bundler/DuplicatedGem: Bundler/DuplicatedGem:
Enabled: true Enabled: true

View file

@ -1,4 +1,9 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
APP_PATH = File.expand_path('../config/application', __dir__) APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot' require_relative '../config/boot'
require 'rails/commands' require 'rails/commands'

View file

@ -1,4 +1,9 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
require_relative '../config/boot' require_relative '../config/boot'
require 'rake' require 'rake'
Rake.application.run Rake.application.run

View file

@ -1,3 +1,8 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
load Gem.bin_path('rspec-core', 'rspec') load Gem.bin_path('rspec-core', 'rspec')