diff options
-rw-r--r-- | .rubocop_todo.yml | 10 | ||||
-rw-r--r-- | lib/bundler.rb | 6 | ||||
-rw-r--r-- | lib/bundler/fetcher.rb | 6 | ||||
-rw-r--r-- | lib/bundler/resolver.rb | 8 | ||||
-rw-r--r-- | spec/realworld/dependency_api_spec.rb | 6 | ||||
-rw-r--r-- | spec/realworld/gemfile_source_header_spec.rb | 6 |
6 files changed, 26 insertions, 16 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index a66ed2604c..ca2481aaf8 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -258,16 +258,6 @@ Style/RedundantSelf: - 'spec/support/less_than_proc.rb' - 'spec/support/ruby_ext.rb' -# Offense count: 6 -# Cop supports --auto-correct. -Style/RescueModifier: - Exclude: - - 'lib/bundler.rb' - - 'lib/bundler/fetcher.rb' - - 'lib/bundler/resolver.rb' - - 'spec/realworld/dependency_api_spec.rb' - - 'spec/realworld/gemfile_source_header_spec.rb' - # Offense count: 1 # Configuration parameters: Methods. Style/SingleLineBlockParams: diff --git a/lib/bundler.rb b/lib/bundler.rb index 0eea855fe3..1da7e6ab88 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -412,7 +412,11 @@ module Bundler def configure_gem_home # TODO: This mkdir_p is only needed for JRuby <= 1.5 and should go away (GH #602) - FileUtils.mkdir_p bundle_path.to_s rescue nil + begin + FileUtils.mkdir_p bundle_path.to_s + rescue + nil + end ENV["GEM_HOME"] = File.expand_path(bundle_path, root) Bundler.rubygems.clear_paths diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb index 465a361762..aa3e4dedf9 100644 --- a/lib/bundler/fetcher.rb +++ b/lib/bundler/fetcher.rb @@ -150,7 +150,11 @@ module Bundler if ruby.engine != "ruby" # engine_version raises on unknown engines - engine_version = ruby.engine_version rescue "???" + engine_version = begin + ruby.engine_version + rescue + "???" + end agent << " #{ruby.engine}/#{engine_version}" end diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb index 527962d134..c9a9ea4f08 100644 --- a/lib/bundler/resolver.rb +++ b/lib/bundler/resolver.rb @@ -282,11 +282,15 @@ module Bundler end def name_for_explicit_dependency_source - Bundler.default_gemfile.basename.to_s rescue "Gemfile" + Bundler.default_gemfile.basename.to_s + rescue + "Gemfile" end def name_for_locking_dependency_source - Bundler.default_lockfile.basename.to_s rescue "Gemfile.lock" + Bundler.default_lockfile.basename.to_s + rescue + "Gemfile.lock" end def requirement_satisfied_by?(requirement, activated, spec) diff --git a/spec/realworld/dependency_api_spec.rb b/spec/realworld/dependency_api_spec.rb index ac551992a8..6b6cef64cb 100644 --- a/spec/realworld/dependency_api_spec.rb +++ b/spec/realworld/dependency_api_spec.rb @@ -20,7 +20,11 @@ describe "gemcutter's dependency API", :realworld => true do ENV["GEM_HOME"] = old_gem_home port = 21_453 - port += 1 while TCPSocket.new("127.0.0.1", port) rescue false + begin + port += 1 while TCPSocket.new("127.0.0.1", port) + rescue + false + end @server_uri = "http://127.0.0.1:#{port}" require File.expand_path("../../support/artifice/endpoint_timeout", __FILE__) diff --git a/spec/realworld/gemfile_source_header_spec.rb b/spec/realworld/gemfile_source_header_spec.rb index aff127db6c..acb8bf0d67 100644 --- a/spec/realworld/gemfile_source_header_spec.rb +++ b/spec/realworld/gemfile_source_header_spec.rb @@ -35,7 +35,11 @@ describe "fetching dependencies with a mirrored source", :rubygems => ">= 2.0" d ENV["GEM_HOME"] = old_gem_home @port = 21_459 - @port += 1 while TCPSocket.new("127.0.0.1", @port) rescue false + begin + @port += 1 while TCPSocket.new("127.0.0.1", @port) + rescue + false + end @server_uri = "http://127.0.0.1:#{@port}" require File.expand_path("../../support/artifice/endpoint_mirror_source", __FILE__) |