Commit 21ba529

mo khan <mo@mokhan.ca>
2015-04-12 17:31:06
add spring binstub for rspec.
1 parent 64da383
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.
 #
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
Gemfile
@@ -46,6 +46,7 @@ group :development, :test do
 
   # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
   gem 'spring'
+  gem 'spring-commands-rspec'
   gem 'rspec-rails'
   gem 'foreman'
   gem 'i18n-tasks'
Gemfile.lock
@@ -207,6 +207,8 @@ GEM
     simplecov-html (0.8.0)
     slop (3.6.0)
     spring (1.2.0)
+    spring-commands-rspec (1.0.4)
+      spring (>= 0.9.1)
     sprockets (2.12.3)
       hike (~> 1.2)
       multi_json (~> 1.0)
@@ -272,6 +274,7 @@ DEPENDENCIES
   sass-rails (~> 5.0)
   sdoc (~> 0.4.0)
   spring
+  spring-commands-rspec
   teaspoon
   turbolinks
   uglifier (>= 1.3.0)