aboutsummaryrefslogtreecommitdiffstats
path: root/bin/spring
diff options
context:
space:
mode:
Diffstat (limited to 'bin/spring')
-rwxr-xr-xbin/spring14
1 files changed, 8 insertions, 6 deletions
diff --git a/bin/spring b/bin/spring
index 7b45d374f..fb2ec2ebb 100755
--- a/bin/spring
+++ b/bin/spring
@@ -4,12 +4,14 @@
# It gets overwritten when you run the `spring binstub` command.
unless defined?(Spring)
- require "rubygems"
- require "bundler"
+ require 'rubygems'
+ require 'bundler'
- 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"
+ lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
+ spring = lockfile.specs.detect { |spec| spec.name == "spring" }
+ if spring
+ Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
+ gem 'spring', spring.version
+ require 'spring/binstub'
end
end