summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Arko <mail@arko.net>2015-08-13 10:57:51 -0700
committerAndré Arko <mail@arko.net>2015-08-13 10:57:51 -0700
commit6fdbc5d2ac7d794df8044dc7e3c1ce99922e3ff1 (patch)
treeaeb25ff0001387e47c833e9bc55116358943e49a
parentb2ab7c9043786c6255ed1573eebf2a835300a0a7 (diff)
parent18b3e2e75fd958ca9a84f36250ac72618eb724a8 (diff)
downloadbundler-6fdbc5d2ac7d794df8044dc7e3c1ce99922e3ff1.tar.gz
Merge pull request #3904 from esasse/rubocop-fix
Fix Style/ParallelAssignment
-rw-r--r--.rubocop_todo.yml5
-rw-r--r--lib/bundler/cli/config.rb6
-rw-r--r--lib/bundler/dep_proxy.rb3
-rw-r--r--lib/bundler/installer/parallel_installer.rb3
-rw-r--r--lib/bundler/lockfile_parser.rb13
-rw-r--r--lib/bundler/rubygems_integration.rb6
-rw-r--r--lib/bundler/spec_set.rb4
-rw-r--r--spec/support/helpers.rb37
8 files changed, 50 insertions, 27 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 3888248328..ff44d7f8fe 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -289,11 +289,6 @@ Style/OneLineConditional:
Style/OpMethod:
Enabled: false
-# Offense count: 22
-# Cop supports --auto-correct.
-Style/ParallelAssignment:
- Enabled: false
-
# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: AllowSafeAssignment.
diff --git a/lib/bundler/cli/config.rb b/lib/bundler/cli/config.rb
index 91633b0259..0caabfb0a0 100644
--- a/lib/bundler/cli/config.rb
+++ b/lib/bundler/cli/config.rb
@@ -13,9 +13,11 @@ module Bundler
peek = args.shift
if peek && peek =~ /^\-\-/
- name, scope = args.shift, $'
+ name = args.shift
+ scope = $'
else
- name, scope = peek, "global"
+ name = peek
+ scope = "global"
end
unless name
diff --git a/lib/bundler/dep_proxy.rb b/lib/bundler/dep_proxy.rb
index 8d960835d1..378cefa194 100644
--- a/lib/bundler/dep_proxy.rb
+++ b/lib/bundler/dep_proxy.rb
@@ -3,7 +3,8 @@ module Bundler
attr_reader :__platform, :dep
def initialize(dep, platform)
- @dep, @__platform = dep, platform
+ @dep = dep
+ @__platform = platform
end
def hash
diff --git a/lib/bundler/installer/parallel_installer.rb b/lib/bundler/installer/parallel_installer.rb
index b962563a57..84bdb425fa 100644
--- a/lib/bundler/installer/parallel_installer.rb
+++ b/lib/bundler/installer/parallel_installer.rb
@@ -4,7 +4,8 @@ class ParallelInstaller
class SpecInstallation
attr_accessor :spec, :name, :post_install_message, :state
def initialize(spec)
- @spec, @name = spec, spec.name
+ @spec = spec
+ @name = spec.name
@state = :none
@post_install_message = ""
end
diff --git a/lib/bundler/lockfile_parser.rb b/lib/bundler/lockfile_parser.rb
index e44f9420da..78d5cb9d3c 100644
--- a/lib/bundler/lockfile_parser.rb
+++ b/lib/bundler/lockfile_parser.rb
@@ -92,7 +92,8 @@ module Bundler
case line
when GIT, GEM, PATH
@current_source = nil
- @opts, @type = {}, line
+ @opts = {}
+ @type = line
when SPECS
case @type
when PATH
@@ -137,7 +138,9 @@ module Bundler
def parse_dependency(line)
if line =~ NAME_VERSION_2
- name, version, pinned = $1, $2, $4
+ name = $1
+ version = $2
+ pinned = $4
version = version.split(",").map(&:strip) if version
dep = Bundler::Dependency.new(name, version)
@@ -162,7 +165,8 @@ module Bundler
def parse_spec(line)
if line =~ NAME_VERSION_4
- name, version = $1, Gem::Version.new($2)
+ name = $1
+ version = Gem::Version.new($2)
platform = $3 ? Gem::Platform.new($3) : Gem::Platform::RUBY
@current_spec = LazySpecification.new(name, version, platform)
@current_spec.source = @current_source
@@ -171,7 +175,8 @@ module Bundler
# duplicate GIT sections)
@specs[@current_spec.identifier] ||= @current_spec
elsif line =~ NAME_VERSION_6
- name, version = $1, $2
+ name = $1
+ version = $2
version = version.split(",").map(&:strip) if version
dep = Gem::Dependency.new(name, version)
@current_spec.dependencies << dep
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index d8c3b8d048..b33d76b115 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -521,7 +521,8 @@ module Bundler
# you call Gem::Installer#install with an :install_dir set. We have to
# change it back for our sudo mode to work.
def preserve_paths
- old_dir, old_path = gem_dir, gem_path
+ old_dir = gem_dir
+ old_path = gem_path
yield
Gem.use_paths(old_dir, old_path)
end
@@ -583,7 +584,8 @@ module Bundler
def download_gem(spec, uri, path)
require "resolv"
uri = Bundler.settings.mirror_for(uri)
- proxy, dns = configuration[:http_proxy], Resolv::DNS.new
+ proxy = configuration[:http_proxy]
+ dns = Resolv::DNS.new
fetcher = Gem::RemoteFetcher.new(proxy, dns)
fetcher.download(spec, uri, path)
end
diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb
index bf064eb20b..855a6e3317 100644
--- a/lib/bundler/spec_set.rb
+++ b/lib/bundler/spec_set.rb
@@ -14,7 +14,9 @@ module Bundler
end
def for(dependencies, skip = [], check = false, match_current_platform = false)
- handled, deps, specs = {}, dependencies.dup, []
+ handled = {}
+ deps = dependencies.dup
+ specs = []
skip << "bundler"
until deps.empty?
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb
index de6fb54327..4aa71c8765 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -1,7 +1,9 @@
module Spec
module Helpers
def reset!
- @in_p, @out_p, @err_p = nil, nil, nil
+ @in_p = nil
+ @out_p = nil
+ @err_p = nil
Dir["#{tmp}/{gems/*,*}"].each do |dir|
next if %(base remote1 gems rubygems).include?(File.basename(dir))
if ENV["BUNDLER_SUDO_TESTS"]
@@ -129,7 +131,9 @@ module Spec
def sys_exec(cmd, expect_err = false)
Open3.popen3(cmd.to_s) do |stdin, stdout, stderr, wait_thr|
- @in_p, @out_p, @err_p = stdin, stdout, stderr
+ @in_p = stdin
+ @out_p = stdout
+ @err_p = stderr
yield @in_p if block_given?
@in_p.close
@@ -200,11 +204,14 @@ module Spec
alias_method :install_gem, :install_gems
def with_gem_path_as(path)
- gem_home, gem_path = ENV["GEM_HOME"], ENV["GEM_PATH"]
- ENV["GEM_HOME"], ENV["GEM_PATH"] = path.to_s, path.to_s
+ gem_home = ENV["GEM_HOME"]
+ gem_path = ENV["GEM_PATH"]
+ ENV["GEM_HOME"] = path.to_s
+ ENV["GEM_PATH"] = path.to_s
yield
ensure
- ENV["GEM_HOME"], ENV["GEM_PATH"] = gem_home, gem_path
+ ENV["GEM_HOME"] = gem_home
+ ENV["GEM_PATH"] = gem_path
end
def with_path_as(path)
@@ -245,15 +252,19 @@ module Spec
Gem.clear_paths
- gem_home, gem_path, path = ENV["GEM_HOME"], ENV["GEM_PATH"], ENV["PATH"]
- ENV["GEM_HOME"], ENV["GEM_PATH"] = system_gem_path.to_s, system_gem_path.to_s
+ gem_home = ENV["GEM_HOME"]
+ gem_path = ENV["GEM_PATH"]
+ path = ENV["PATH"]
+ ENV["GEM_HOME"] = system_gem_path.to_s
+ ENV["GEM_PATH"] = system_gem_path.to_s
install_gems(*gems)
if block_given?
begin
yield
ensure
- ENV["GEM_HOME"], ENV["GEM_PATH"] = gem_home, gem_path
+ ENV["GEM_HOME"] = gem_home
+ ENV["GEM_PATH"] = gem_path
ENV["PATH"] = path
end
end
@@ -267,8 +278,11 @@ module Spec
Gem.clear_paths
- gem_home, gem_path, path = ENV["GEM_HOME"], ENV["GEM_PATH"], ENV["PATH"]
- ENV["GEM_HOME"], ENV["GEM_PATH"] = system_gem_path.to_s, system_gem_path.to_s
+ gem_home = ENV["GEM_HOME"]
+ gem_path = ENV["GEM_PATH"]
+ path = ENV["PATH"]
+ ENV["GEM_HOME"] = system_gem_path.to_s
+ ENV["GEM_PATH"] = system_gem_path.to_s
gems.each do |gem|
gem_command :install, "--no-rdoc --no-ri #{gem}"
@@ -277,7 +291,8 @@ module Spec
begin
yield
ensure
- ENV["GEM_HOME"], ENV["GEM_PATH"] = gem_home, gem_path
+ ENV["GEM_HOME"] = gem_home
+ ENV["GEM_PATH"] = gem_path
ENV["PATH"] = path
end
end