From b492f83b95fb87f2b4e87c54b6e84f909e7e99a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Mon, 12 Aug 2019 22:54:28 +0200 Subject: Refactor activation errors --- bin/parallel_rspec | 6 +----- bin/rake | 6 +----- bin/ronn | 6 +----- bin/rspec | 6 +----- bin/rubocop | 6 +----- spec/support/rubygems_ext.rb | 2 ++ 6 files changed, 7 insertions(+), 25 deletions(-) diff --git a/bin/parallel_rspec b/bin/parallel_rspec index 26402aee7c..9783533198 100755 --- a/bin/parallel_rspec +++ b/bin/parallel_rspec @@ -5,8 +5,4 @@ load File.expand_path("../with_rubygems", __FILE__) if ENV["RGV"] require_relative "../spec/support/rubygems_ext" -begin - Spec::Rubygems.gem_load("parallel_tests", "parallel_rspec") -rescue Gem::LoadError => e - warn "We couln't activate parallel_tests (#{e.requirement}). Run `gem install parallel_tests:'#{e.requirement}'`" -end +Spec::Rubygems.gem_load("parallel_tests", "parallel_rspec") diff --git a/bin/rake b/bin/rake index f9a28e88c2..2fb69d19f3 100755 --- a/bin/rake +++ b/bin/rake @@ -5,8 +5,4 @@ load File.expand_path("../with_rubygems", __FILE__) if ENV["RGV"] require_relative "../spec/support/rubygems_ext" -begin - Spec::Rubygems.gem_load("rake", "rake") -rescue Gem::LoadError => e - warn "We couln't activate rake (#{e.requirement}). Run `gem install rake:'#{e.requirement}'`" -end +Spec::Rubygems.gem_load("rake", "rake") diff --git a/bin/ronn b/bin/ronn index 4501d03af3..e47fb518a4 100755 --- a/bin/ronn +++ b/bin/ronn @@ -5,8 +5,4 @@ load File.expand_path("../with_rubygems", __FILE__) if ENV["RGV"] require_relative "../spec/support/rubygems_ext" -begin - Spec::Rubygems.gem_load("ronn", "ronn") -rescue Gem::LoadError => e - warn "We couln't activate ronn (#{e.requirement}). Run `gem install ronn:'#{e.requirement}'`" -end +Spec::Rubygems.gem_load("ronn", "ronn") diff --git a/bin/rspec b/bin/rspec index 7d6c53cda4..4c139156f9 100755 --- a/bin/rspec +++ b/bin/rspec @@ -5,8 +5,4 @@ load File.expand_path("../with_rubygems", __FILE__) if ENV["RGV"] require_relative "../spec/support/rubygems_ext" -begin - Spec::Rubygems.gem_load("rspec-core", "rspec") -rescue Gem::LoadError => e - warn "We couln't activate rspec (#{e.requirement}). Run `gem install rspec:'#{e.requirement}'`" -end +Spec::Rubygems.gem_load("rspec-core", "rspec") diff --git a/bin/rubocop b/bin/rubocop index f700d073ca..818aaf7a9d 100755 --- a/bin/rubocop +++ b/bin/rubocop @@ -5,8 +5,4 @@ load File.expand_path("../with_rubygems", __FILE__) if ENV["RGV"] require_relative "../spec/support/rubygems_ext" -begin - Spec::Rubygems.gem_load("rubocop", "rubocop") -rescue Gem::LoadError => e - warn "We couln't activate rubocop (#{e.requirement}). Run `gem install rubocop:'#{e.requirement}'`" -end +Spec::Rubygems.gem_load("rubocop", "rubocop") diff --git a/spec/support/rubygems_ext.rb b/spec/support/rubygems_ext.rb index aa1ab768b2..6472b46652 100644 --- a/spec/support/rubygems_ext.rb +++ b/spec/support/rubygems_ext.rb @@ -43,6 +43,8 @@ module Spec def gem_load(gem_name, bin_container) gem_activate(gem_name) load Gem.bin_path(gem_name, bin_container) + rescue Gem::LoadError => e + warn "We couln't activate #{gem_name} (#{e.requirement}). Run `gem install #{gem_name}:'#{e.requirement}'`" end def gem_require(gem_name) -- cgit v1.2.1