summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2017-10-16 09:47:17 +0900
committerAkira Matsuda <ronnie@dio.jp>2017-10-16 10:42:53 +0900
commitbc8f83994da3f0a10fa41b81e1ddd4a8625df8db (patch)
tree3258c7d732087a750cd61767078f55ca706cb5e1
parentfea177f61df71121c6f9422a74b093e42c504388 (diff)
downloadbundler-bc8f83994da3f0a10fa41b81e1ddd4a8625df8db.tar.gz
Double assignment is no longer an effective workaround for unused variable warning
`def a() x = x = 1; end` warns since Ruby 2.5 (r59585)
-rw-r--r--lib/bundler/installer.rb18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb
index 91cb0ec55e..baf5333479 100644
--- a/lib/bundler/installer.rb
+++ b/lib/bundler/installer.rb
@@ -113,9 +113,12 @@ module Bundler
end
# double-assignment to avoid warnings about variables that will be used by ERB
- bin_path = bin_path = Bundler.bin_path
- relative_gemfile_path = relative_gemfile_path = Bundler.default_gemfile.relative_path_from(bin_path)
- ruby_command = ruby_command = Thor::Util.ruby_command
+ bin_path = Bundler.bin_path
+ bin_path = bin_path
+ relative_gemfile_path = Bundler.default_gemfile.relative_path_from(bin_path)
+ relative_gemfile_path = relative_gemfile_path
+ ruby_command = Thor::Util.ruby_command
+ ruby_command = ruby_command
template_path = File.expand_path("../templates/Executable", __FILE__)
if spec.name == "bundler"
template_path += ".bundler"
@@ -157,13 +160,16 @@ module Bundler
unless path = Bundler.settings[:path]
raise "Can't standalone without an explicit path set"
end
- standalone_path = standalone_path = Bundler.root.join(path).relative_path_from(bin_path)
+ standalone_path = Bundler.root.join(path).relative_path_from(bin_path)
+ standalone_path = standalone_path
template = File.read(File.expand_path("../templates/Executable.standalone", __FILE__))
- ruby_command = ruby_command = Thor::Util.ruby_command
+ ruby_command = Thor::Util.ruby_command
+ ruby_command = ruby_command
spec.executables.each do |executable|
next if executable == "bundle"
- executable_path = executable_path = Pathname(spec.full_gem_path).join(spec.bindir, executable).relative_path_from(bin_path)
+ executable_path = Pathname(spec.full_gem_path).join(spec.bindir, executable).relative_path_from(bin_path)
+ executable_path = executable_path
File.open "#{bin_path}/#{executable}", "w", 0o755 do |f|
f.puts ERB.new(template, nil, "-").result(binding)
end