From bf69d1fc5d73aab8e0b69e0389ab5131f3d40223 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 16 Mar 2023 13:55:04 +0900 Subject: [PATCH] [rubygems/rubygems] util/rubocop -A --only Style/OrAssignment https://github.com/rubygems/rubygems/commit/965fc82cfd --- lib/rubygems/commands/update_command.rb | 2 +- lib/rubygems/ext/builder.rb | 4 +--- lib/rubygems/install_update_options.rb | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/rubygems/commands/update_command.rb b/lib/rubygems/commands/update_command.rb index 1801d8be28..d1c0a32ece 100644 --- a/lib/rubygems/commands/update_command.rb +++ b/lib/rubygems/commands/update_command.rb @@ -37,7 +37,7 @@ class Gem::Commands::UpdateCommand < Gem::Command add_option("--system [VERSION]", Gem::Version, "Update the RubyGems system software") do |value, options| - value = true unless value + value ||= true options[:system] = value end diff --git a/lib/rubygems/ext/builder.rb b/lib/rubygems/ext/builder.rb index e1b4f56fe8..0386dc559b 100644 --- a/lib/rubygems/ext/builder.rb +++ b/lib/rubygems/ext/builder.rb @@ -25,9 +25,7 @@ class Gem::Ext::Builder # try to find make program from Ruby configure arguments first RbConfig::CONFIG["configure_args"] =~ /with-make-prog\=(\w+)/ make_program_name = ENV["MAKE"] || ENV["make"] || $1 - unless make_program_name - make_program_name = RUBY_PLATFORM.include?("mswin") ? "nmake" : "make" - end + make_program_name ||= RUBY_PLATFORM.include?("mswin") ? "nmake" : "make" make_program = Shellwords.split(make_program_name) # The installation of the bundled gems is failed when DESTDIR is empty in mswin platform. diff --git a/lib/rubygems/install_update_options.rb b/lib/rubygems/install_update_options.rb index ffb7d1b233..b95a56f03f 100644 --- a/lib/rubygems/install_update_options.rb +++ b/lib/rubygems/install_update_options.rb @@ -136,9 +136,9 @@ module Gem::InstallUpdateOptions add_option(:"Install/Update", "-g", "--file [FILE]", "Read from a gem dependencies API file and", "install the listed gems") do |v,_o| - v = Gem::GEM_DEP_FILES.find do |file| + v ||= Gem::GEM_DEP_FILES.find do |file| File.exist? file - end unless v + end unless v message = v ? v : "(tried #{Gem::GEM_DEP_FILES.join ", "})"