summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-02-24 06:11:01 +0100
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-03-20 14:22:34 +0100
commitef70be132706c56fda4f346c77d5a96e176d6b9b (patch)
tree1246e62686dadc5306ad1f95bab4e14e7cf00523
parent4cf283fe747d78cf127fae76621bfe8469d7482c (diff)
downloadbundler-ef70be132706c56fda4f346c77d5a96e176d6b9b.tar.gz
Make `bin/rspec` activate only `rspec`
-rwxr-xr-xbin/rspec15
1 files changed, 11 insertions, 4 deletions
diff --git a/bin/rspec b/bin/rspec
index 39109d66f2..4ef45c9b32 100755
--- a/bin/rspec
+++ b/bin/rspec
@@ -6,10 +6,17 @@ load File.expand_path("../with_rubygems", __FILE__) if ENV["RGV"]
require "rubygems"
bundler_spec = Gem::Specification.load(File.expand_path("../../bundler.gemspec", __FILE__))
-bundler_spec.dependencies.each do |dep|
- gem dep.name, dep.requirement
+rspec = bundler_spec.development_dependencies.find do |dep|
+ dep.name == "rspec"
end
-Gem.finish_resolve if Gem.respond_to?(:finish_resolve)
+rspec_requirement = rspec.requirement.to_s
-load Gem.bin_path("rspec-core", "rspec")
+begin
+ gem "rspec", rspec_requirement
+ Gem.finish_resolve if Gem.respond_to?(:finish_resolve)
+
+ load Gem.bin_path("rspec-core", "rspec")
+rescue Gem::LoadError
+ warn "We couln't activate rspec (#{rspec_requirement}). Try `gem install rspec:'#{rspec_requirement}'`"
+end