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 14:22:34 +0100 |
commit | 7db55290eabeca9af70883a802ff6770bc88bf33 (patch) | |
tree | a52cb05c059acb264b7d1ea1191a4f21ddcd002c | |
parent | 561494712798e9f8ff9b6abffa1a774d1a883a37 (diff) | |
download | bundler-7db55290eabeca9af70883a802ff6770bc88bf33.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 |