diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-03-04 17:40:03 +0100 |
---|---|---|
committer | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-03-20 11:47:38 +0100 |
commit | 326485fd94068f07859d15279e971dadc9b42d29 (patch) | |
tree | 3230f33eb6f1178de9cb553965c81558ad348d9c | |
parent | 26761d13eddbb8cce4292525266e57e74c3e3431 (diff) | |
download | bundler-326485fd94068f07859d15279e971dadc9b42d29.tar.gz |
Make `bin/rubocop` activate only `rubocop`
-rwxr-xr-x | bin/rubocop | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/bin/rubocop b/bin/rubocop index 8014aff639..ac84b47963 100755 --- a/bin/rubocop +++ b/bin/rubocop @@ -6,12 +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 +rubocop = bundler_spec.dependencies.find do |dep| + dep.name == "rubocop" end -gem "rubocop", "= 0.65.0" +rubocop_requirement = rubocop.requirement.to_s -Gem.finish_resolve if Gem.respond_to?(:finish_resolve) +begin + gem "rubocop", rubocop_requirement + Gem.finish_resolve if Gem.respond_to?(:finish_resolve) -load Gem.bin_path("rubocop", "rubocop") + load Gem.bin_path("rubocop", "rubocop") +rescue Gem::LoadError + warn "We couln't activate rubocop (#{rubocop_requirement}). Try `gem install rubocop:'#{rubocop_requirement}'`" +end |