From 99dc9c6fc9880519dddf2cb2557b984792843848 Mon Sep 17 00:00:00 2001 From: Jeroen van Baarsen Date: Sun, 16 Feb 2014 11:22:03 +0100 Subject: Inserted spring in the binstubs Now possible to run: `bin/rails` `bin/rspec` `bin/spinach` `bin/rake` --- bin/rails | 4 ++++ bin/rake | 4 ++++ bin/rspec | 7 +++++++ bin/spinach | 7 +++++++ bin/spring | 18 ++++++++++++++++++ 5 files changed, 40 insertions(+) create mode 100644 bin/rspec create mode 100644 bin/spinach create mode 100644 bin/spring diff --git a/bin/rails b/bin/rails index 728cd85aa58..7feb6a30e69 100644 --- a/bin/rails +++ b/bin/rails @@ -1,4 +1,8 @@ #!/usr/bin/env ruby +begin + load File.expand_path("../spring", __FILE__) +rescue LoadError +end APP_PATH = File.expand_path('../../config/application', __FILE__) require_relative '../config/boot' require 'rails/commands' diff --git a/bin/rake b/bin/rake index 17240489f64..8017a0271d2 100644 --- a/bin/rake +++ b/bin/rake @@ -1,4 +1,8 @@ #!/usr/bin/env ruby +begin + load File.expand_path("../spring", __FILE__) +rescue LoadError +end require_relative '../config/boot' require 'rake' Rake.application.run diff --git a/bin/rspec b/bin/rspec new file mode 100644 index 00000000000..41e37089ac2 --- /dev/null +++ b/bin/rspec @@ -0,0 +1,7 @@ +#!/usr/bin/env ruby +begin + load File.expand_path("../spring", __FILE__) +rescue LoadError +end +require 'bundler/setup' +load Gem.bin_path('rspec', 'rspec') diff --git a/bin/spinach b/bin/spinach new file mode 100644 index 00000000000..a080e286cfe --- /dev/null +++ b/bin/spinach @@ -0,0 +1,7 @@ +#!/usr/bin/env ruby +begin + load File.expand_path("../spring", __FILE__) +rescue LoadError +end +require 'bundler/setup' +load Gem.bin_path('spinach', 'spinach') diff --git a/bin/spring b/bin/spring new file mode 100644 index 00000000000..253ec37c345 --- /dev/null +++ b/bin/spring @@ -0,0 +1,18 @@ +#!/usr/bin/env ruby + +# This file loads spring without using Bundler, in order to be fast +# It gets overwritten when you run the `spring binstub` command + +unless defined?(Spring) + require "rubygems" + require "bundler" + + 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 -- cgit v1.2.1