From 43c52d77ab8b2406e81c4db9357ad56daa70f04d Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Thu, 6 Apr 2017 12:51:00 +0200 Subject: [PATCH] Spring updated --- bin/rails | 5 +++-- bin/rake | 5 +++-- bin/spring | 14 ++++++++------ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/bin/rails b/bin/rails index 7feb6a3..f2b0313 100755 --- a/bin/rails +++ b/bin/rails @@ -1,7 +1,8 @@ #!/usr/bin/env ruby begin - load File.expand_path("../spring", __FILE__) -rescue LoadError + load File.expand_path('../spring', __FILE__) +rescue LoadError => e + raise unless e.message.include?('spring') end APP_PATH = File.expand_path('../../config/application', __FILE__) require_relative '../config/boot' diff --git a/bin/rake b/bin/rake index 8017a02..d87d5f5 100755 --- a/bin/rake +++ b/bin/rake @@ -1,7 +1,8 @@ #!/usr/bin/env ruby begin - load File.expand_path("../spring", __FILE__) -rescue LoadError + load File.expand_path('../spring', __FILE__) +rescue LoadError => e + raise unless e.message.include?('spring') end require_relative '../config/boot' require 'rake' diff --git a/bin/spring b/bin/spring index 7b45d37..fb2ec2e 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