diff --git a/Gemfile b/Gemfile index c3aa756..d311460 100644 --- a/Gemfile +++ b/Gemfile @@ -24,7 +24,7 @@ group :development do end group :test do - # rspec + # unit tests gem "rspec-instafail", "0.2.6", require: false gem "fuubar", "2.0.0" gem "nyan-cat-formatter", require: false @@ -40,12 +40,16 @@ group :test do end group :development, :test do - # rspec + # unit tests gem "rspec-rails", "3.3.1" - # guard + # automatic test runs gem "guard-rspec", require: false + # preloading environment + gem "spring" + gem "spring-commands-rspec" + # GUID generation gem "uuid", "2.3.8" diff --git a/Gemfile.lock b/Gemfile.lock index c456053..0beb76f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -204,6 +204,9 @@ GEM simplecov-rcov (0.2.3) simplecov (>= 0.4.1) slop (3.6.0) + spring (1.3.6) + spring-commands-rspec (1.0.4) + spring (>= 0.9.1) sprockets (3.2.0) rack (~> 1.0) sprockets-rails (2.3.1) @@ -242,6 +245,8 @@ DEPENDENCIES rubocop (= 0.32.0) simplecov (= 0.10.0) simplecov-rcov (= 0.2.3) + spring + spring-commands-rspec sqlite3 uuid (= 2.3.8) yard diff --git a/bin/rails b/bin/rails index 4595731..f281890 100755 --- a/bin/rails +++ b/bin/rails @@ -1,6 +1,11 @@ #!/usr/bin/env ruby # This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application. +begin + load File.expand_path("../spring", __FILE__) +rescue LoadError +end + ENGINE_ROOT = File.expand_path('../..', __FILE__) ENGINE_PATH = File.expand_path('../../lib/diaspora_federation/engine', __FILE__) diff --git a/bin/rake b/bin/rake index 26c7a2d..6779365 100755 --- a/bin/rake +++ b/bin/rake @@ -6,6 +6,11 @@ # this file is here to facilitate running it. # +begin + load File.expand_path("../spring", __FILE__) +rescue LoadError +end + require 'pathname' ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", Pathname.new(__FILE__).realpath) diff --git a/bin/rspec b/bin/rspec index 0c86b5c..ce2c396 100755 --- a/bin/rspec +++ b/bin/rspec @@ -6,11 +6,15 @@ # this file is here to facilitate running it. # +begin + load File.expand_path("../spring", __FILE__) +rescue LoadError +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 new file mode 100755 index 0000000..7b45d37 --- /dev/null +++ b/bin/spring @@ -0,0 +1,15 @@ +#!/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) + Gem.paths = { "GEM_PATH" => [Bundler.bundle_path.to_s, *Gem.path].uniq } + gem "spring", match[1] + require "spring/binstub" + end +end diff --git a/config/spring.rb b/config/spring.rb new file mode 100644 index 0000000..5684f46 --- /dev/null +++ b/config/spring.rb @@ -0,0 +1 @@ +Spring.application_root = "./test/dummy" diff --git a/test/dummy/bin/rails b/test/dummy/bin/rails index 5191e69..4d608ed 100755 --- a/test/dummy/bin/rails +++ b/test/dummy/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/test/dummy/bin/rake b/test/dummy/bin/rake index 1724048..8017a02 100755 --- a/test/dummy/bin/rake +++ b/test/dummy/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/test/dummy/bin/spring b/test/dummy/bin/spring new file mode 100755 index 0000000..7b45d37 --- /dev/null +++ b/test/dummy/bin/spring @@ -0,0 +1,15 @@ +#!/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) + Gem.paths = { "GEM_PATH" => [Bundler.bundle_path.to_s, *Gem.path].uniq } + gem "spring", match[1] + require "spring/binstub" + end +end