diff --git a/bin/rspec b/bin/rspec index 8bc84617e..534d2bb5f 100755 --- a/bin/rspec +++ b/bin/rspec @@ -1,4 +1,8 @@ #!/usr/bin/env ruby +begin + load File.expand_path("../spring", __FILE__) +rescue LoadError +end # # This file was generated by Bundler. # diff --git a/bin/spring b/bin/spring index adc409e83..7b45d374f 100755 --- a/bin/spring +++ b/bin/spring @@ -1,19 +1,15 @@ #!/usr/bin/env ruby -# This file loads spring without using Bundler, in order to be fast -# It gets overwritten when you run the `spring binstub` command +# This file loads spring without using Bundler, in order to be fast. +# It gets overwritten when you run the `spring binstub` command. unless defined?(Spring) - require 'rubygems' - require 'bundler' + require "rubygems" + require "bundler" - match = Bundler.default_lockfile.read.match(/^GEM$.*?^ spring \((.*?)\)$.*?^$/m) - if match - ENV['GEM_PATH'] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR) - ENV['GEM_HOME'] = nil - Gem.paths = ENV - - gem 'spring', match[1] - require 'spring/binstub' + if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m) + Gem.paths = { "GEM_PATH" => [Bundler.bundle_path.to_s, *Gem.path].uniq } + gem "spring", match[1] + require "spring/binstub" end end