summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2015-04-12 11:31:06 -0600
committermo khan <mo@mokhan.ca>2015-04-12 11:31:06 -0600
commit21ba5290c7c4a6741c1ab436acf430e49f8250ec (patch)
tree0338392155658006bab72ca53f1d7c69aad56b04 /bin
parent64da38306dcd219120240a7e714e60c1ff3fe6dc (diff)
add spring binstub for rspec.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/rspec4
-rwxr-xr-xbin/spring26
2 files changed, 18 insertions, 12 deletions
diff --git a/bin/rspec b/bin/rspec
index 0c86b5c..5318d0c 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 38fee6f..7f24d96 100755
--- a/bin/spring
+++ b/bin/spring
@@ -1,16 +1,18 @@
#!/usr/bin/env ruby
-#
-# This file was generated by Bundler.
-#
-# The application 'spring' is installed as part of a gem, and
-# this file is here to facilitate running it.
-#
-require 'pathname'
-ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
- Pathname.new(__FILE__).realpath)
+# This file loads spring without using Bundler, in order to be fast
+# It gets overwritten when you run the `spring binstub` command
-require 'rubygems'
-require 'bundler/setup'
+unless defined?(Spring)
+ require "rubygems"
+ require "bundler"
-load Gem.bin_path('spring', 'spring')
+ if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)
+ ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR)
+ ENV["GEM_HOME"] = ""
+ Gem.paths = ENV
+
+ gem "spring", match[1]
+ require "spring/binstub"
+ end
+end