summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHomu <homu@barosl.com>2015-11-27 15:12:00 +0900
committerHomu <homu@barosl.com>2015-11-27 15:12:00 +0900
commit437f604956e629e1b96270d87f6fdb05b189de2d (patch)
treee01f1583c45652499610c07a95a28a5b869980f1
parent50731b93d77fc8b4155d11306afb51d5e9534060 (diff)
parent046f2831c1518519c47b8b5be97c1ed8aef4e58c (diff)
downloadbundler-437f604956e629e1b96270d87f6fdb05b189de2d.tar.gz
Auto merge of #4124 - bundler:seg-rubocop, r=indirect
More rubocop_todo cleanup
-rw-r--r--.rubocop.yml9
-rw-r--r--.rubocop_todo.yml155
-rw-r--r--Rakefile8
-rwxr-xr-xexe/bundle11
-rwxr-xr-xexe/bundler11
-rw-r--r--lib/bundler.rb12
-rw-r--r--lib/bundler/cli.rb2
-rw-r--r--lib/bundler/cli/common.rb1
-rw-r--r--lib/bundler/cli/gem.rb4
-rw-r--r--lib/bundler/cli/install.rb4
-rw-r--r--lib/bundler/cli/outdated.rb2
-rw-r--r--lib/bundler/definition.rb47
-rw-r--r--lib/bundler/dependency.rb8
-rw-r--r--lib/bundler/deprecate.rb2
-rw-r--r--lib/bundler/dsl.rb25
-rw-r--r--lib/bundler/fetcher.rb13
-rw-r--r--lib/bundler/friendly_errors.rb1
-rw-r--r--lib/bundler/gem_helper.rb16
-rw-r--r--lib/bundler/gem_helpers.rb1
-rw-r--r--lib/bundler/graph.rb12
-rw-r--r--lib/bundler/injector.rb2
-rw-r--r--lib/bundler/installer/standalone.rb2
-rw-r--r--lib/bundler/lazy_specification.rb4
-rw-r--r--lib/bundler/lockfile_parser.rb4
-rw-r--r--lib/bundler/match_platform.rb6
-rw-r--r--lib/bundler/remote_specification.rb2
-rw-r--r--lib/bundler/resolver.rb75
-rw-r--r--lib/bundler/ruby_version.rb2
-rw-r--r--lib/bundler/rubygems_ext.rb4
-rw-r--r--lib/bundler/rubygems_integration.rb24
-rw-r--r--lib/bundler/runtime.rb2
-rw-r--r--lib/bundler/settings.rb14
-rw-r--r--lib/bundler/shared_helpers.rb11
-rw-r--r--lib/bundler/source/git.rb4
-rw-r--r--lib/bundler/source/git/git_proxy.rb12
-rw-r--r--lib/bundler/source/path.rb18
-rw-r--r--lib/bundler/source/rubygems.rb4
-rw-r--r--lib/bundler/ui/shell.rb3
-rw-r--r--spec/bundler/bundler_spec.rb15
-rw-r--r--spec/bundler/dsl_spec.rb8
-rw-r--r--spec/bundler/fetcher/index_spec.rb6
-rw-r--r--spec/bundler/fetcher_spec.rb2
-rw-r--r--spec/bundler/friendly_errors_spec.rb4
-rw-r--r--spec/bundler/gem_helper_spec.rb8
-rw-r--r--spec/bundler/retry_spec.rb8
-rw-r--r--spec/cache/gems_spec.rb2
-rw-r--r--spec/cache/git_spec.rb2
-rw-r--r--spec/commands/help_spec.rb4
-rw-r--r--spec/commands/init_spec.rb4
-rw-r--r--spec/install/gemfile/git_spec.rb22
-rw-r--r--spec/install/gems/flex_spec.rb4
-rw-r--r--spec/install/gems/sources_spec.rb2
-rw-r--r--spec/install/gems/sudo_spec.rb2
-rw-r--r--spec/lock/lockfile_spec.rb8
-rw-r--r--spec/realworld/dependency_api_spec.rb10
-rw-r--r--spec/realworld/gemfile_source_header_spec.rb10
-rw-r--r--spec/resolver/basic_spec.rb8
-rw-r--r--spec/runtime/load_spec.rb12
-rw-r--r--spec/runtime/setup_spec.rb16
-rw-r--r--spec/runtime/with_clean_env_spec.rb4
-rw-r--r--spec/support/artifice/endpoint.rb19
-rw-r--r--spec/support/artifice/endpoint_creds_diff_host.rb2
-rw-r--r--spec/support/builders.rb13
-rw-r--r--spec/support/helpers.rb17
-rw-r--r--spec/support/indexes.rb5
-rw-r--r--spec/support/less_than_proc.rb2
-rw-r--r--spec/support/ruby_ext.rb2
-rw-r--r--spec/support/rubygems_ext.rb5
-rw-r--r--spec/update/git_spec.rb2
69 files changed, 296 insertions, 469 deletions
diff --git a/.rubocop.yml b/.rubocop.yml
index 3692909527..adf2867b00 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -27,9 +27,18 @@ Style/AccessModifierIndentation:
Style/AlignParameters:
EnforcedStyle: with_fixed_indentation
+Style/MultilineBlockChain:
+ Enabled: false
+
Style/MultilineOperationIndentation:
EnforcedStyle: indented
+Style/PerlBackrefs:
+ Enabled: false
+
+Style/SingleLineBlockParams:
+ Enabled: false
+
Style/SpaceInsideBlockBraces:
SpaceBeforeBlockParameters: false
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index a66ed2604c..a97947f794 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -26,11 +26,6 @@ Lint/NestedMethodDefinition:
Exclude:
- 'lib/bundler/graph.rb'
-# Offense count: 1
-Lint/NonLocalExitFromIterator:
- Exclude:
- - 'lib/bundler/rubygems_integration.rb'
-
# Offense count: 5
Lint/RescueException:
Exclude:
@@ -66,28 +61,6 @@ Style/AccessorMethodName:
Exclude:
- 'lib/bundler/source/git.rb'
-# Offense count: 16
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles.
-Style/AndOr:
- Exclude:
- - 'lib/bundler/gem_helper.rb'
- - 'lib/bundler/graph.rb'
- - 'lib/bundler/lazy_specification.rb'
- - 'lib/bundler/match_platform.rb'
- - 'lib/bundler/remote_specification.rb'
- - 'lib/bundler/resolver.rb'
- - 'lib/bundler/rubygems_integration.rb'
- - 'lib/bundler/runtime.rb'
- - 'lib/bundler/settings.rb'
- - 'spec/support/builders.rb'
-
-# Offense count: 24
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
-Style/BlockDelimiters:
- Enabled: false
-
# Offense count: 3
Style/CaseEquality:
Exclude:
@@ -95,12 +68,6 @@ Style/CaseEquality:
- 'lib/bundler/match_platform.rb'
- 'lib/bundler/rubygems_ext.rb'
-# Offense count: 4
-# Cop supports --auto-correct.
-# Configuration parameters: IndentWhenRelativeTo, SupportedStyles, IndentOneStep.
-Style/CaseIndentation:
- Enabled: false
-
# Offense count: 22
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/ClassAndModuleChildren:
@@ -111,29 +78,6 @@ Style/ClassAndModuleChildren:
Style/Documentation:
Enabled: false
-# Offense count: 2
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles.
-Style/EmptyElse:
- Exclude:
- - 'lib/bundler/fetcher.rb'
- - 'lib/bundler/ruby_version.rb'
-
-# Offense count: 10
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles.
-Style/EmptyLinesAroundModuleBody:
- Exclude:
- - 'lib/bundler/cli/common.rb'
- - 'lib/bundler/deprecate.rb'
- - 'lib/bundler/dsl.rb'
- - 'lib/bundler/fetcher.rb'
- - 'lib/bundler/friendly_errors.rb'
- - 'lib/bundler/gem_helpers.rb'
- - 'spec/support/builders.rb'
- - 'spec/support/indexes.rb'
- - 'spec/support/rubygems_ext.rb'
-
# Offense count: 1
# Configuration parameters: Exclude.
Style/FileName:
@@ -153,83 +97,12 @@ Style/GlobalVars:
Style/GuardClause:
Enabled: false
-# Offense count: 18
-# Cop supports --auto-correct.
-# Configuration parameters: MaxLineLength.
-Style/IfUnlessModifier:
- Exclude:
- - 'lib/bundler.rb'
- - 'lib/bundler/cli/install.rb'
- - 'lib/bundler/definition.rb'
- - 'lib/bundler/dependency.rb'
- - 'lib/bundler/fetcher.rb'
- - 'lib/bundler/gem_helper.rb'
- - 'lib/bundler/lockfile_parser.rb'
- - 'lib/bundler/rubygems_integration.rb'
- - 'lib/bundler/settings.rb'
- - 'lib/bundler/source/git.rb'
- - 'lib/bundler/source/git/git_proxy.rb'
- - 'spec/support/builders.rb'
-
# Offense count: 2
Style/ModuleFunction:
Exclude:
- 'lib/bundler/shared_helpers.rb'
- 'spec/support/path.rb'
-# Offense count: 1
-Style/MultilineBlockChain:
- Exclude:
- - 'spec/support/less_than_proc.rb'
-
-# Offense count: 3
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles.
-Style/MultilineOperationIndentation:
- Enabled: false
-
-# Offense count: 10
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
-Style/Next:
- Exclude:
- - 'exe/bundle'
- - 'exe/bundler'
- - 'lib/bundler/definition.rb'
- - 'lib/bundler/dsl.rb'
- - 'lib/bundler/resolver.rb'
- - 'lib/bundler/source/path.rb'
- - 'spec/support/artifice/endpoint.rb'
-
-# Offense count: 13
-# Cop supports --auto-correct.
-Style/ParallelAssignment:
- Exclude:
- - 'lib/bundler/dsl.rb'
- - 'lib/bundler/shared_helpers.rb'
- - 'lib/bundler/ui/shell.rb'
- - 'spec/bundler/bundler_spec.rb'
- - 'spec/support/helpers.rb'
-
-# Offense count: 67
-# Cop supports --auto-correct.
-# Configuration parameters: PreferredDelimiters.
-Style/PercentLiteralDelimiters:
- Enabled: false
-
-# Offense count: 22
-# Cop supports --auto-correct.
-Style/PerlBackrefs:
- Exclude:
- - 'exe/bundle'
- - 'exe/bundler'
- - 'lib/bundler/cli/gem.rb'
- - 'lib/bundler/dsl.rb'
- - 'lib/bundler/lockfile_parser.rb'
- - 'lib/bundler/runtime.rb'
- - 'lib/bundler/source/git/git_proxy.rb'
- - 'lib/bundler/source/path.rb'
-
# Offense count: 8
# Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist.
Style/PredicateName:
@@ -245,31 +118,3 @@ Style/PredicateName:
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/RaiseArgs:
Enabled: false
-
-# Offense count: 7
-# Cop supports --auto-correct.
-Style/RedundantSelf:
- Exclude:
- - 'lib/bundler.rb'
- - 'lib/bundler/definition.rb'
- - 'lib/bundler/graph.rb'
- - 'lib/bundler/rubygems_integration.rb'
- - 'lib/bundler/source/rubygems.rb'
- - '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:
- Exclude:
- - 'lib/bundler/cli/gem.rb'
diff --git a/Rakefile b/Rakefile
index bbe10ef802..445daf19b7 100644
--- a/Rakefile
+++ b/Rakefile
@@ -42,8 +42,8 @@ namespace :spec do
end
deps.sort_by {|name, _| name }.each do |name, version|
- sh %{#{Gem.ruby} -S gem list -i "^#{name}$" -v "#{version}" || } +
- %{#{Gem.ruby} -S gem install #{name} -v "#{version}" --no-ri --no-rdoc}
+ sh %(#{Gem.ruby} -S gem list -i "^#{name}$" -v "#{version}" || ) +
+ %(#{Gem.ruby} -S gem install #{name} -v "#{version}" --no-ri --no-rdoc)
end
# Download and install gems used inside tests
@@ -99,14 +99,14 @@ begin
end
desc "Run the real-world spec suite (requires internet)"
- task :realworld => %w[set_realworld spec]
+ task :realworld => %w(set_realworld spec)
task :set_realworld do
ENV["BUNDLER_REALWORLD_TESTS"] = "1"
end
desc "Run the spec suite with the sudo tests"
- task :sudo => %w[set_sudo spec clean_sudo]
+ task :sudo => %w(set_sudo spec clean_sudo)
task :set_sudo do
ENV["BUNDLER_SUDO_TESTS"] = "1"
diff --git a/exe/bundle b/exe/bundle
index a06c6ab47e..5baa52235a 100755
--- a/exe/bundle
+++ b/exe/bundle
@@ -6,12 +6,11 @@ Signal.trap("INT") { exit 1 }
require "bundler"
# Check if an older version of bundler is installed
$LOAD_PATH.each do |path|
- if path =~ %r'/bundler-0\.(\d+)' && $1.to_i < 9
- err = "Looks like you have a version of bundler that's older than 0.9.\n"
- err << "Please remove your old versions.\n"
- err << "An easy way to do this is by running `gem cleanup bundler`."
- abort(err)
- end
+ next unless path =~ %r{/bundler-0\.(\d+)} && $1.to_i < 9
+ err = "Looks like you have a version of bundler that's older than 0.9.\n"
+ err << "Please remove your old versions.\n"
+ err << "An easy way to do this is by running `gem cleanup bundler`."
+ abort(err)
end
require "bundler/friendly_errors"
diff --git a/exe/bundler b/exe/bundler
index a06c6ab47e..5baa52235a 100755
--- a/exe/bundler
+++ b/exe/bundler
@@ -6,12 +6,11 @@ Signal.trap("INT") { exit 1 }
require "bundler"
# Check if an older version of bundler is installed
$LOAD_PATH.each do |path|
- if path =~ %r'/bundler-0\.(\d+)' && $1.to_i < 9
- err = "Looks like you have a version of bundler that's older than 0.9.\n"
- err << "Please remove your old versions.\n"
- err << "An easy way to do this is by running `gem cleanup bundler`."
- abort(err)
- end
+ next unless path =~ %r{/bundler-0\.(\d+)} && $1.to_i < 9
+ err = "Looks like you have a version of bundler that's older than 0.9.\n"
+ err << "Please remove your old versions.\n"
+ err << "An easy way to do this is by running `gem cleanup bundler`."
+ abort(err)
end
require "bundler/friendly_errors"
diff --git a/lib/bundler.rb b/lib/bundler.rb
index 0eea855fe3..be90b0628e 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -175,7 +175,7 @@ module Bundler
def app_cache(custom_path = nil)
path = custom_path || root
- path.join(self.settings.app_cache_path)
+ path.join(settings.app_cache_path)
end
def tmp(name = Process.pid.to_s)
@@ -252,9 +252,7 @@ module Bundler
def requires_sudo?
return @requires_sudo if defined?(@requires_sudo_ran)
- if settings.allow_sudo?
- sudo_present = which "sudo"
- end
+ sudo_present = which "sudo" if settings.allow_sudo?
if sudo_present
# the bundle path and subdirectories need to be writable for Rubygems
@@ -412,7 +410,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/cli.rb b/lib/bundler/cli.rb
index 55bf274596..5f06fea6e7 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -4,7 +4,7 @@ require "bundler/vendored_thor"
module Bundler
class CLI < Thor
include Thor::Actions
- AUTO_INSTALL_CMDS = %w[show binstubs outdated exec open console licenses clean]
+ AUTO_INSTALL_CMDS = %w(show binstubs outdated exec open console licenses clean)
def self.start(*)
super
diff --git a/lib/bundler/cli/common.rb b/lib/bundler/cli/common.rb
index 53b30d2045..b90544ba3a 100644
--- a/lib/bundler/cli/common.rb
+++ b/lib/bundler/cli/common.rb
@@ -51,6 +51,5 @@ module Bundler
message += "\nDid you mean #{suggestions}?" if suggestions
message
end
-
end
end
diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb
index 7d71ac8c44..5a7e92d535 100644
--- a/lib/bundler/cli/gem.rb
+++ b/lib/bundler/cli/gem.rb
@@ -61,10 +61,10 @@ module Bundler
"bin/setup.tt" => "bin/setup"
}
- executables = %w[
+ executables = %w(
bin/console
bin/setup
- ]
+ )
if test_framework = ask_and_set_test_framework
config[:test] = test_framework
diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb
index 256ae0a7d2..df3472d70a 100644
--- a/lib/bundler/cli/install.rb
+++ b/lib/bundler/cli/install.rb
@@ -69,9 +69,7 @@ module Bundler
"before deploying."
end
- if Bundler.app_cache.exist?
- options[:local] = true
- end
+ options[:local] = true if Bundler.app_cache.exist?
Bundler.settings[:frozen] = "1"
end
diff --git a/lib/bundler/cli/outdated.rb b/lib/bundler/cli/outdated.rb
index 4c777df6e6..5381314552 100644
--- a/lib/bundler/cli/outdated.rb
+++ b/lib/bundler/cli/outdated.rb
@@ -62,7 +62,7 @@ module Bundler
spec_version = "#{active_spec.version}#{active_spec.git_version}"
current_version = "#{current_spec.version}#{current_spec.git_version}"
- dependency_version = %|, requested #{dependency.requirement}| if dependency && dependency.specific?
+ dependency_version = %(, requested #{dependency.requirement}) if dependency && dependency.specific?
if dependency
groups = dependency.groups.join(", ")
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 1de65df695..7acd78ea0b 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -19,9 +19,7 @@ module Bundler
unlock ||= {}
gemfile = Pathname.new(gemfile).expand_path
- unless gemfile.file?
- raise GemfileNotFound, "#{gemfile} not found"
- end
+ raise GemfileNotFound, "#{gemfile} not found" unless gemfile.file?
Dsl.evaluate(gemfile, lockfile, unlock)
end
@@ -355,9 +353,7 @@ module Bundler
new_deps = @dependencies - @locked_deps
deleted_deps = @locked_deps - @dependencies
- if new_deps.any?
- added.concat new_deps.map {|d| "* #{pretty_dep(d)}" }
- end
+ added.concat new_deps.map {|d| "* #{pretty_dep(d)}" } if new_deps.any?
if deleted_deps.any?
deleted.concat deleted_deps.map {|d| "* #{pretty_dep(d)}" }
@@ -368,11 +364,10 @@ module Bundler
@locked_deps.each {|d| both_sources[d.name][1] = d.source }
both_sources.each do |name, (dep, lock_source)|
- if (dep.nil? && !lock_source.nil?) || (!dep.nil? && !lock_source.nil? && !lock_source.can_lock?(dep))
- gemfile_source_name = (dep && dep.source) || "no specified source"
- lockfile_source_name = lock_source || "no specified source"
- changed << "* #{name} from `#{gemfile_source_name}` to `#{lockfile_source_name}`"
- end
+ next unless (dep.nil? && !lock_source.nil?) || (!dep.nil? && !lock_source.nil? && !lock_source.can_lock?(dep))
+ gemfile_source_name = (dep && dep.source) || "no specified source"
+ lockfile_source_name = lock_source || "no specified source"
+ changed << "* #{name} from `#{gemfile_source_name}` to `#{lockfile_source_name}`"
end
msg << "\n\nYou have added to the Gemfile:\n" << added.join("\n") if added.any?
@@ -390,18 +385,18 @@ module Bundler
problem, expected, actual = diff
msg = case problem
- when :engine
- "Your Ruby engine is #{actual}, but your Gemfile specified #{expected}"
- when :version
- "Your Ruby version is #{actual}, but your Gemfile specified #{expected}"
- when :engine_version
- "Your #{Bundler.ruby_version.engine} version is #{actual}, but your Gemfile specified #{ruby_version.engine} #{expected}"
- when :patchlevel
- if !expected.is_a?(String)
- "The Ruby patchlevel in your Gemfile must be a string"
- else
- "Your Ruby patchlevel is #{actual}, but your Gemfile specified #{expected}"
- end
+ when :engine
+ "Your Ruby engine is #{actual}, but your Gemfile specified #{expected}"
+ when :version
+ "Your Ruby version is #{actual}, but your Gemfile specified #{expected}"
+ when :engine_version
+ "Your #{Bundler.ruby_version.engine} version is #{actual}, but your Gemfile specified #{ruby_version.engine} #{expected}"
+ when :patchlevel
+ if !expected.is_a?(String)
+ "The Ruby patchlevel in your Gemfile must be a string"
+ else
+ "Your Ruby patchlevel is #{actual}, but your Gemfile specified #{expected}"
+ end
end
raise RubyVersionMismatch, msg
@@ -513,9 +508,7 @@ module Bundler
def converge_dependencies
(@dependencies + @locked_deps).each do |dep|
- if dep.source
- dep.source = sources.get(dep.source)
- end
+ dep.source = sources.get(dep.source) if dep.source
end
Set.new(@dependencies) != Set.new(@locked_deps)
end
@@ -661,7 +654,7 @@ module Bundler
end
def requested_groups
- self.groups - Bundler.settings.without - @optional_groups + Bundler.settings.with
+ groups - Bundler.settings.without - @optional_groups + Bundler.settings.with
end
def lockfiles_equal?(current, proposed, preserve_bundled_with)
diff --git a/lib/bundler/dependency.rb b/lib/bundler/dependency.rb
index f3e640b676..a62808d23c 100644
--- a/lib/bundler/dependency.rb
+++ b/lib/bundler/dependency.rb
@@ -74,9 +74,7 @@ module Bundler
@env = options["env"]
@should_include = options.fetch("should_include", true)
- if options.key?("require")
- @autorequire = Array(options["require"] || [])
- end
+ @autorequire = Array(options["require"] || []) if options.key?("require")
end
def gem_platforms(valid_platforms)
@@ -108,9 +106,9 @@ module Bundler
def current_platform?
return true if @platforms.empty?
- @platforms.any? { |p|
+ @platforms.any? do |p|
Bundler.current_ruby.send("#{p}?")
- }
+ end
end
def to_lock
diff --git a/lib/bundler/deprecate.rb b/lib/bundler/deprecate.rb
index d9f6b494e7..02eb4b0918 100644
--- a/lib/bundler/deprecate.rb
+++ b/lib/bundler/deprecate.rb
@@ -1,5 +1,4 @@
module Bundler
-
if defined? ::Deprecate
Deprecate = ::Deprecate
elsif defined? Gem::Deprecate
@@ -13,5 +12,4 @@ module Bundler
yield
end
end
-
end
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index 041a55ebd1..4755fe0609 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -205,7 +205,8 @@ module Bundler
alias_method :platform, :platforms
def env(name)
- @env, old = name, @env
+ old = @env
+ @env = name
yield
ensure
@env = old
@@ -256,10 +257,10 @@ module Bundler
def normalize_options(name, version, opts)
if name.is_a?(Symbol)
- raise GemfileError, %{You need to specify gem names as Strings. Use 'gem "#{name}"' instead}
+ raise GemfileError, %(You need to specify gem names as Strings. Use 'gem "#{name}"' instead)
end
if name =~ /\s/
- raise GemfileError, %{'#{name}' is not a valid gem name because it contains whitespace}
+ raise GemfileError, %('#{name}' is not a valid gem name because it contains whitespace)
end
normalize_hash(opts)
@@ -298,16 +299,15 @@ module Bundler
opts["git"] = @git_sources[git_name].call(opts[git_name])
end
- %w[git path].each do |type|
- if param = opts[type]
- if version.first && version.first =~ /^\s*=?\s*(\d[^\s]*)\s*$/
- options = opts.merge("name" => name, "version" => $1)
- else
- options = opts.dup
- end
- source = send(type, param, options) {}
- opts["source"] = source
+ %w(git path).each do |type|
+ next unless param = opts[type]
+ if version.first && version.first =~ /^\s*=?\s*(\d[^\s]*)\s*$/
+ options = opts.merge("name" => name, "version" => $1)
+ else
+ options = opts.dup
end
+ source = send(type, param, options) {}
+ opts["source"] = source
end
opts["source"] ||= @source
@@ -474,5 +474,4 @@ module Bundler
end
end
end
-
end
diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb
index 4ebbe7acf8..4b79a7d883 100644
--- a/lib/bundler/fetcher.rb
+++ b/lib/bundler/fetcher.rb
@@ -4,7 +4,6 @@ require "securerandom"
require "zlib"
module Bundler
-
# Handles all the fetching with the rubygems server
class Fetcher
autoload :Downloader, "bundler/fetcher/downloader"
@@ -106,9 +105,7 @@ module Bundler
specs = {}
fetchers.dup.each do |f|
- unless f.api_fetcher? && !gem_names
- break if specs = f.specs(gem_names)
- end
+ break unless f.api_fetcher? && !gem_names || !specs = f.specs(gem_names)
fetchers.delete(f)
end
@use_api = false if fetchers.none?(&:api_fetcher?)
@@ -157,7 +154,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
@@ -183,8 +184,6 @@ module Bundler
def http_proxy
if uri = connection.proxy_uri
uri.to_s
- else
- nil
end
end
diff --git a/lib/bundler/friendly_errors.rb b/lib/bundler/friendly_errors.rb
index f6f8fd5623..eb15f48071 100644
--- a/lib/bundler/friendly_errors.rb
+++ b/lib/bundler/friendly_errors.rb
@@ -92,5 +92,4 @@ module Bundler
"https://github.com/bundler/bundler/search?q=" \
"#{CGI.escape(exception.message.lines.first.chomp)}&type=Issues"
end
-
end
diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb
index 70dded01ba..d468194538 100644
--- a/lib/bundler/gem_helper.rb
+++ b/lib/bundler/gem_helper.rb
@@ -72,12 +72,12 @@ module Bundler
def build_gem
file_name = nil
- sh("gem build -V '#{spec_path}'") {
+ sh("gem build -V '#{spec_path}'") do
file_name = File.basename(built_gem_path)
SharedHelpers.filesystem_access(File.join(base, "pkg")) {|p| FileUtils.mkdir_p(p) }
FileUtils.mv(built_gem_path, "pkg")
Bundler.ui.confirm "#{name} #{version} built to pkg/#{file_name}."
- }
+ end
File.join(base, "pkg", file_name)
end
@@ -129,7 +129,7 @@ module Bundler
end
def guard_clean
- clean? && committed? or raise("There are files that need to be committed first.")
+ clean? && committed? || raise("There are files that need to be committed first.")
end
def clean?
@@ -175,17 +175,15 @@ module Bundler
cmd << " 2>&1"
outbuf = ""
Bundler.ui.debug(cmd)
- SharedHelpers.chdir(base) {
+ SharedHelpers.chdir(base) do
outbuf = `#{cmd}`
- if $? == 0
- block.call(outbuf) if block
- end
- }
+ block.call(outbuf) if $? == 0 && block
+ end
[outbuf, $?]
end
def gem_push?
- ! %w{n no nil false off 0}.include?(ENV["gem_push"].to_s.downcase)
+ ! %w(n no nil false off 0).include?(ENV["gem_push"].to_s.downcase)
end
end
end
diff --git a/lib/bundler/gem_helpers.rb b/lib/bundler/gem_helpers.rb
index fc1a341574..ac83e6fb92 100644
--- a/lib/bundler/gem_helpers.rb
+++ b/lib/bundler/gem_helpers.rb
@@ -1,6 +1,5 @@
module Bundler
module GemHelpers
-
GENERIC_CACHE = {}
GENERICS = [
[Gem::Platform.new("java"), Gem::Platform.new("java")],
diff --git a/lib/bundler/graph.rb b/lib/bundler/graph.rb
index cf5913ec70..414ec712fa 100644
--- a/lib/bundler/graph.rb
+++ b/lib/bundler/graph.rb
@@ -96,15 +96,15 @@ module Bundler
# redefinition of matching_specs will also redefine to_spec and to_specs
Gem::Dependency.class_eval do
def matching_specs(platform_only = false)
- matches = Bundler.load.specs.select { |spec|
- self.name == spec.name and
- requirement.satisfied_by? spec.version
- }
+ matches = Bundler.load.specs.select do |spec|
+ name == spec.name &&
+ requirement.satisfied_by?(spec.version)
+ end
if platform_only
- matches.select! { |spec|
+ matches.select! do |spec|
Gem::Platform.match spec.platform
- }
+ end
end
matches = matches.sort_by(&:sort_obj) # HACK: shouldn't be needed
diff --git a/lib/bundler/injector.rb b/lib/bundler/injector.rb
index 04096c3f11..ef98fad888 100644
--- a/lib/bundler/injector.rb
+++ b/lib/bundler/injector.rb
@@ -47,7 +47,7 @@ module Bundler
def new_gem_lines
@new_deps.map do |d|
- %|gem '#{d.name}', '#{d.requirement}'|
+ %(gem '#{d.name}', '#{d.requirement}')
end.join("\n")
end
diff --git a/lib/bundler/installer/standalone.rb b/lib/bundler/installer/standalone.rb
index 6776dd6200..35ad98891e 100644
--- a/lib/bundler/installer/standalone.rb
+++ b/lib/bundler/installer/standalone.rb
@@ -15,7 +15,7 @@ module Bundler
file.puts "ruby_version = RbConfig::CONFIG[\"ruby_version\"]"
file.puts "path = File.expand_path('..', __FILE__)"
paths.each do |path|
- file.puts %{$:.unshift "\#{path}/#{path}"}
+ file.puts %($:.unshift "\#{path}/#{path}")
end
end
end
diff --git a/lib/bundler/lazy_specification.rb b/lib/bundler/lazy_specification.rb
index f0efbc448f..8d4a114ede 100644
--- a/lib/bundler/lazy_specification.rb
+++ b/lib/bundler/lazy_specification.rb
@@ -19,7 +19,7 @@ module Bundler
end
def full_name
- if platform == Gem::Platform::RUBY or platform.nil?
+ if platform == Gem::Platform::RUBY || platform.nil?
"#{@name}-#{@version}"
else
"#{@name}-#{@version}-#{platform}"
@@ -35,7 +35,7 @@ module Bundler
end
def to_lock
- if platform == Gem::Platform::RUBY or platform.nil?
+ if platform == Gem::Platform::RUBY || platform.nil?
out = " #{name} (#{version})\n"
else
out = " #{name} (#{version}-#{platform})\n"
diff --git a/lib/bundler/lockfile_parser.rb b/lib/bundler/lockfile_parser.rb
index 5fa1f5aae0..497fbcb133 100644
--- a/lib/bundler/lockfile_parser.rb
+++ b/lib/bundler/lockfile_parser.rb
@@ -184,9 +184,7 @@ module Bundler
end
def parse_platform(line)
- if line =~ /^ (.*)$/
- @platforms << Gem::Platform.new($1)
- end
+ @platforms << Gem::Platform.new($1) if line =~ /^ (.*)$/
end
def parse_bundled_with(line)
diff --git a/lib/bundler/match_platform.rb b/lib/bundler/match_platform.rb
index 1dda3cadc1..f4b9492c25 100644
--- a/lib/bundler/match_platform.rb
+++ b/lib/bundler/match_platform.rb
@@ -5,9 +5,9 @@ module Bundler
include GemHelpers
def match_platform(p)
- Gem::Platform::RUBY == platform or
- platform.nil? or p == platform or
- generic(Gem::Platform.new(platform)) === p
+ Gem::Platform::RUBY == platform ||
+ platform.nil? || p == platform ||
+ generic(Gem::Platform.new(platform)) === p
end
end
end
diff --git a/lib/bundler/remote_specification.rb b/lib/bundler/remote_specification.rb
index 3050c37371..c8247c4c95 100644
--- a/lib/bundler/remote_specification.rb
+++ b/lib/bundler/remote_specification.rb
@@ -27,7 +27,7 @@ module Bundler
end
def full_name
- if platform == Gem::Platform::RUBY or platform.nil?
+ if platform == Gem::Platform::RUBY || platform.nil?
"#{@name}-#{@version}"
else
"#{@name}-#{@version}-#{platform}"
diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb
index 527962d134..edced0077f 100644
--- a/lib/bundler/resolver.rb
+++ b/lib/bundler/resolver.rb
@@ -94,14 +94,13 @@ module Bundler
specs = {}
@activated.each do |p|
- if s = @specs[p]
- platform = generic(Gem::Platform.new(s.platform))
- next if specs[platform]
+ next unless s = @specs[p]
+ platform = generic(Gem::Platform.new(s.platform))
+ next if specs[platform]
- lazy_spec = LazySpecification.new(name, version, platform, source)
- lazy_spec.dependencies.replace s.dependencies
- specs[platform] = lazy_spec
- end
+ lazy_spec = LazySpecification.new(name, version, platform, source)
+ lazy_spec.dependencies.replace s.dependencies
+ specs[platform] = lazy_spec
end
specs.values
end
@@ -156,12 +155,11 @@ module Bundler
@dependencies ||= begin
dependencies = {}
ALL.each do |p|
- if spec = @specs[p]
- dependencies[p] = []
- spec.dependencies.each do |dep|
- next if dep.type == :development
- dependencies[p] << DepProxy.new(dep, p)
- end
+ next unless spec = @specs[p]
+ dependencies[p] = []
+ spec.dependencies.each do |dep|
+ next if dep.type == :development
+ dependencies[p] << DepProxy.new(dep, p)
end
end
dependencies
@@ -282,11 +280,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)
@@ -308,7 +310,7 @@ module Bundler
def amount_constrained(dependency)
@amount_constrained ||= {}
@amount_constrained[dependency.name] ||= begin
- if base = @base[dependency.name] and !base.empty?
+ if (base = @base[dependency.name]) && !base.empty?
dependency.requirement.satisfied_by?(base.first.version) ? 0 : 1
else
base_dep = Dependency.new dependency.name, ">= 0.a"
@@ -327,30 +329,29 @@ module Bundler
def verify_gemfile_dependencies_are_found!(requirements)
requirements.each do |requirement|
next if requirement.name == "bundler"
- if search_for(requirement).empty?
- if base = @base[requirement.name] and !base.empty?
- version = base.first.version
- message = "You have requested:\n" \
- " #{requirement.name} #{requirement.requirement}\n\n" \
- "The bundle currently has #{requirement.name} locked at #{version}.\n" \
- "Try running `bundle update #{requirement.name}`\n\n" \
- "If you are updating multiple gems in your Gemfile at once,\n" \
- "try passing them all to `bundle update`"
- elsif requirement.source
- name = requirement.name
- versions = @source_requirements[name][name].map(&:version)
- message = "Could not find gem '#{requirement}' in #{requirement.source}.\n"
- if versions.any?
- message << "Source contains '#{name}' at: #{versions.join(", ")}"
- else
- message << "Source does not contain any versions of '#{requirement}'"
- end
+ next unless search_for(requirement).empty?
+ if (base = @base[requirement.name]) && !base.empty?
+ version = base.first.version
+ message = "You have requested:\n" \
+ " #{requirement.name} #{requirement.requirement}\n\n" \
+ "The bundle currently has #{requirement.name} locked at #{version}.\n" \
+ "Try running `bundle update #{requirement.name}`\n\n" \
+ "If you are updating multiple gems in your Gemfile at once,\n" \
+ "try passing them all to `bundle update`"
+ elsif requirement.source
+ name = requirement.name
+ versions = @source_requirements[name][name].map(&:version)
+ message = "Could not find gem '#{requirement}' in #{requirement.source}.\n"
+ if versions.any?
+ message << "Source contains '#{name}' at: #{versions.join(", ")}"
else
- message = "Could not find gem '#{requirement}' in any of the gem sources " \
- "listed in your Gemfile or available on this machine."
+ message << "Source does not contain any versions of '#{requirement}'"
end
- raise GemNotFound, message
+ else
+ message = "Could not find gem '#{requirement}' in any of the gem sources " \
+ "listed in your Gemfile or available on this machine."
end
+ raise GemNotFound, message
end
end
end
diff --git a/lib/bundler/ruby_version.rb b/lib/bundler/ruby_version.rb
index 138262e3db..34268c79f2 100644
--- a/lib/bundler/ruby_version.rb
+++ b/lib/bundler/ruby_version.rb
@@ -53,8 +53,6 @@ module Bundler
[:engine_version, engine_version, other.engine_version]
elsif patchlevel != other.patchlevel && @patchlevel
[:patchlevel, patchlevel, other.patchlevel]
- else
- nil
end
end
diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb
index 9e4ce5ac17..33f6308014 100644
--- a/lib/bundler/rubygems_ext.rb
+++ b/lib/bundler/rubygems_ext.rb
@@ -99,9 +99,9 @@ module Gem
gemfile << "group :#{group} do\n" if group
dependencies.each do |dependency|
gemfile << " " if group
- gemfile << %|gem "#{dependency.name}"|
+ gemfile << %(gem "#{dependency.name}")
req = dependency.requirements_list.first
- gemfile << %|, "#{req}"| if req
+ gemfile << %(, "#{req}") if req
gemfile << "\n"
end
gemfile << "end\n" if group
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index 3f375dff8c..96b9101610 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -135,7 +135,7 @@ module Bundler
end
def repository_subdirectories
- %w[cache doc gems specifications]
+ %w(cache doc gems specifications)
end
def clear_paths
@@ -203,7 +203,7 @@ module Bundler
def with_build_args(args)
ext_lock.synchronize do
- old_args = self.build_args
+ old_args = build_args
begin
self.build_args = args
yield
@@ -251,7 +251,7 @@ module Bundler
end
def security_policy_keys
- %w{High Medium Low AlmostNo No}.map {|level| "#{level}Security" }
+ %w(High Medium Low AlmostNo No).map {|level| "#{level}Security" }
end
def security_policies
@@ -282,7 +282,7 @@ module Bundler
::Kernel.send(:define_method, :gem) do |dep, *reqs|
if executables.include? File.basename(caller.first.split(":").first)
- return
+ break
end
reqs.pop if reqs.last.is_a?(Hash)
@@ -346,15 +346,13 @@ module Bundler
redefine_method(gem_class, :bin_path) do |name, *args|
exec_name = args.first
- if exec_name == "bundle"
- return ENV["BUNDLE_BIN_PATH"]
- end
+ return ENV["BUNDLE_BIN_PATH"] if exec_name == "bundle"
spec = nil
if exec_name
spec = specs.find {|s| s.executables.include?(exec_name) }
- spec or raise Gem::Exception, "can't find executable #{exec_name}"
+ raise(Gem::Exception, "can't find executable #{exec_name}") unless spec
unless spec.name == name
warn "Bundler is using a binstub that was created for a different gem.\n" \
"This is deprecated, in future versions you may need to `bundle binstub #{name}` " \
@@ -362,7 +360,7 @@ module Bundler
end
else
spec = specs.find {|s| s.name == name }
- exec_name = spec.default_executable or raise Gem::Exception, "no default executable for #{spec.full_name}"
+ raise Gem::Exception, "no default executable for #{spec.full_name}" unless exec_name = spec.default_executable
end
gem_bin = File.join(spec.full_gem_path, spec.bindir, exec_name)
@@ -511,9 +509,9 @@ module Bundler
def stub_rubygems(specs)
Gem::Specification.all = specs
- Gem.post_reset {
+ Gem.post_reset do
Gem::Specification.all = specs
- }
+ end
stub_source_index(specs)
end
@@ -647,9 +645,7 @@ module Bundler
const_set(:CHDIR_MONITOR, EXT_LOCK)
end
- if const_defined?(:CHDIR_MUTEX)
- remove_const(:CHDIR_MUTEX)
- end
+ remove_const(:CHDIR_MUTEX) if const_defined?(:CHDIR_MUTEX)
const_set(:CHDIR_MUTEX, const_get(:CHDIR_MONITOR))
end
end
diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb
index 179ce53ec4..63e345b04b 100644
--- a/lib/bundler/runtime.rb
+++ b/lib/bundler/runtime.rb
@@ -21,7 +21,7 @@ module Bundler
raise GemNotFound, "#{spec.full_name} is missing. Run `bundle` to get it."
end
- if activated_spec = Bundler.rubygems.loaded_specs(spec.name) and activated_spec.version != spec.version
+ if (activated_spec = Bundler.rubygems.loaded_specs(spec.name)) && activated_spec.version != spec.version
e = Gem::LoadError.new "You have already activated #{activated_spec.name} #{activated_spec.version}, " \
"but your Gemfile requires #{spec.name} #{spec.version}. Prepending " \
"`bundle exec` to your command may solve this."
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index c859a7677b..1ca41e2e71 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -29,7 +29,7 @@ module Bundler
end
def []=(key, value)
- local_config_file or raise GemfileNotFound, "Could not locate Gemfile"
+ local_config_file || raise(GemfileNotFound, "Could not locate Gemfile")
set_key(key, value, @local_config, local_config_file)
end
@@ -56,9 +56,7 @@ module Bundler
def local_overrides
repos = {}
all.each do |k|
- if k =~ /^local\./
- repos[$'] = self[k]
- end
+ repos[$'] = self[k] if k =~ /^local\./
end
repos
end
@@ -163,9 +161,7 @@ module Bundler
private
def key_for(key)
- if key.is_a?(String) && /https?:/ =~ key
- key = normalize_uri(key).to_s
- end
+ key = normalize_uri(key).to_s if key.is_a?(String) && /https?:/ =~ key
key = key.to_s.gsub(".", "__").upcase
"BUNDLE_#{key}"
end
@@ -243,7 +239,7 @@ module Bundler
end
def convert_to_backward_compatible_key(key)
- key = "#{key}/" if key =~ /https?:/i && key !~ %r[/\Z]
+ key = "#{key}/" if key =~ /https?:/i && key !~ %r{/\Z}
key = key.gsub(".", "__") if key.include?(".")
key
end
@@ -252,7 +248,7 @@ module Bundler
# TODO: is this the correct place to validate mirror URIs?
def normalize_uri(uri)
uri = uri.to_s
- uri = "#{uri}/" unless uri =~ %r[/\Z]
+ uri = "#{uri}/" unless uri =~ %r{/\Z}
uri = URI(uri)
unless uri.absolute?
raise ArgumentError, "Gem sources must be absolute. You provided '#{uri}'."
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb
index 19e75186dd..2e512bfc74 100644
--- a/lib/bundler/shared_helpers.rb
+++ b/lib/bundler/shared_helpers.rb
@@ -61,7 +61,7 @@ module Bundler
end
def with_clean_git_env(&block)
- keys = %w[GIT_DIR GIT_WORK_TREE]
+ keys = %w(GIT_DIR GIT_WORK_TREE)
old_env = keys.inject({}) do |h, k|
h.update(k => ENV[k])
end
@@ -82,7 +82,7 @@ module Bundler
# Set RUBYOPT
rubyopt = [ENV["RUBYOPT"]].compact
if rubyopt.empty? || rubyopt.first !~ %r{-rbundler/setup}
- rubyopt.unshift %|-rbundler/setup|
+ rubyopt.unshift %(-rbundler/setup)
ENV["RUBYOPT"] = rubyopt.join(" ")
end
@@ -126,9 +126,9 @@ module Bundler
end
def find_file(*names)
- search_up(*names) {|filename|
+ search_up(*names) do |filename|
return filename if File.file?(filename)
- }
+ end
end
def find_directory(*names)
@@ -151,7 +151,8 @@ module Bundler
filename = File.join(current, name)
yield filename
end
- current, previous = File.expand_path("..", current), current
+ previous = current
+ current = File.expand_path("..", current)
end
end
diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb
index 3a75299ff8..b11de1e4bc 100644
--- a/lib/bundler/source/git.rb
+++ b/lib/bundler/source/git.rb
@@ -147,9 +147,7 @@ module Bundler
# TODO: actually cache git specs
def specs(*)
- if has_app_cache? && !local?
- set_local!(app_cache_path)
- end
+ set_local!(app_cache_path) if has_app_cache? && !local?
if requires_checkout? && !@copied
git_proxy.checkout
diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb
index 40e3d205ae..b8900888a9 100644
--- a/lib/bundler/source/git/git_proxy.rb
+++ b/lib/bundler/source/git/git_proxy.rb
@@ -72,14 +72,14 @@ module Bundler
return if has_revision_cached?
Bundler.ui.info "Fetching #{uri}"
in_path do
- git_retry %|fetch --force --quiet --tags #{uri_escaped_with_configured_credentials} "refs/heads/*:refs/heads/*"|
+ git_retry %(fetch --force --quiet --tags #{uri_escaped_with_configured_credentials} "refs/heads/*:refs/heads/*")
end
else
Bundler.ui.info "Fetching #{uri}"
SharedHelpers.filesystem_access(path.dirname) do |p|
FileUtils.mkdir_p(p)
end
- git_retry %|clone #{uri_escaped_with_configured_credentials} "#{path}" --bare --no-hardlinks --quiet|
+ git_retry %(clone #{uri_escaped_with_configured_credentials} "#{path}" --bare --no-hardlinks --quiet)
end
end
@@ -93,7 +93,7 @@ module Bundler
SharedHelpers.filesystem_access(destination) do |p|
FileUtils.rm_rf(p)
end
- git_retry %|clone --no-checkout --quiet "#{path}" "#{destination}"|
+ git_retry %(clone --no-checkout --quiet "#{path}" "#{destination}")
File.chmod(((File.stat(destination).mode | 0777) & ~File.umask), destination)
rescue Errno::EEXIST => e
file_path = e.message[%r{.*?(/.*)}, 1]
@@ -104,12 +104,10 @@ module Bundler
end
# method 2
SharedHelpers.chdir(destination) do
- git_retry %|fetch --force --quiet --tags "#{path}"|
+ git_retry %(fetch --force --quiet --tags "#{path}")
git "reset --hard #{@revision}"
- if submodules
- git_retry "submodule update --init --recursive"
- end
+ git_retry "submodule update --init --recursive" if submodules
end
end
diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb
index 292412044c..4192015cb7 100644
--- a/lib/bundler/source/path.rb
+++ b/lib/bundler/source/path.rb
@@ -132,11 +132,10 @@ module Bundler
if File.directory?(expanded_path)
# We sort depth-first since `<<` will override the earlier-found specs
Dir["#{expanded_path}/#{@glob}"].sort_by {|p| -p.split(File::SEPARATOR).size }.each do |file|
- if spec = Bundler.load_gemspec(file, :validate)
- spec.loaded_from = file.to_s
- spec.source = self
- index << spec
- end
+ next unless spec = Bundler.load_gemspec(file, :validate)
+ spec.loaded_from = file.to_s
+ spec.source = self
+ index << spec
end
if index.empty? && @name && @version
@@ -212,11 +211,10 @@ module Bundler
return unless Gem.respond_to?(hooks_meth)
Gem.send(hooks_meth).each do |hook|
result = hook.call(installer)
- if result == false
- location = " at #{$1}" if hook.inspect =~ /@(.*:\d+)/
- message = "#{type} hook#{location} failed for #{installer.spec.full_name}"
- raise InstallHookError, message
- end
+ next unless result == false
+ location = " at #{$1}" if hook.inspect =~ /@(.*:\d+)/
+ message = "#{type} hook#{location} failed for #{installer.spec.full_name}"
+ raise InstallHookError, message
end
end
end
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
index b42cdc3eef..1f45888421 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -68,7 +68,7 @@ module Bundler
end
def to_s
- remote_names = self.remotes.map(&:to_s).join(", ")
+ remote_names = remotes.map(&:to_s).join(", ")
"rubygems repository #{remote_names}"
end
alias_method :name, :to_s
@@ -264,7 +264,7 @@ module Bundler
def normalize_uri(uri)
uri = uri.to_s
- uri = "#{uri}/" unless uri =~ %r'/$'
+ uri = "#{uri}/" unless uri =~ %r{/$}
uri = URI(uri)
raise ArgumentError, "The source must be an absolute URI. For example:\n" \
"source 'https://rubygems.org'" if !uri.absolute? || (uri.is_a?(URI::HTTP) && uri.host.nil?)
diff --git a/lib/bundler/ui/shell.rb b/lib/bundler/ui/shell.rb
index 65460f2fdb..2c0076dc06 100644
--- a/lib/bundler/ui/shell.rb
+++ b/lib/bundler/ui/shell.rb
@@ -75,7 +75,8 @@ module Bundler
end
def silence
- old_level, @level = @level, "silent"
+ old_level = @level
+ @level = "silent"
yield
ensure
@level = old_level
diff --git a/spec/bundler/bundler_spec.rb b/spec/bundler/bundler_spec.rb
index 1cdfc6d30f..1b0addadb5 100644
--- a/spec/bundler/bundler_spec.rb
+++ b/spec/bundler/bundler_spec.rb
@@ -24,7 +24,8 @@ describe Bundler do
context "on Rubies with a settable YAML engine", :if => defined?(YAML::ENGINE) do
context "with Syck as YAML::Engine" do
it "raises a GemspecError after YAML load throws ArgumentError" do
- orig_yamler, YAML::ENGINE.yamler = YAML::ENGINE.yamler, "syck"
+ orig_yamler = YAML::ENGINE.yamler
+ YAML::ENGINE.yamler = "syck"
expect { subject }.to raise_error(Bundler::GemspecError)
@@ -34,7 +35,8 @@ describe Bundler do
context "with Psych as YAML::Engine" do
it "raises a GemspecError after YAML load throws Psych::SyntaxError" do
- orig_yamler, YAML::ENGINE.yamler = YAML::ENGINE.yamler, "psych"
+ orig_yamler = YAML::ENGINE.yamler
+ YAML::ENGINE.yamler = "psych"
expect { subject }.to raise_error(Bundler::GemspecError)
@@ -48,8 +50,10 @@ describe Bundler do
it "can load a gemspec with unicode characters with default ruby encoding" do
# spec_helper forces the external encoding to UTF-8 but that's not the
# default until Ruby 2.0
- verbose, $VERBOSE = $VERBOSE, false
- encoding, Encoding.default_external = Encoding.default_external, "ASCII"
+ verbose = $VERBOSE
+ $VERBOSE = false
+ encoding = Encoding.default_external
+ Encoding.default_external = "ASCII"
$VERBOSE = verbose
File.open(app_gemspec_path, "wb") do |file|
@@ -63,7 +67,8 @@ describe Bundler do
expect(subject.author).to eq("André the Giant")
- verbose, $VERBOSE = $VERBOSE, false
+ verbose = $VERBOSE
+ $VERBOSE = false
Encoding.default_external = encoding
$VERBOSE = verbose
end
diff --git a/spec/bundler/dsl_spec.rb b/spec/bundler/dsl_spec.rb
index 2397055826..714fcaa919 100644
--- a/spec/bundler/dsl_spec.rb
+++ b/spec/bundler/dsl_spec.rb
@@ -16,9 +16,9 @@ describe Bundler::Dsl do
end
it "raises exception on invalid hostname" do
- expect {
+ expect do
subject.git_source(:group) {|repo_name| "git@git.example.com:#{repo_name}.git" }
- }.to raise_error(Bundler::InvalidOption)
+ end.to raise_error(Bundler::InvalidOption)
end
it "expects block passed" do
@@ -186,7 +186,7 @@ describe Bundler::Dsl do
# end
describe "#git" do
it "from a single repo" do
- rails_gems = %w[railties action_pack active_model]
+ rails_gems = %w(railties action_pack active_model)
subject.git "https://github.com/rails/rails.git" do
rails_gems.each {|rails_gem| subject.send :gem, rails_gem }
end
@@ -201,7 +201,7 @@ describe Bundler::Dsl do
# end
describe "#github" do
it "from github" do
- spree_gems = %w[spree_core spree_api spree_backend]
+ spree_gems = %w(spree_core spree_api spree_backend)
subject.github "spree" do
spree_gems.each {|spree_gem| subject.send :gem, spree_gem }
end
diff --git a/spec/bundler/fetcher/index_spec.rb b/spec/bundler/fetcher/index_spec.rb
index 095cb0dbac..92cad4b6c6 100644
--- a/spec/bundler/fetcher/index_spec.rb
+++ b/spec/bundler/fetcher/index_spec.rb
@@ -9,8 +9,8 @@ describe Bundler::Fetcher::Index do
allow(Bundler).to receive(:rubygems).and_return(rubygems)
allow(Bundler).to receive(:ui).and_return(double(:trace => nil))
- expect {
- Bundler::Fetcher::Index.new(nil, nil, nil).specs(%w[foo bar])
- }.to raise_error(Bundler::HTTPError)
+ expect do
+ Bundler::Fetcher::Index.new(nil, nil, nil).specs(%w(foo bar))
+ end.to raise_error(Bundler::HTTPError)
end
end
diff --git a/spec/bundler/fetcher_spec.rb b/spec/bundler/fetcher_spec.rb
index e21601555d..f1204e7b47 100644
--- a/spec/bundler/fetcher_spec.rb
+++ b/spec/bundler/fetcher_spec.rb
@@ -66,7 +66,7 @@ describe Bundler::Fetcher do
describe "#user_agent" do
it "builds user_agent with current ruby version and Bundler settings" do
- allow(Bundler.settings).to receive(:all).and_return(%w[foo bar])
+ allow(Bundler.settings).to receive(:all).and_return(%w(foo bar))
expect(fetcher.user_agent).to match(%r{bundler/(\d.)})
expect(fetcher.user_agent).to match(%r{rubygems/(\d.)})
expect(fetcher.user_agent).to match(%r{ruby/(\d.)})
diff --git a/spec/bundler/friendly_errors_spec.rb b/spec/bundler/friendly_errors_spec.rb
index cac83aa6f5..83651dfdf7 100644
--- a/spec/bundler/friendly_errors_spec.rb
+++ b/spec/bundler/friendly_errors_spec.rb
@@ -43,11 +43,11 @@ describe Bundler, "friendly errors" do
end
it "rescues Thor::AmbiguousTaskError and raises SystemExit" do
- expect {
+ expect do
Bundler.with_friendly_errors do
raise Thor::AmbiguousTaskError.new("")
end
- }.to raise_error(SystemExit)
+ end.to raise_error(SystemExit)
end
describe "#issues_url" do
diff --git a/spec/bundler/gem_helper_spec.rb b/spec/bundler/gem_helper_spec.rb
index 3444fe622f..ae15678268 100644
--- a/spec/bundler/gem_helper_spec.rb
+++ b/spec/bundler/gem_helper_spec.rb
@@ -103,10 +103,10 @@ describe Bundler::GemHelper do
end
context "defines Rake tasks" do
- let(:task_names) {
- %w[build install release release:guard_clean
- release:source_control_push release:rubygem_push]
- }
+ let(:task_names) do
+ %w(build install release release:guard_clean
+ release:source_control_push release:rubygem_push)
+ end
context "before installation" do
it "raises an error with appropriate message" do
diff --git a/spec/bundler/retry_spec.rb b/spec/bundler/retry_spec.rb
index 03f74cd511..280ab07d08 100644
--- a/spec/bundler/retry_spec.rb
+++ b/spec/bundler/retry_spec.rb
@@ -25,24 +25,24 @@ describe Bundler::Retry do
it "raises the last error" do
errors = [StandardError, StandardError, StandardError, Bundler::GemfileNotFound]
attempts = 0
- expect {
+ expect do
Bundler::Retry.new(nil, nil, 3).attempt do
attempts += 1
raise errors.shift
end
- }.to raise_error(Bundler::GemfileNotFound)
+ end.to raise_error(Bundler::GemfileNotFound)
expect(attempts).to eq(4)
end
it "raises exceptions" do
error = Bundler::GemfileNotFound
attempts = 0
- expect {
+ expect do
Bundler::Retry.new(nil, error).attempt do
attempts += 1
raise error
end
- }.to raise_error(error)
+ end.to raise_error(error)
expect(attempts).to eq(1)
end
end
diff --git a/spec/cache/gems_spec.rb b/spec/cache/gems_spec.rb
index fef6e0fce6..9ee5efb32f 100644
--- a/spec/cache/gems_spec.rb
+++ b/spec/cache/gems_spec.rb
@@ -87,7 +87,7 @@ describe "bundle cache" do
end
it "uses builtin gems" do
- install_gemfile %|gem 'builtin_gem', '1.0.2'|
+ install_gemfile %(gem 'builtin_gem', '1.0.2')
should_be_installed("builtin_gem 1.0.2")
end
diff --git a/spec/cache/git_spec.rb b/spec/cache/git_spec.rb
index 81c10cf873..8600455c6a 100644
--- a/spec/cache/git_spec.rb
+++ b/spec/cache/git_spec.rb
@@ -100,7 +100,7 @@ end
gem "foo", :git => '#{lib_path("foo-invalid")}', :branch => :master
G
- bundle %|config local.foo #{lib_path("foo-1.0")}|
+ bundle %(config local.foo #{lib_path("foo-1.0")})
bundle "install"
bundle "#{cmd} --all"
diff --git a/spec/commands/help_spec.rb b/spec/commands/help_spec.rb
index 80a55809d3..86e5b79719 100644
--- a/spec/commands/help_spec.rb
+++ b/spec/commands/help_spec.rb
@@ -15,14 +15,14 @@ describe "bundle help" do
fake_man!
bundle "help gemfile"
- expect(out).to eq(%|["#{root}/lib/bundler/man/gemfile.5"]|)
+ expect(out).to eq(%(["#{root}/lib/bundler/man/gemfile.5"]))
end
it "prefixes bundle commands with bundle- when finding the groff files" do
fake_man!
bundle "help install"
- expect(out).to eq(%|["#{root}/lib/bundler/man/bundle-install"]|)
+ expect(out).to eq(%(["#{root}/lib/bundler/man/bundle-install"]))
end
it "simply outputs the txt file when there is no man on the path" do
diff --git a/spec/commands/init_spec.rb b/spec/commands/init_spec.rb
index 548033e40e..ef405d121d 100644
--- a/spec/commands/init_spec.rb
+++ b/spec/commands/init_spec.rb
@@ -11,9 +11,9 @@ describe "bundle init" do
gem "rails"
G
- expect {
+ expect do
bundle :init
- }.not_to change { File.read(bundled_app("Gemfile")) }
+ end.not_to change { File.read(bundled_app("Gemfile")) }
end
it "should generate from an existing gemspec" do
diff --git a/spec/install/gemfile/git_spec.rb b/spec/install/gemfile/git_spec.rb
index 84e437744d..717e46ec61 100644
--- a/spec/install/gemfile/git_spec.rb
+++ b/spec/install/gemfile/git_spec.rb
@@ -186,7 +186,7 @@ describe "bundle install with git sources" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- bundle %|config local.rack #{lib_path("local-rack")}|
+ bundle %(config local.rack #{lib_path("local-rack")})
bundle :install
expect(out).to match(/at #{lib_path('local-rack')}/)
@@ -208,7 +208,7 @@ describe "bundle install with git sources" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- bundle %|config local.rack #{lib_path("local-rack")}|
+ bundle %(config local.rack #{lib_path("local-rack")})
run "require 'rack'"
expect(out).to eq("LOCAL")
end
@@ -230,7 +230,7 @@ describe "bundle install with git sources" do
s.add_dependency "nokogiri", "1.4.2"
end
- bundle %|config local.rack #{lib_path("local-rack")}|
+ bundle %(config local.rack #{lib_path("local-rack")})
run "require 'rack'"
lockfile1 = File.read(bundled_app("Gemfile.lock"))
@@ -250,7 +250,7 @@ describe "bundle install with git sources" do
FileUtils.cp_r("#{lib_path("rack-0.8")}/.", lib_path("local-rack"))
update_git "rack", "0.8", :path => lib_path("local-rack")
- bundle %|config local.rack #{lib_path("local-rack")}|
+ bundle %(config local.rack #{lib_path("local-rack")})
bundle :install
lockfile1 = File.read(bundled_app("Gemfile.lock"))
@@ -265,7 +265,7 @@ describe "bundle install with git sources" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- bundle %|config local.rack #{lib_path("local-rack")}|
+ bundle %(config local.rack #{lib_path("local-rack")})
bundle :install
expect(out).to match(/Cannot use local override for rack-0.8 because #{Regexp.escape(lib_path('local-rack').to_s)} does not exist/)
end
@@ -279,7 +279,7 @@ describe "bundle install with git sources" do
gem "rack", :git => "#{lib_path("rack-0.8")}"
G
- bundle %|config local.rack #{lib_path("local-rack")}|
+ bundle %(config local.rack #{lib_path("local-rack")})
bundle :install
expect(out).to match(/cannot use local override/i)
end
@@ -293,8 +293,8 @@ describe "bundle install with git sources" do
gem "rack", :git => "#{lib_path("rack-0.8")}"
G
- bundle %|config local.rack #{lib_path("local-rack")}|
- bundle %|config disable_local_branch_check true|
+ bundle %(config local.rack #{lib_path("local-rack")})
+ bundle %(config disable_local_branch_check true)
bundle :install
expect(out).to match(/Bundle complete!/)
end
@@ -313,7 +313,7 @@ describe "bundle install with git sources" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- bundle %|config local.rack #{lib_path("local-rack")}|
+ bundle %(config local.rack #{lib_path("local-rack")})
bundle :install
expect(out).to match(/is using branch another but Gemfile specifies master/)
end
@@ -330,7 +330,7 @@ describe "bundle install with git sources" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- bundle %|config local.rack #{lib_path("local-rack")}|
+ bundle %(config local.rack #{lib_path("local-rack")})
bundle :install
expect(out).to match(/The Gemfile lock is pointing to revision \w+/)
end
@@ -467,7 +467,7 @@ describe "bundle install with git sources" do
it "runs the gemspec in the context of its parent directory" do
build_lib "bar", :path => lib_path("foo/bar"), :gemspec => false do |s|
- s.write lib_path("foo/bar/lib/version.rb"), %{BAR_VERSION = '1.0'}
+ s.write lib_path("foo/bar/lib/version.rb"), %(BAR_VERSION = '1.0')
s.write "bar.gemspec", <<-G
$:.unshift Dir.pwd # For 1.9
require 'lib/version'
diff --git a/spec/install/gems/flex_spec.rb b/spec/install/gems/flex_spec.rb
index 8b344cd8ad..fe725a5cc8 100644
--- a/spec/install/gems/flex_spec.rb
+++ b/spec/install/gems/flex_spec.rb
@@ -231,9 +231,9 @@ describe "bundle flex_install" do
end
it "does something" do
- expect {
+ expect do
bundle "install"
- }.not_to change { File.read(bundled_app("Gemfile.lock")) }
+ end.not_to change { File.read(bundled_app("Gemfile.lock")) }
expect(out).to include("rack = 0.9.1")
expect(out).to include("locked at 1.0.0")
diff --git a/spec/install/gems/sources_spec.rb b/spec/install/gems/sources_spec.rb
index 0206dc1dbf..9ebb2c1ed8 100644
--- a/spec/install/gems/sources_spec.rb
+++ b/spec/install/gems/sources_spec.rb
@@ -329,7 +329,7 @@ describe "bundle install with gems on multiple sources" do
it "does not unlock the non-path gem after install" do
bundle :install
- bundle %{exec ruby -e 'puts "OK"'}
+ bundle %(exec ruby -e 'puts "OK"')
expect(out).to include("OK")
expect(exitstatus).to eq(0) if exitstatus
diff --git a/spec/install/gems/sudo_spec.rb b/spec/install/gems/sudo_spec.rb
index ed5ac405e0..eaee6d74b2 100644
--- a/spec/install/gems/sudo_spec.rb
+++ b/spec/install/gems/sudo_spec.rb
@@ -146,7 +146,7 @@ describe "when using sudo", :sudo => true do
let(:warning) { "Don't run Bundler as root." }
before do
- gemfile %|source "file://#{gem_repo1}"|
+ gemfile %(source "file://#{gem_repo1}")
end
it "warns against that" do
diff --git a/spec/lock/lockfile_spec.rb b/spec/lock/lockfile_spec.rb
index bcca03983c..1f48bcb3e0 100644
--- a/spec/lock/lockfile_spec.rb
+++ b/spec/lock/lockfile_spec.rb
@@ -1243,13 +1243,13 @@ describe "the lockfile format" do
context "when nothing changes" do
it "preserves Gemfile.lock \\n line endings" do
- expect {
+ expect do
ruby <<-RUBY
require 'rubygems'
require 'bundler'
Bundler.setup
RUBY
- }.not_to change { File.mtime(bundled_app("Gemfile.lock")) }
+ end.not_to change { File.mtime(bundled_app("Gemfile.lock")) }
end
it "preserves Gemfile.lock \\n\\r line endings" do
@@ -1257,13 +1257,13 @@ describe "the lockfile format" do
File.open(bundled_app("Gemfile.lock"), "wb") {|f| f.puts(win_lock) }
set_lockfile_mtime_to_known_value
- expect {
+ expect do
ruby <<-RUBY
require 'rubygems'
require 'bundler'
Bundler.setup
RUBY
- }.not_to change { File.mtime(bundled_app("Gemfile.lock")) }
+ end.not_to change { File.mtime(bundled_app("Gemfile.lock")) }
end
end
end
diff --git a/spec/realworld/dependency_api_spec.rb b/spec/realworld/dependency_api_spec.rb
index ac551992a8..81235b72bf 100644
--- a/spec/realworld/dependency_api_spec.rb
+++ b/spec/realworld/dependency_api_spec.rb
@@ -20,19 +20,23 @@ 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__)
require "thread"
- @t = Thread.new {
+ @t = Thread.new do
server = Rack::Server.start(:app => EndpointTimeout,
:Host => "0.0.0.0",
:Port => port,
:server => "webrick",
:AccessLog => [])
server.start
- }
+ end
@t.run
wait_for_server(port)
diff --git a/spec/realworld/gemfile_source_header_spec.rb b/spec/realworld/gemfile_source_header_spec.rb
index aff127db6c..4034fa66b4 100644
--- a/spec/realworld/gemfile_source_header_spec.rb
+++ b/spec/realworld/gemfile_source_header_spec.rb
@@ -35,18 +35,22 @@ 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__)
- @t = Thread.new {
+ @t = Thread.new do
Rack::Server.start(:app => EndpointMirrorSource,
:Host => "0.0.0.0",
:Port => @port,
:server => "webrick",
:AccessLog => [])
- }.run
+ end.run
wait_for_server(@port)
end
diff --git a/spec/resolver/basic_spec.rb b/spec/resolver/basic_spec.rb
index 416f94d4c5..d4dc96419c 100644
--- a/spec/resolver/basic_spec.rb
+++ b/spec/resolver/basic_spec.rb
@@ -47,18 +47,18 @@ describe "Resolving" do
it "raises an exception if a child dependency is not resolved" do
@index = a_unresovable_child_index
dep "chef_app_error"
- expect {
+ expect do
resolve
- }.to raise_error(Bundler::VersionConflict)
+ end.to raise_error(Bundler::VersionConflict)
end
it "should throw error in case of circular dependencies" do
@index = a_circular_index
dep "circular_app"
- expect {
+ expect do
resolve
- }.to raise_error(Bundler::CyclicDependencyError, /please remove either gem 'bar' or gem 'foo'/i)
+ end.to raise_error(Bundler::CyclicDependencyError, /please remove either gem 'bar' or gem 'foo'/i)
end
# Issue #3459
diff --git a/spec/runtime/load_spec.rb b/spec/runtime/load_spec.rb
index 950e8e9b18..b7c856ac3a 100644
--- a/spec/runtime/load_spec.rb
+++ b/spec/runtime/load_spec.rb
@@ -29,10 +29,10 @@ describe "Bundler.load" do
end
it "ignores blank BUNDLE_GEMFILEs" do
- expect {
+ expect do
ENV["BUNDLE_GEMFILE"] = ""
Bundler.load
- }.not_to raise_error
+ end.not_to raise_error
end
end
@@ -55,16 +55,16 @@ describe "Bundler.load" do
describe "without a gemfile" do
it "raises an exception if the default gemfile is not found" do
- expect {
+ expect do
Bundler.load
- }.to raise_error(Bundler::GemfileNotFound, /could not locate gemfile/i)
+ end.to raise_error(Bundler::GemfileNotFound, /could not locate gemfile/i)
end
it "raises an exception if a specified gemfile is not found" do
- expect {
+ expect do
ENV["BUNDLE_GEMFILE"] = "omg.rb"
Bundler.load
- }.to raise_error(Bundler::GemfileNotFound, /omg\.rb/)
+ end.to raise_error(Bundler::GemfileNotFound, /omg\.rb/)
end
it "does not find a Gemfile above the testing directory" do
diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb
index a123aff673..4f0d395342 100644
--- a/spec/runtime/setup_spec.rb
+++ b/spec/runtime/setup_spec.rb
@@ -410,7 +410,7 @@ describe "Bundler.setup" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- bundle %|config local.rack #{lib_path("local-rack")}|
+ bundle %(config local.rack #{lib_path("local-rack")})
bundle :install
expect(out).to match(/at #{lib_path('local-rack')}/)
@@ -429,7 +429,7 @@ describe "Bundler.setup" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- bundle %|config local.rack #{lib_path("local-rack")}|
+ bundle %(config local.rack #{lib_path("local-rack")})
bundle :install
expect(out).to match(/at #{lib_path('local-rack')}/)
@@ -452,7 +452,7 @@ describe "Bundler.setup" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- bundle %|config local.rack #{lib_path("local-rack")}|
+ bundle %(config local.rack #{lib_path("local-rack")})
bundle :install
expect(out).to match(/at #{lib_path('local-rack')}/)
@@ -480,7 +480,7 @@ describe "Bundler.setup" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :ref => "master", :branch => "nonexistant"
G
- bundle %|config local.rack #{lib_path("local-rack")}|
+ bundle %(config local.rack #{lib_path("local-rack")})
run "require 'rack'", :expect_err => true
expect(err).to match(/is using branch master but Gemfile specifies nonexistant/)
end
@@ -620,7 +620,7 @@ describe "Bundler.setup" do
G
ENV["GEM_HOME"] = ""
- bundle %{exec ruby -e "require 'set'"}
+ bundle %(exec ruby -e "require 'set'")
expect(err).to be_empty
end
@@ -630,7 +630,7 @@ describe "Bundler.setup" do
build_gem("requirepaths") do |s|
s.write("lib/rq.rb", "puts 'yay'")
s.write("src/rq.rb", "puts 'nooo'")
- s.require_paths = %w[lib src]
+ s.require_paths = %w(lib src)
end
end
@@ -834,7 +834,7 @@ describe "Bundler.setup" do
describe "with a gemspec that requires other files" do
before :each do
build_git "bar", :gemspec => false do |s|
- s.write "lib/bar/version.rb", %{BAR_VERSION = '1.0'}
+ s.write "lib/bar/version.rb", %(BAR_VERSION = '1.0')
s.write "bar.gemspec", <<-G
lib = File.expand_path('../lib/', __FILE__)
$:.unshift lib unless $:.include?(lib)
@@ -894,7 +894,7 @@ describe "Bundler.setup" do
gem "bundler", :path => "#{File.expand_path("..", lib)}"
G
- bundle %|exec ruby -e "require 'bundler'; Bundler.setup"|
+ bundle %(exec ruby -e "require 'bundler'; Bundler.setup")
expect(err).to be_empty
end
end
diff --git a/spec/runtime/with_clean_env_spec.rb b/spec/runtime/with_clean_env_spec.rb
index eed024a398..0ceb4adf05 100644
--- a/spec/runtime/with_clean_env_spec.rb
+++ b/spec/runtime/with_clean_env_spec.rb
@@ -77,7 +77,7 @@ describe "Bundler.with_env helpers" do
describe "Bundler.clean_system" do
it "runs system inside with_clean_env" do
- Bundler.clean_system(%{echo 'if [ "$BUNDLE_PATH" = "" ]; then exit 42; else exit 1; fi' | /bin/sh})
+ Bundler.clean_system(%(echo 'if [ "$BUNDLE_PATH" = "" ]; then exit 42; else exit 1; fi' | /bin/sh))
expect($?.exitstatus).to eq(42)
end
end
@@ -85,7 +85,7 @@ describe "Bundler.with_env helpers" do
describe "Bundler.clean_exec" do
it "runs exec inside with_clean_env" do
pid = Kernel.fork do
- Bundler.clean_exec(%{echo 'if [ "$BUNDLE_PATH" = "" ]; then exit 42; else exit 1; fi' | /bin/sh})
+ Bundler.clean_exec(%(echo 'if [ "$BUNDLE_PATH" = "" ]; then exit 42; else exit 1; fi' | /bin/sh))
end
Process.wait(pid)
expect($?.exitstatus).to eq(42)
diff --git a/spec/support/artifice/endpoint.rb b/spec/support/artifice/endpoint.rb
index 2ac0483ac6..931bbc48e8 100644
--- a/spec/support/artifice/endpoint.rb
+++ b/spec/support/artifice/endpoint.rb
@@ -21,16 +21,15 @@ class Endpoint < Sinatra::Base
Bundler::Deprecate.skip_during do
Marshal.load(File.open(gem_repo.join("specs.4.8")).read).map do |name, version, platform|
spec = load_spec(name, version, platform, gem_repo)
- if gem_names.include?(spec.name)
- {
- :name => spec.name,
- :number => spec.version.version,
- :platform => spec.platform.to_s,
- :dependencies => spec.dependencies.select {|dep| dep.type == :runtime }.map do |dep|
- [dep.name, dep.requirement.requirements.map {|a| a.join(" ") }.join(", ")]
- end
- }
- end
+ next unless gem_names.include?(spec.name)
+ {
+ :name => spec.name,
+ :number => spec.version.version,
+ :platform => spec.platform.to_s,
+ :dependencies => spec.dependencies.select {|dep| dep.type == :runtime }.map do |dep|
+ [dep.name, dep.requirement.requirements.map {|a| a.join(" ") }.join(", ")]
+ end
+ }
end.compact
end
end
diff --git a/spec/support/artifice/endpoint_creds_diff_host.rb b/spec/support/artifice/endpoint_creds_diff_host.rb
index a0f08a0efc..0c10242daf 100644
--- a/spec/support/artifice/endpoint_creds_diff_host.rb
+++ b/spec/support/artifice/endpoint_creds_diff_host.rb
@@ -9,7 +9,7 @@ class EndpointCredsDiffHost < Endpoint
end
def authorized?
- auth.provided? && auth.basic? && auth.credentials && auth.credentials == %w[user pass]
+ auth.provided? && auth.basic? && auth.credentials && auth.credentials == %w(user pass)
end
def protected!
diff --git a/spec/support/builders.rb b/spec/support/builders.rb
index 913263c51d..4f5dace604 100644
--- a/spec/support/builders.rb
+++ b/spec/support/builders.rb
@@ -408,9 +408,7 @@ module Spec
Array(versions).each do |version|
spec = builder.new(self, name, version)
- if !spec.authors or spec.authors.empty?
- spec.authors = ["no one"]
- end
+ spec.authors = ["no one"] if !spec.authors || spec.authors.empty?
yield spec if block_given?
spec._build(options)
end
@@ -551,9 +549,7 @@ module Spec
@files["#{name}.gemspec"] = @spec.to_ruby
end
- unless options[:no_default]
- @files = _default_files.merge(@files)
- end
+ @files = _default_files.merge(@files) unless options[:no_default]
@spec.authors = ["no one"]
@@ -666,9 +662,7 @@ module Spec
destination = opts[:path] || _default_path
FileUtils.mkdir_p(destination)
- if !@spec.authors or @spec.authors.empty?
- @spec.authors = ["that guy"]
- end
+ @spec.authors = ["that guy"] if !@spec.authors || @spec.authors.empty?
Bundler.rubygems.build(@spec, opts[:skip_validation])
if opts[:to_system]
@@ -736,6 +730,5 @@ module Spec
l69BkyvzjgDPkmOHVGiSZDLi3YDvypbUpo6LOy4v5rVg5U2F/A0v
-----END RSA PRIVATE KEY-----
PKEY
-
end
end
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb
index ae6df9e76d..70e58e574f 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -108,7 +108,7 @@ module Spec
env = (options.delete(:env) || {}).map {|k, v| "#{k}='#{v}' " }.join
ruby.gsub!(/["`\$]/) {|m| "\\#{m}" }
lib_option = options[:no_lib] ? "" : " -I#{lib}"
- sys_exec(%{#{env}#{Gem.ruby}#{lib_option} -e "#{ruby}"}, expect_err)
+ sys_exec(%(#{env}#{Gem.ruby}#{lib_option} -e "#{ruby}"), expect_err)
end
def load_error_ruby(ruby, name, opts = {})
@@ -124,7 +124,8 @@ module Spec
def gembin(cmd)
lib = File.expand_path("../../../lib", __FILE__)
- old, ENV["RUBYOPT"] = ENV["RUBYOPT"], "#{ENV["RUBYOPT"]} -I#{lib}"
+ old = ENV["RUBYOPT"]
+ ENV["RUBYOPT"] = "#{ENV["RUBYOPT"]} -I#{lib}"
cmd = bundled_app("bin/#{cmd}") unless cmd.to_s.include?("/")
sys_exec(cmd.to_s)
ensure
@@ -324,7 +325,8 @@ module Spec
end
def simulate_platform(platform)
- old, ENV["BUNDLER_SPEC_PLATFORM"] = ENV["BUNDLER_SPEC_PLATFORM"], platform.to_s
+ old = ENV["BUNDLER_SPEC_PLATFORM"]
+ ENV["BUNDLER_SPEC_PLATFORM"] = platform.to_s
yield if block_given?
ensure
ENV["BUNDLER_SPEC_PLATFORM"] = old if block_given?
@@ -333,8 +335,10 @@ module Spec
def simulate_ruby_engine(engine, version = "1.6.0")
return if engine == local_ruby_engine
- old, ENV["BUNDLER_SPEC_RUBY_ENGINE"] = ENV["BUNDLER_SPEC_RUBY_ENGINE"], engine
- old_version, ENV["BUNDLER_SPEC_RUBY_ENGINE_VERSION"] = ENV["BUNDLER_SPEC_RUBY_ENGINE_VERSION"], version
+ old = ENV["BUNDLER_SPEC_RUBY_ENGINE"]
+ ENV["BUNDLER_SPEC_RUBY_ENGINE"] = engine
+ old_version = ENV["BUNDLER_SPEC_RUBY_ENGINE_VERSION"]
+ ENV["BUNDLER_SPEC_RUBY_ENGINE_VERSION"] = version
yield if block_given?
ensure
ENV["BUNDLER_SPEC_RUBY_ENGINE"] = old if block_given?
@@ -342,7 +346,8 @@ module Spec
end
def simulate_bundler_version(version)
- old, ENV["BUNDLER_SPEC_VERSION"] = ENV["BUNDLER_SPEC_VERSION"], version.to_s
+ old = ENV["BUNDLER_SPEC_VERSION"]
+ ENV["BUNDLER_SPEC_VERSION"] = version.to_s
yield if block_given?
ensure
ENV["BUNDLER_SPEC_VERSION"] = old if block_given?
diff --git a/spec/support/indexes.rb b/spec/support/indexes.rb
index 387d100d36..10067197db 100644
--- a/spec/support/indexes.rb
+++ b/spec/support/indexes.rb
@@ -206,7 +206,7 @@ module Spec
# Issue #3459
def a_complicated_index
build_index do
- gem "foo", %w{3.0.0 3.0.5} do
+ gem "foo", %w(3.0.0 3.0.5) do
dep "qux", ["~> 3.1"]
dep "baz", ["< 9.0", ">= 5.0"]
dep "bar", ["~> 1.0"]
@@ -245,7 +245,7 @@ module Spec
dep "garply", [">= 0.3.1"]
end
- gem "grault", %w{2.6.3 3.1.1}
+ gem "grault", %w(2.6.3 3.1.1)
gem "garply", "0.5.1" do
dep "waldo", ["~> 0.1.3"]
@@ -344,6 +344,5 @@ module Spec
end
end
end
-
end
end
diff --git a/spec/support/less_than_proc.rb b/spec/support/less_than_proc.rb
index 5098befbf1..515470968a 100644
--- a/spec/support/less_than_proc.rb
+++ b/spec/support/less_than_proc.rb
@@ -3,7 +3,7 @@ class LessThanProc < Proc
def self.with(present)
provided = Gem::Version.new(present.dup)
- self.new do |required|
+ new do |required|
if required =~ /[=><~]/
!Gem::Requirement.new(required).satisfied_by?(provided)
else
diff --git a/spec/support/ruby_ext.rb b/spec/support/ruby_ext.rb
index 59f428aa11..9c5b08c9e5 100644
--- a/spec/support/ruby_ext.rb
+++ b/spec/support/ruby_ext.rb
@@ -9,7 +9,7 @@ class IO
begin
IO.select([self], nil, nil, select_timeout)
break if eof? # stop raising :-(
- buffer << self.readpartial(chunk_size)
+ buffer << readpartial(chunk_size)
rescue(EOFError)
break
end
diff --git a/spec/support/rubygems_ext.rb b/spec/support/rubygems_ext.rb
index 1e0d3d5ee0..07f89bd212 100644
--- a/spec/support/rubygems_ext.rb
+++ b/spec/support/rubygems_ext.rb
@@ -13,7 +13,7 @@ module Spec
unless File.exist?("#{Path.base_system_gems}")
FileUtils.mkdir_p(Path.base_system_gems)
puts "installing gems for the tests to use..."
- %w[fakeweb artifice rack].each {|n| install_gem(n) }
+ %w(fakeweb artifice rack).each {|n| install_gem(n) }
{
"sinatra" => "1.2.7",
# Rake version has to be consistent for tests to pass
@@ -39,11 +39,10 @@ module Spec
def gem_command(command, args = "", options = {})
if command == :exec && !options[:no_quote]
args = args.gsub(/(?=")/, "\\")
- args = %["#{args}"]
+ args = %("#{args}")
end
lib = File.join(File.dirname(__FILE__), "..", "..", "lib")
`#{Gem.ruby} -I#{lib} -rubygems -S gem --backtrace #{command} #{args}`.strip
end
-
end
end
diff --git a/spec/update/git_spec.rb b/spec/update/git_spec.rb
index f61e561179..465f451a58 100644
--- a/spec/update/git_spec.rb
+++ b/spec/update/git_spec.rb
@@ -203,7 +203,7 @@ describe "bundle update" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- bundle %|config local.rack #{lib_path("local-rack")}|
+ bundle %(config local.rack #{lib_path("local-rack")})
bundle "update rack"
expect(out).to include("Bundle updated!")
end