summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHomu <homu@barosl.com>2015-08-15 02:44:27 +0900
committerHomu <homu@barosl.com>2015-08-15 02:44:27 +0900
commitbc87d05ff3565551ec3b2d32a5c08aa3cf24beb8 (patch)
tree28b385ad858fa2da1dae07e0a7660229812416f1
parente6c4b309e891a728b6e749f9dae311547f0c21c6 (diff)
parent22a365183998174c5d896579a72b153bb779d1da (diff)
downloadbundler-bc87d05ff3565551ec3b2d32a5c08aa3cf24beb8.tar.gz
Auto merge of #3923 - Koronen:fix-style-offences, r=segiddins
Fix a bunch of style offences Most of these were low-hanging fruit, fixable by using RuboCop's auto-correct feature.
-rw-r--r--.rubocop_todo.yml181
-rw-r--r--bundler.gemspec4
-rw-r--r--lib/bundler.rb8
-rw-r--r--lib/bundler/cli.rb54
-rw-r--r--lib/bundler/cli/gem.rb2
-rw-r--r--lib/bundler/cli/install.rb4
-rw-r--r--lib/bundler/cli/outdated.rb2
-rw-r--r--lib/bundler/cli/show.rb2
-rw-r--r--lib/bundler/definition.rb14
-rw-r--r--lib/bundler/dep_proxy.rb4
-rw-r--r--lib/bundler/dsl.rb2
-rw-r--r--lib/bundler/fetcher.rb2
-rw-r--r--lib/bundler/gem_helper.rb6
-rw-r--r--lib/bundler/graph.rb8
-rw-r--r--lib/bundler/index.rb8
-rw-r--r--lib/bundler/installer.rb4
-rw-r--r--lib/bundler/lazy_specification.rb2
-rw-r--r--lib/bundler/remote_specification.rb2
-rw-r--r--lib/bundler/retry.rb4
-rw-r--r--lib/bundler/rubygems_ext.rb18
-rw-r--r--lib/bundler/rubygems_integration.rb8
-rw-r--r--lib/bundler/runtime.rb2
-rw-r--r--lib/bundler/settings.rb2
-rw-r--r--lib/bundler/similarity_detector.rb15
-rw-r--r--lib/bundler/source/git.rb7
-rw-r--r--lib/bundler/source/git/git_proxy.rb2
-rw-r--r--lib/bundler/source/path.rb8
-rw-r--r--lib/bundler/source/rubygems.rb37
-rw-r--r--spec/bundler/dsl_spec.rb2
-rw-r--r--spec/bundler/fetcher_spec.rb4
-rw-r--r--spec/bundler/gem_helper_spec.rb7
-rw-r--r--spec/bundler/retry_spec.rb2
-rw-r--r--spec/install/binstubs_spec.rb2
-rw-r--r--spec/install/bundler_spec.rb1
-rw-r--r--spec/install/gems/dependency_api_spec.rb2
-rw-r--r--spec/lock/lockfile_spec.rb6
-rw-r--r--spec/realworld/dependency_api_spec.rb2
-rw-r--r--spec/runtime/executable_spec.rb5
-rw-r--r--spec/runtime/load_spec.rb2
-rw-r--r--spec/runtime/with_clean_env_spec.rb4
-rw-r--r--spec/support/builders.rb1
-rw-r--r--spec/support/indexes.rb10
-rw-r--r--spec/support/matchers.rb2
-rw-r--r--spec/support/ruby_ext.rb4
-rw-r--r--spec/support/rubygems_ext.rb2
-rw-r--r--spec/support/sometimes.rb2
46 files changed, 148 insertions, 324 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 8925ddbfc9..4cdb0752b2 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -75,17 +75,6 @@ Style/AndOr:
Style/BlockDelimiters:
Enabled: false
-# Offense count: 1
-# Cop supports --auto-correct.
-Style/BlockEndNewline:
- Enabled: false
-
-# Offense count: 3
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles.
-Style/BracesAroundHashParameters:
- Enabled: false
-
# Offense count: 3
Style/CaseEquality:
Enabled: false
@@ -101,39 +90,6 @@ Style/CaseIndentation:
Style/ClassAndModuleChildren:
Enabled: false
-# Offense count: 1
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles.
-Style/ClassCheck:
- Enabled: false
-
-# Offense count: 3
-# Cop supports --auto-correct.
-Style/ClosingParenthesisIndentation:
- Enabled: false
-
-# Offense count: 1
-# Cop supports --auto-correct.
-Style/ColonMethodCall:
- Enabled: false
-
-# Offense count: 2
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerBackticks.
-Style/CommandLiteral:
- Enabled: false
-
-# Offense count: 1
-# Cop supports --auto-correct.
-# Configuration parameters: Keywords.
-Style/CommentAnnotation:
- Enabled: false
-
-# Offense count: 3
-# Cop supports --auto-correct.
-Style/DeprecatedHashMethods:
- Enabled: false
-
# Offense count: 153
Style/Documentation:
Enabled: false
@@ -144,32 +100,17 @@ Style/Documentation:
Style/EmptyElse:
Enabled: false
-# Offense count: 1
-# Cop supports --auto-correct.
-Style/EmptyLinesAroundMethodBody:
- Enabled: false
-
# Offense count: 9
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/EmptyLinesAroundModuleBody:
Enabled: false
-# Offense count: 2
-# Cop supports --auto-correct.
-Style/EmptyLiteral:
- Enabled: false
-
# Offense count: 1
# Configuration parameters: Exclude.
Style/FileName:
Enabled: false
-# Offense count: 3
-# Configuration parameters: EnforcedStyle, SupportedStyles.
-Style/For:
- Enabled: false
-
# Offense count: 4
# Configuration parameters: AllowedVariables.
Style/GlobalVars:
@@ -186,49 +127,6 @@ Style/GuardClause:
Style/IfUnlessModifier:
Enabled: false
-# Offense count: 3
-# Cop supports --auto-correct.
-Style/IndentArray:
- Enabled: false
-
-# Offense count: 1
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles.
-Style/IndentationConsistency:
- Enabled: false
-
-# Offense count: 5
-# Cop supports --auto-correct.
-# Configuration parameters: Width.
-Style/IndentationWidth:
- Enabled: false
-
-# Offense count: 2
-# Cop supports --auto-correct.
-Style/InfiniteLoop:
- Enabled: false
-
-# Offense count: 4
-# Cop supports --auto-correct.
-Style/LeadingCommentSpace:
- Enabled: false
-
-# Offense count: 4
-# Cop supports --auto-correct.
-Style/LineEndConcatenation:
- Enabled: false
-
-# Offense count: 1
-# Cop supports --auto-correct.
-Style/MethodCallParentheses:
- Enabled: false
-
-# Offense count: 3
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles.
-Style/MethodDefParentheses:
- Enabled: false
-
# Offense count: 2
Style/ModuleFunction:
Enabled: false
@@ -237,64 +135,17 @@ Style/ModuleFunction:
Style/MultilineBlockChain:
Enabled: false
-# Offense count: 3
-# Cop supports --auto-correct.
-Style/MultilineBlockLayout:
- Enabled: false
-
-# Offense count: 2
-# Cop supports --auto-correct.
-Style/MultilineIfThen:
- Enabled: false
-
# Offense count: 13
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/MultilineOperationIndentation:
Enabled: false
-# Offense count: 4
-Style/MultilineTernaryOperator:
- Enabled: false
-
-# Offense count: 5
-# Cop supports --auto-correct.
-Style/NegatedIf:
- Enabled: false
-
-# Offense count: 1
-Style/NestedTernaryOperator:
- Enabled: false
-
# Offense count: 10
# Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
Style/Next:
Enabled: false
-# Offense count: 1
-# Cop supports --auto-correct.
-Style/Not:
- Enabled: false
-
-# Offense count: 3
-# Cop supports --auto-correct.
-Style/NumericLiterals:
- MinDigits: 8
-
-# Offense count: 1
-Style/OneLineConditional:
- Enabled: false
-
-# Offense count: 5
-Style/OpMethod:
- Enabled: false
-
-# Offense count: 3
-# Cop supports --auto-correct.
-# Configuration parameters: AllowSafeAssignment.
-Style/ParenthesesAroundCondition:
- Enabled: false
-
# Offense count: 63
# Cop supports --auto-correct.
# Configuration parameters: PreferredDelimiters.
@@ -311,27 +162,11 @@ Style/PerlBackrefs:
Style/PredicateName:
Enabled: false
-# Offense count: 3
-# Cop supports --auto-correct.
-Style/Proc:
- Enabled: false
-
# Offense count: 8
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/RaiseArgs:
Enabled: false
-# Offense count: 1
-# Cop supports --auto-correct.
-Style/RedundantBegin:
- Enabled: false
-
-# Offense count: 3
-# Cop supports --auto-correct.
-# Configuration parameters: AllowMultipleReturnValues.
-Style/RedundantReturn:
- Enabled: false
-
# Offense count: 7
# Cop supports --auto-correct.
Style/RedundantSelf:
@@ -361,19 +196,3 @@ Style/SpaceInsideStringInterpolation:
# Cop supports --auto-correct.
Style/TrailingUnderscoreVariable:
Enabled: false
-
-# Offense count: 2
-# Cop supports --auto-correct.
-Style/UnneededPercentQ:
- Enabled: false
-
-# Offense count: 1
-# Cop supports --auto-correct.
-Style/WhileUntilDo:
- Enabled: false
-
-# Offense count: 1
-# Cop supports --auto-correct.
-# Configuration parameters: MaxLineLength.
-Style/WhileUntilModifier:
- Enabled: false
diff --git a/bundler.gemspec b/bundler.gemspec
index 52f65b2a03..8fc65647d5 100644
--- a/bundler.gemspec
+++ b/bundler.gemspec
@@ -10,8 +10,8 @@ Gem::Specification.new do |s|
s.authors = ["André Arko", "Terence Lee", "Carl Lerche", "Yehuda Katz"]
s.email = ["andre.arko+terence.lee@gmail.com"]
s.homepage = "http://bundler.io"
- s.summary = %q{The best way to manage your application's dependencies}
- s.description = %q{Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably}
+ s.summary = "The best way to manage your application's dependencies"
+ s.description = "Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably"
s.required_ruby_version = ">= 1.8.7"
s.required_rubygems_version = ">= 1.3.6"
diff --git a/lib/bundler.rb b/lib/bundler.rb
index 143d49e9cf..9a46dede49 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -222,9 +222,11 @@ module Bundler
end
def app_config_path
- ENV["BUNDLE_APP_CONFIG"] ?
- Pathname.new(ENV["BUNDLE_APP_CONFIG"]).expand_path(root) :
+ if ENV["BUNDLE_APP_CONFIG"]
+ Pathname.new(ENV["BUNDLE_APP_CONFIG"]).expand_path(root)
+ else
root.join(".bundle")
+ end
end
def app_cache(custom_path = nil)
@@ -259,7 +261,7 @@ module Bundler
with_original_env do
ENV["MANPATH"] = ENV["BUNDLE_ORIG_MANPATH"]
ENV.delete_if {|k, _| k[0, 7] == "BUNDLE_" }
- if ENV.has_key? "RUBYOPT"
+ if ENV.key? "RUBYOPT"
ENV["RUBYOPT"] = ENV["RUBYOPT"].sub "-rbundler/setup", ""
ENV["RUBYOPT"] = ENV["RUBYOPT"].sub "-I#{File.expand_path("..", __FILE__)}", ""
end
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index c481ac7322..150df56c7f 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -48,15 +48,15 @@ module Bundler
end
manpages = %w(
- bundle
- bundle-config
- bundle-exec
- bundle-gem
- bundle-install
- bundle-package
- bundle-update
- bundle-platform
- gemfile.5)
+ bundle
+ bundle-config
+ bundle-exec
+ bundle-gem
+ bundle-install
+ bundle-package
+ bundle-update
+ bundle-platform
+ gemfile.5)
if manpages.include?(command)
root = File.expand_path("../man", __FILE__)
@@ -411,24 +411,24 @@ module Bundler
private
- # Automatically invoke `bundle install` and resume if
- # Bundler.settings[:auto_install] exists. This is set through config cmd
- # `bundle config auto_install 1`.
- #
- # Note that this method `nil`s out the global Definition object, so it
- # should be called first, before you instantiate anything like an
- # `Installer` that'll keep a reference to the old one instead.
- def auto_install
- return unless Bundler.settings[:auto_install]
-
- begin
- Bundler.definition.specs
- rescue GemNotFound
- Bundler.ui.info "Automatically installing missing gems."
- Bundler.reset!
- invoke :install, []
- Bundler.reset!
- end
+ # Automatically invoke `bundle install` and resume if
+ # Bundler.settings[:auto_install] exists. This is set through config cmd
+ # `bundle config auto_install 1`.
+ #
+ # Note that this method `nil`s out the global Definition object, so it
+ # should be called first, before you instantiate anything like an
+ # `Installer` that'll keep a reference to the old one instead.
+ def auto_install
+ return unless Bundler.settings[:auto_install]
+
+ begin
+ Bundler.definition.specs
+ rescue GemNotFound
+ Bundler.ui.info "Automatically installing missing gems."
+ Bundler.reset!
+ invoke :install, []
+ Bundler.reset!
end
+ end
end
end
diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb
index de673fa69d..2704bbec7c 100644
--- a/lib/bundler/cli/gem.rb
+++ b/lib/bundler/cli/gem.rb
@@ -195,7 +195,7 @@ module Bundler
req.join(".")
end
- def ensure_safe_gem_name name, constant_array
+ def ensure_safe_gem_name(name, constant_array)
if name =~ /^\d/
Bundler.ui.error "Invalid gem name #{name} Please give a name which does not start with numbers."
exit 1
diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb
index 2245f9585a..1f5337d46e 100644
--- a/lib/bundler/cli/install.rb
+++ b/lib/bundler/cli/install.rb
@@ -50,8 +50,8 @@ module Bundler
exit 1
end
- if (options["trust-policy"])
- unless (Bundler.rubygems.security_policies.keys.include?(options["trust-policy"]))
+ if options["trust-policy"]
+ unless Bundler.rubygems.security_policies.keys.include?(options["trust-policy"])
Bundler.ui.error "Rubygems doesn't know about trust policy '#{options["trust-policy"]}'. " \
"The known policies are: #{Bundler.rubygems.security_policies.keys.join(", ")}."
exit 1
diff --git a/lib/bundler/cli/outdated.rb b/lib/bundler/cli/outdated.rb
index 640e4f7ca7..4c777df6e6 100644
--- a/lib/bundler/cli/outdated.rb
+++ b/lib/bundler/cli/outdated.rb
@@ -32,7 +32,7 @@ module Bundler
out_count = 0
# Loop through the current specs
- gemfile_specs, dependency_specs = current_specs.partition {|spec| current_dependencies.has_key? spec.name }
+ gemfile_specs, dependency_specs = current_specs.partition {|spec| current_dependencies.key? spec.name }
[gemfile_specs.sort_by(&:name), dependency_specs.sort_by(&:name)].flatten.each do |current_spec|
next if !gems.empty? && !gems.include?(current_spec.name)
diff --git a/lib/bundler/cli/show.rb b/lib/bundler/cli/show.rb
index 44b5894a61..50cf0a97d5 100644
--- a/lib/bundler/cli/show.rb
+++ b/lib/bundler/cli/show.rb
@@ -23,7 +23,7 @@ module Bundler
spec = Bundler::CLI::Common.select_spec(gem_name, :regex_match)
return unless spec
path = spec.full_gem_path
- if !File.directory?(path)
+ unless File.directory?(path)
Bundler.ui.warn "The gem #{gem_name} has been deleted. It was installed at:"
end
end
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 4f68c2248e..85e82b4c77 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -310,12 +310,10 @@ module Bundler
out << "DEPENDENCIES\n"
handled = []
- dependencies.
- sort_by(&:to_s).
- each do |dep|
- next if handled.include?(dep.name)
- out << dep.to_lock
- handled << dep.name
+ dependencies.sort_by(&:to_s).each do |dep|
+ next if handled.include?(dep.name)
+ out << dep.to_lock
+ handled << dep.name
end
# Record the version of Bundler that was used to create the lockfile
@@ -480,7 +478,7 @@ module Bundler
changes = false
# Get the Rubygems sources from the Gemfile.lock
- locked_gem_sources = @locked_sources.select {|s| s.kind_of?(Source::Rubygems) }
+ locked_gem_sources = @locked_sources.select {|s| s.is_a?(Source::Rubygems) }
# Get the Rubygems remotes from the Gemfile
actual_remotes = sources.rubygems_remotes
@@ -645,7 +643,7 @@ module Bundler
def pinned_spec_names(specs)
names = []
specs.each do |s|
- # TODO when two sources without blocks is an error, we can change
+ # TODO: when two sources without blocks is an error, we can change
# this check to !s.source.is_a?(Source::LocalRubygems). For now,
# we need to ask every Rubygems for every gem name.
if s.source.is_a?(Source::Git) || s.source.is_a?(Source::Path)
diff --git a/lib/bundler/dep_proxy.rb b/lib/bundler/dep_proxy.rb
index 378cefa194..4efd99c9bb 100644
--- a/lib/bundler/dep_proxy.rb
+++ b/lib/bundler/dep_proxy.rb
@@ -11,8 +11,8 @@ module Bundler
@hash ||= dep.hash
end
- def ==(o)
- dep == o.dep && __platform == o.__platform
+ def ==(other)
+ dep == other.dep && __platform == other.__platform
end
alias_method :eql?, :==
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index 5d7dfddf22..9df01fb905 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -280,7 +280,7 @@ module Bundler
end
# Save sources passed in a key
- if opts.has_key?("source")
+ if opts.key?("source")
source = normalize_source(opts["source"])
opts["source"] = @sources.add_rubygems_source("remotes" => source)
end
diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb
index 829b709c38..6236bee7b6 100644
--- a/lib/bundler/fetcher.rb
+++ b/lib/bundler/fetcher.rb
@@ -223,7 +223,7 @@ module Bundler
end
# cached gem specification path, if one exists
- def gemspec_cached_path spec_file_name
+ def gemspec_cached_path(spec_file_name)
paths = Bundler.rubygems.spec_cache_dirs.map {|dir| File.join(dir, spec_file_name) }
paths = paths.select {|path| File.file? path }
paths.first
diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb
index 33576bbdc8..ab7bcc27a0 100644
--- a/lib/bundler/gem_helper.rb
+++ b/lib/bundler/gem_helper.rb
@@ -158,7 +158,11 @@ module Bundler
def sh(cmd, &block)
out, code = sh_with_code(cmd, &block)
- code == 0 ? out : raise(out.empty? ? "Running `#{cmd}' failed. Run this command directly for more detailed output." : out)
+ if code == 0
+ out
+ else
+ raise(out.empty? ? "Running `#{cmd}' failed. Run this command directly for more detailed output." : out)
+ end
end
def sh_with_code(cmd, &block)
diff --git a/lib/bundler/graph.rb b/lib/bundler/graph.rb
index e815f7dae9..cf5913ec70 100644
--- a/lib/bundler/graph.rb
+++ b/lib/bundler/graph.rb
@@ -95,15 +95,15 @@ module Bundler
# method borrow from rubygems/dependency.rb
# redefinition of matching_specs will also redefine to_spec and to_specs
Gem::Dependency.class_eval do
- def matching_specs platform_only = false
+ def matching_specs(platform_only = false)
matches = Bundler.load.specs.select { |spec|
self.name == spec.name and
requirement.satisfied_by? spec.version
}
if platform_only
- matches.reject! { |spec|
- not Gem::Platform.match spec.platform
+ matches.select! { |spec|
+ Gem::Platform.match spec.platform
}
end
@@ -124,7 +124,7 @@ module Bundler
end
def g
- @g ||= ::GraphViz.digraph(@graph_name, { :concentrate => true, :normalize => true, :nodesep => 0.55 }) do |g|
+ @g ||= ::GraphViz.digraph(@graph_name, :concentrate => true, :normalize => true, :nodesep => 0.55) do |g|
g.edge[:weight] = 2
g.edge[:fontname] = g.node[:fontname] = "Arial, Helvetica, SansSerif"
g.edge[:fontsize] = 12
diff --git a/lib/bundler/index.rb b/lib/bundler/index.rb
index 6c4ed3996c..b989719909 100644
--- a/lib/bundler/index.rb
+++ b/lib/bundler/index.rb
@@ -16,7 +16,7 @@ module Bundler
def initialize
@sources = []
@cache = {}
- @specs = Hash.new {|h, k| h[k] = Hash.new }
+ @specs = Hash.new {|h, k| h[k] = {} }
@all_specs = Hash.new {|h, k| h[k] = [] }
end
@@ -24,7 +24,7 @@ module Bundler
super
@sources = @sources.dup
@cache = {}
- @specs = Hash.new {|h, k| h[k] = Hash.new }
+ @specs = Hash.new {|h, k| h[k] = {} }
@all_specs = Hash.new {|h, k| h[k] = [] }
o.specs.each do |name, hash|
@@ -127,9 +127,9 @@ module Bundler
end
end
- def ==(o)
+ def ==(other)
all? do |spec|
- other_spec = o[spec].first
+ other_spec = other[spec].first
(spec.dependencies & other_spec.dependencies).empty? && spec.source == other_spec.source
end
end
diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb
index e4a9a8c9fe..00bd2158eb 100644
--- a/lib/bundler/installer.rb
+++ b/lib/bundler/installer.rb
@@ -123,7 +123,7 @@ module Bundler
options[dep.name] = bins unless bins.empty?
end
if options.any?
- Bundler.ui.warn "#{spec.name} has no executables, but you may want " +
+ Bundler.ui.warn "#{spec.name} has no executables, but you may want " \
"one from a gem it depends on."
options.each {|name, bins| Bundler.ui.warn " #{name} has: #{bins.join(", ")}" }
else
@@ -264,7 +264,7 @@ module Bundler
def create_bundle_path
Bundler.mkdir_p(Bundler.bundle_path.to_s) unless Bundler.bundle_path.exist?
rescue Errno::EEXIST
- raise PathError, "Could not install to path `#{Bundler.settings[:path]}` " +
+ raise PathError, "Could not install to path `#{Bundler.settings[:path]}` " \
"because of an invalid symlink. Remove the symlink so the directory can be created."
end
diff --git a/lib/bundler/lazy_specification.rb b/lib/bundler/lazy_specification.rb
index 43d9dc993d..f0efbc448f 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? then
+ if platform == Gem::Platform::RUBY or platform.nil?
"#{@name}-#{@version}"
else
"#{@name}-#{@version}-#{platform}"
diff --git a/lib/bundler/remote_specification.rb b/lib/bundler/remote_specification.rb
index 5a32bd2435..3050c37371 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? then
+ if platform == Gem::Platform::RUBY or platform.nil?
"#{@name}-#{@version}"
else
"#{@name}-#{@version}-#{platform}"
diff --git a/lib/bundler/retry.rb b/lib/bundler/retry.rb
index 85bff78807..4b0fff4bd5 100644
--- a/lib/bundler/retry.rb
+++ b/lib/bundler/retry.rb
@@ -25,9 +25,7 @@ module Bundler
@current_run = 0
@failed = false
@error = nil
- while keep_trying? do
- run(&block)
- end
+ run(&block) while keep_trying?
@result
end
alias_method :attempts, :attempt
diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb
index eddd1fa191..9e4ce5ac17 100644
--- a/lib/bundler/rubygems_ext.rb
+++ b/lib/bundler/rubygems_ext.rb
@@ -22,15 +22,19 @@ module Gem
alias_method :rg_loaded_from, :loaded_from
def full_gem_path
- source.respond_to?(:path) ?
- Pathname.new(loaded_from).dirname.expand_path(Bundler.root).to_s.untaint :
+ if source.respond_to?(:path)
+ Pathname.new(loaded_from).dirname.expand_path(Bundler.root).to_s.untaint
+ else
rg_full_gem_path
+ end
end
def loaded_from
- relative_loaded_from ?
- source.path.join(relative_loaded_from).to_s :
+ if relative_loaded_from
+ source.path.join(relative_loaded_from).to_s
+ else
rg_loaded_from
+ end
end
def load_paths
@@ -48,9 +52,11 @@ module Gem
if method_defined?(:extension_dir)
alias_method :rg_extension_dir, :extension_dir
def extension_dir
- @extension_dir ||= source.respond_to?(:extension_dir_name) ?
- File.expand_path(File.join(extensions_dir, source.extension_dir_name)) :
+ @extension_dir ||= if source.respond_to?(:extension_dir_name)
+ File.expand_path(File.join(extensions_dir, source.extension_dir_name))
+ else
rg_extension_dir
+ end
end
end
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index b33d76b115..b5ae60d5ed 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -186,7 +186,7 @@ module Bundler
# Then fetch the prerelease specs
fetch_prerelease_specs.each {|k, v| spec_list[k] += v }
- return spec_list
+ spec_list
end
def with_build_args(args)
@@ -229,7 +229,7 @@ module Bundler
end
def build_gem(gem_dir, spec)
- build(spec)
+ build(spec)
end
def download_gem(spec, uri, path)
@@ -594,7 +594,7 @@ module Bundler
require "rubygems/package"
p = Gem::Package.new(path)
p.security_policy = policy if policy
- return p
+ p
end
def build(spec, skip_validation = false)
@@ -625,7 +625,7 @@ module Bundler
require "rubygems/ext"
Gem::Ext::Builder.class_eval do
- if !const_defined?(:CHDIR_MONITOR)
+ unless const_defined?(:CHDIR_MONITOR)
const_set(:CHDIR_MONITOR, EXT_LOCK)
end
diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb
index 28767af5e2..5f340a3e64 100644
--- a/lib/bundler/runtime.rb
+++ b/lib/bundler/runtime.rb
@@ -61,7 +61,7 @@ module Bundler
@definition.dependencies.each do |dep|
# Skip the dependency if it is not in any of the requested
# groups
- next unless ((dep.groups & groups).any? && dep.current_platform?)
+ next unless (dep.groups & groups).any? && dep.current_platform?
required_file = nil
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index 0ebde20c71..bf465f8eec 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -199,7 +199,7 @@ module Bundler
end
def set_array(key, array)
- self[key] = (array.empty? ? nil : array.join(":")) if array
+ self[key] = (array.empty? ? nil : array.join(":")) if array
end
def set_key(key, value, hash, file)
diff --git a/lib/bundler/similarity_detector.rb b/lib/bundler/similarity_detector.rb
index de2de05992..624238552c 100644
--- a/lib/bundler/similarity_detector.rb
+++ b/lib/bundler/similarity_detector.rb
@@ -38,20 +38,19 @@ module Bundler
fill = [0] * (this.length - 1)
# Initialize first column values
- for i in 1..that.length
+ (1..that.length).each do |i|
dm[i] = [i * del, fill.flatten]
end
# populate matrix
- for i in 1..that.length
- for j in 1..this.length
+ (1..that.length).each do |i|
+ (1..this.length).each do |j|
# critical comparison
dm[i][j] = [
- dm[i - 1][j - 1] +
- (this[j - 1] == that[i - 1] ? 0 : sub),
- dm[i][j - 1] + ins,
- dm[i - 1][j] + del
- ].min
+ dm[i - 1][j - 1] + (this[j - 1] == that[i - 1] ? 0 : sub),
+ dm[i][j - 1] + ins,
+ dm[i - 1][j] + del
+ ].min
end
end
diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb
index 7c0abc5637..c18341d17e 100644
--- a/lib/bundler/source/git.rb
+++ b/lib/bundler/source/git.rb
@@ -49,9 +49,10 @@ module Bundler
[self.class, uri, ref, branch, name, version, submodules].hash
end
- def eql?(o)
- o.is_a?(Git) && uri == o.uri && ref == o.ref && branch == o.branch && name == o.name && version == o.version &&
- submodules == o.submodules
+ def eql?(other)
+ other.is_a?(Git) && uri == other.uri && ref == other.ref &&
+ branch == other.branch && name == other.name &&
+ version == other.version && submodules == other.submodules
end
alias_method :==, :eql?
diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb
index bc6513bcea..f7de1a0a56 100644
--- a/lib/bundler/source/git/git_proxy.rb
+++ b/lib/bundler/source/git/git_proxy.rb
@@ -122,7 +122,7 @@ module Bundler
def git(command, check_errors = true)
raise GitNotAllowedError.new(command) unless allow?
- out = SharedHelpers.with_clean_git_env { %x{git #{command}} }
+ out = SharedHelpers.with_clean_git_env { `git #{command}` }
raise GitCommandError.new(command, path) if check_errors && !$?.success?
out
end
diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb
index 1772a819c9..b2c2f8c978 100644
--- a/lib/bundler/source/path.rb
+++ b/lib/bundler/source/path.rb
@@ -56,10 +56,10 @@ module Bundler
[self.class, expanded_path, version].hash
end
- def eql?(o)
- o.instance_of?(Path) &&
- expanded_path == expand(o.path) &&
- version == o.version
+ def eql?(other)
+ other.instance_of?(Path) &&
+ expanded_path == expand(other.path) &&
+ version == other.version
end
alias_method :==, :eql?
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
index a9b10f5936..26c1e7cd17 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -37,8 +37,8 @@ module Bundler
@remotes.hash
end
- def eql?(o)
- o.is_a?(Rubygems) && o.credless_remotes == credless_remotes
+ def eql?(other)
+ other.is_a?(Rubygems) && other.credless_remotes == credless_remotes
end
alias_method :==, :eql?
@@ -132,7 +132,8 @@ module Bundler
installed_spec = nil
Bundler.rubygems.preserve_paths do
- installed_spec = Bundler::GemInstaller.new(path,
+ installed_spec = Bundler::GemInstaller.new(
+ path,
:install_dir => install_path.to_s,
:bin_dir => bin_path.to_s,
:ignore_dependencies => true,
@@ -287,18 +288,18 @@ module Bundler
# Always have bundler locally
unless have_bundler
- # We're running bundler directly from the source
- # so, let's create a fake gemspec for it (it's a path)
- # gemspec
- bundler = Gem::Specification.new do |s|
- s.name = "bundler"
- s.version = VERSION
- s.platform = Gem::Platform::RUBY
- s.source = self
- s.authors = ["bundler team"]
- s.loaded_from = File.expand_path("..", __FILE__)
- end
- idx << bundler
+ # We're running bundler directly from the source
+ # so, let's create a fake gemspec for it (it's a path)
+ # gemspec
+ bundler = Gem::Specification.new do |s|
+ s.name = "bundler"
+ s.version = VERSION
+ s.platform = Gem::Platform::RUBY
+ s.source = self
+ s.authors = ["bundler team"]
+ s.loaded_from = File.expand_path("..", __FILE__)
+ end
+ idx << bundler
end
idx
end
@@ -345,7 +346,7 @@ module Bundler
api_fetchers.each do |f|
Bundler.ui.info "Fetching gem metadata from #{f.uri}", Bundler.ui.debug?
idx.use f.specs(dependency_names, self)
- Bundler.ui.info "" if !Bundler.ui.debug? # new line now that the dots are over
+ Bundler.ui.info "" unless Bundler.ui.debug? # new line now that the dots are over
end
# Suppose the gem Foo depends on the gem Bar. Foo exists in Source A. Bar has some versions that exist in both
@@ -358,7 +359,7 @@ module Bundler
api_fetchers.each do |f|
Bundler.ui.info "Fetching version metadata from #{f.uri}", Bundler.ui.debug?
idx.use f.specs(idx.dependency_names, self), true
- Bundler.ui.info "" if !Bundler.ui.debug? # new line now that the dots are over
+ Bundler.ui.info "" unless Bundler.ui.debug? # new line now that the dots are over
end
break if idxcount == idx.size
end
@@ -373,7 +374,7 @@ module Bundler
api_fetchers.each do |f|
Bundler.ui.info "Fetching dependency metadata from #{f.uri}", Bundler.ui.debug?
idx.use f.specs(unmet, self)
- Bundler.ui.info "" if !Bundler.ui.debug? # new line now that the dots are over
+ Bundler.ui.info "" unless Bundler.ui.debug? # new line now that the dots are over
end if unmet.any?
else
allow_api = false
diff --git a/spec/bundler/dsl_spec.rb b/spec/bundler/dsl_spec.rb
index 169843bbe5..fc31531602 100644
--- a/spec/bundler/dsl_spec.rb
+++ b/spec/bundler/dsl_spec.rb
@@ -33,7 +33,7 @@ describe Bundler::Dsl do
end
it "converts numeric :gist to :git" do
- subject.gem("not-really-a-gem", :gist => 2859988)
+ subject.gem("not-really-a-gem", :gist => 2_859_988)
github_uri = "https://gist.github.com/2859988.git"
expect(subject.dependencies.first.source.uri).to eq(github_uri)
end
diff --git a/spec/bundler/fetcher_spec.rb b/spec/bundler/fetcher_spec.rb
index fd72f457c5..622c25d287 100644
--- a/spec/bundler/fetcher_spec.rb
+++ b/spec/bundler/fetcher_spec.rb
@@ -19,14 +19,14 @@ describe Bundler::Fetcher do
describe "include CI information" do
it "from one CI" do
- with_env_vars({ "JENKINS_URL" => "foo" }) do
+ with_env_vars("JENKINS_URL" => "foo") do
ci_part = fetcher.user_agent.split(" ").find {|x| x.match(%r{\Aci/}) }
expect(ci_part).to match("jenkins")
end
end
it "from many CI" do
- with_env_vars({ "TRAVIS" => "foo", "CI_NAME" => "my_ci" }) do
+ with_env_vars("TRAVIS" => "foo", "CI_NAME" => "my_ci") do
ci_part = fetcher.user_agent.split(" ").find {|x| x.match(%r{\Aci/}) }
expect(ci_part).to match("travis")
expect(ci_part).to match("my_ci")
diff --git a/spec/bundler/gem_helper_spec.rb b/spec/bundler/gem_helper_spec.rb
index ff41f04fb3..0dbd1d8e20 100644
--- a/spec/bundler/gem_helper_spec.rb
+++ b/spec/bundler/gem_helper_spec.rb
@@ -103,9 +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) {
+ %w[build install release release:guard_clean
+ release:source_control_push release:rubygem_push]
+ }
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 23e6668438..03f74cd511 100644
--- a/spec/bundler/retry_spec.rb
+++ b/spec/bundler/retry_spec.rb
@@ -12,7 +12,7 @@ describe Bundler::Retry do
end
it "returns the first valid result" do
- jobs = [Proc.new { raise "foo" }, Proc.new { :bar }, Proc.new { raise "foo" }]
+ jobs = [proc { raise "foo" }, proc { :bar }, proc { raise "foo" }]
attempts = 0
result = Bundler::Retry.new(nil, nil, 3).attempt do
attempts += 1
diff --git a/spec/install/binstubs_spec.rb b/spec/install/binstubs_spec.rb
index 6442ad74cb..1b34e62567 100644
--- a/spec/install/binstubs_spec.rb
+++ b/spec/install/binstubs_spec.rb
@@ -5,7 +5,7 @@ describe "bundle install" do
# On OS X, Gem.bindir defaults to /usr/bin, so system_bindir is useful if
# you want to avoid sudo installs for system gems with OS X's default ruby
it "overrides Gem.bindir" do
- expect(Pathname.new("/usr/bin")).not_to be_writable unless Process::euid == 0
+ expect(Pathname.new("/usr/bin")).not_to be_writable unless Process.euid == 0
gemfile <<-G
require 'rubygems'
def Gem.bindir; "/usr/bin"; end
diff --git a/spec/install/bundler_spec.rb b/spec/install/bundler_spec.rb
index 4bbfb135c1..a5278ef2f8 100644
--- a/spec/install/bundler_spec.rb
+++ b/spec/install/bundler_spec.rb
@@ -134,7 +134,6 @@ describe "bundle install" do
G
simulate_bundler_version "10.0.0"
- #simulate_new_machine
bundle "check"
expect(out).to include("The Gemfile's dependencies are satisfied")
diff --git a/spec/install/gems/dependency_api_spec.rb b/spec/install/gems/dependency_api_spec.rb
index 97b1c6fc9e..55eba01481 100644
--- a/spec/install/gems/dependency_api_spec.rb
+++ b/spec/install/gems/dependency_api_spec.rb
@@ -290,7 +290,7 @@ describe "gemcutter's dependency API" do
build_repo4 do
build_gem "activesupport", "1.2.0"
build_gem "somegem", "1.0.0" do |s|
- s.add_dependency "activesupport", "1.2.3" #This version exists only in repo1
+ s.add_dependency "activesupport", "1.2.3" # This version exists only in repo1
end
end
diff --git a/spec/lock/lockfile_spec.rb b/spec/lock/lockfile_spec.rb
index 5204e86092..bcca03983c 100644
--- a/spec/lock/lockfile_spec.rb
+++ b/spec/lock/lockfile_spec.rb
@@ -1243,7 +1243,8 @@ describe "the lockfile format" do
context "when nothing changes" do
it "preserves Gemfile.lock \\n line endings" do
- expect { ruby <<-RUBY
+ expect {
+ ruby <<-RUBY
require 'rubygems'
require 'bundler'
Bundler.setup
@@ -1256,7 +1257,8 @@ describe "the lockfile format" do
File.open(bundled_app("Gemfile.lock"), "wb") {|f| f.puts(win_lock) }
set_lockfile_mtime_to_known_value
- expect { ruby <<-RUBY
+ expect {
+ ruby <<-RUBY
require 'rubygems'
require 'bundler'
Bundler.setup
diff --git a/spec/realworld/dependency_api_spec.rb b/spec/realworld/dependency_api_spec.rb
index dd03907093..ac551992a8 100644
--- a/spec/realworld/dependency_api_spec.rb
+++ b/spec/realworld/dependency_api_spec.rb
@@ -19,7 +19,7 @@ describe "gemcutter's dependency API", :realworld => true do
require "rack"
ENV["GEM_HOME"] = old_gem_home
- port = 21453
+ port = 21_453
port += 1 while TCPSocket.new("127.0.0.1", port) rescue false
@server_uri = "http://127.0.0.1:#{port}"
diff --git a/spec/runtime/executable_spec.rb b/spec/runtime/executable_spec.rb
index 4ddb330ae0..a0abee27f5 100644
--- a/spec/runtime/executable_spec.rb
+++ b/spec/runtime/executable_spec.rb
@@ -37,8 +37,8 @@ describe "Running bin/* commands" do
end
it "uses the default ruby install name when shebang is not specified" do
- bundle "install --binstubs"
- expect(File.open("bin/rackup").gets).to eq("#!/usr/bin/env #{RbConfig::CONFIG["ruby_install_name"]}\n")
+ bundle "install --binstubs"
+ expect(File.open("bin/rackup").gets).to eq("#!/usr/bin/env #{RbConfig::CONFIG["ruby_install_name"]}\n")
end
it "allows the name of the shebang executable to be specified" do
@@ -105,7 +105,6 @@ describe "Running bin/* commands" do
bundle "install --binstubs \"\""
expect(bundled_app("bin/rackup")).not_to exist
- #expect(bundled_app("rackup")).not_to exist
bundle "config bin"
expect(out).to include("You have not configured a value for `bin`")
diff --git a/spec/runtime/load_spec.rb b/spec/runtime/load_spec.rb
index 1ba79adc85..950e8e9b18 100644
--- a/spec/runtime/load_spec.rb
+++ b/spec/runtime/load_spec.rb
@@ -32,7 +32,7 @@ describe "Bundler.load" do
expect {
ENV["BUNDLE_GEMFILE"] = ""
Bundler.load
- }.not_to raise_error()
+ }.not_to raise_error
end
end
diff --git a/spec/runtime/with_clean_env_spec.rb b/spec/runtime/with_clean_env_spec.rb
index 1c6114c033..13dd629a16 100644
--- a/spec/runtime/with_clean_env_spec.rb
+++ b/spec/runtime/with_clean_env_spec.rb
@@ -27,8 +27,8 @@ describe "Bundler.with_env helpers" do
gemfile ""
bundle "install --path vendor/bundle"
- code = "Bundler.with_clean_env do;" +
- " print ENV['GEM_PATH'] != '';" +
+ code = "Bundler.with_clean_env do;" \
+ " print ENV['GEM_PATH'] != '';" \
"end"
result = bundle "exec ruby -e #{code.inspect}"
diff --git a/spec/support/builders.rb b/spec/support/builders.rb
index b5e044b67d..2c02327b3d 100644
--- a/spec/support/builders.rb
+++ b/spec/support/builders.rb
@@ -293,7 +293,6 @@ module Spec
s.cert_chain = [cert]
end
end
-
end
def build_repo(path, &blk)
diff --git a/spec/support/indexes.rb b/spec/support/indexes.rb
index dff5138733..387d100d36 100644
--- a/spec/support/indexes.rb
+++ b/spec/support/indexes.rb
@@ -38,12 +38,10 @@ module Spec
end
def should_conflict_on(names)
- begin
- got = resolve
- flunk "The resolve succeeded with: #{got.map(&:full_name).sort.inspect}"
- rescue Bundler::VersionConflict => e
- expect(Array(names).sort).to eq(e.conflicts.sort)
- end
+ got = resolve
+ flunk "The resolve succeeded with: #{got.map(&:full_name).sort.inspect}"
+ rescue Bundler::VersionConflict => e
+ expect(Array(names).sort).to eq(e.conflicts.sort)
end
def gem(*args, &blk)
diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb
index d41ac964f5..6c585ddae4 100644
--- a/spec/support/matchers.rb
+++ b/spec/support/matchers.rb
@@ -18,8 +18,6 @@ module Spec
args = args.flatten
args = args.first.split(/\s+/) if args.size == 1
- #failure_message_for_should "Expected RUBYOPT to have options #{args.join(" ")}. It was #{ENV["RUBYOPT"]}"
-
match do |actual|
actual = actual.split(/\s+/) if actual.is_a?(String)
args.all? {|arg| actual.include?(arg) } && actual.uniq.size == actual.size
diff --git a/spec/support/ruby_ext.rb b/spec/support/ruby_ext.rb
index b70fb7bf82..59f428aa11 100644
--- a/spec/support/ruby_ext.rb
+++ b/spec/support/ruby_ext.rb
@@ -1,5 +1,5 @@
class IO
- def read_available_bytes(chunk_size = 16384, select_timeout = 0.02)
+ def read_available_bytes(chunk_size = 16_384, select_timeout = 0.02)
buffer = []
return "" if closed? || eof?
@@ -15,6 +15,6 @@ class IO
end
end
- return buffer.join
+ buffer.join
end
end
diff --git a/spec/support/rubygems_ext.rb b/spec/support/rubygems_ext.rb
index 8456de163f..1e0d3d5ee0 100644
--- a/spec/support/rubygems_ext.rb
+++ b/spec/support/rubygems_ext.rb
@@ -42,7 +42,7 @@ module Spec
args = %["#{args}"]
end
lib = File.join(File.dirname(__FILE__), "..", "..", "lib")
- %x{#{Gem.ruby} -I#{lib} -rubygems -S gem --backtrace #{command} #{args}}.strip
+ `#{Gem.ruby} -I#{lib} -rubygems -S gem --backtrace #{command} #{args}`.strip
end
end
diff --git a/spec/support/sometimes.rb b/spec/support/sometimes.rb
index 99fc9e9444..0ab15d974f 100644
--- a/spec/support/sometimes.rb
+++ b/spec/support/sometimes.rb
@@ -29,7 +29,7 @@ RSpec.configure do |config|
end
config.after(:suite) do
- message = Proc.new do |color, text|
+ message = proc do |color, text|
colored = RSpec::Core::Formatters::ConsoleCodes.wrap(text, color)
notification = RSpec::Core::Notifications::MessageNotification.new(colored)
RSpec.configuration.formatters.first.message(notification)