From 7fa38bffa35f5933fdc12567b1ea8112ffea3834 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Thu, 19 Jan 2017 01:46:23 +0100 Subject: [PATCH] Update spring binstubs --- bin/rspec | 13 ------------- bin/spring | 7 ++++--- test/dummy/bin/spring | 7 ++++--- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/bin/rspec b/bin/rspec index f234e5f..6e67092 100755 --- a/bin/rspec +++ b/bin/rspec @@ -1,21 +1,8 @@ #!/usr/bin/env ruby -# -# This file was generated by Bundler. -# -# The application 'rspec' is installed as part of a gem, and -# this file is here to facilitate running it. -# - begin load File.expand_path('../spring', __FILE__) rescue LoadError => e raise unless e.message.include?('spring') end - -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -require 'rubygems' require 'bundler/setup' load Gem.bin_path('rspec-core', 'rspec') diff --git a/bin/spring b/bin/spring index 62ec28f..9bc076b 100755 --- a/bin/spring +++ b/bin/spring @@ -7,9 +7,10 @@ unless defined?(Spring) 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] + lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read) + if spring = lockfile.specs.detect { |spec| spec.name == "spring" } + Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path + gem 'spring', spring.version require 'spring/binstub' end end diff --git a/test/dummy/bin/spring b/test/dummy/bin/spring index 62ec28f..9bc076b 100755 --- a/test/dummy/bin/spring +++ b/test/dummy/bin/spring @@ -7,9 +7,10 @@ unless defined?(Spring) 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] + lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read) + if spring = lockfile.specs.detect { |spec| spec.name == "spring" } + Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path + gem 'spring', spring.version require 'spring/binstub' end end