From 4b91ca2b6dde9e1e8721517b3b718c2d357a4d18 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 7 Mar 2024 17:51:21 +0000 Subject: [PATCH] Use RuboCop default hash syntax. For https://github.com/Homebrew/brew/pull/16848 --- lib/bundle/brew_checker.rb | 2 +- lib/bundle/brew_dumper.rb | 2 +- lib/bundle/brew_installer.rb | 36 +++++++++++----------- lib/bundle/brewfile.rb | 2 +- lib/bundle/cask_checker.rb | 2 +- lib/bundle/cask_installer.rb | 2 +- lib/bundle/checker.rb | 26 ++++++++-------- lib/bundle/commands/check.rb | 4 +-- lib/bundle/commands/cleanup.rb | 18 +++++------ lib/bundle/commands/dump.rb | 6 ++-- lib/bundle/commands/exec.rb | 2 +- lib/bundle/commands/install.rb | 4 +-- lib/bundle/commands/list.rb | 4 +-- lib/bundle/dsl.rb | 2 +- lib/bundle/dumper.rb | 16 +++++----- lib/bundle/installer.rb | 8 ++--- lib/bundle/lister.rb | 4 +-- lib/bundle/locker.rb | 12 ++++---- lib/bundle/mac_app_store_checker.rb | 8 ++--- lib/bundle/mac_app_store_installer.rb | 2 +- lib/bundle/tap_installer.rb | 4 +-- lib/bundle/vscode_extension_installer.rb | 2 +- lib/bundle/whalebrew_installer.rb | 2 +- spec/bundle/brew_dumper_spec.rb | 2 +- spec/bundle/brew_installer_spec.rb | 10 +++--- spec/bundle/brewfile_spec.rb | 2 +- spec/bundle/commands/check_command_spec.rb | 2 +- 27 files changed, 93 insertions(+), 93 deletions(-) diff --git a/lib/bundle/brew_checker.rb b/lib/bundle/brew_checker.rb index aab75f128..8b1e32ba9 100644 --- a/lib/bundle/brew_checker.rb +++ b/lib/bundle/brew_checker.rb @@ -7,7 +7,7 @@ class BrewChecker < Bundle::Checker::Base PACKAGE_TYPE_NAME = "Formula" def installed_and_up_to_date?(formula, no_upgrade: false) - Bundle::BrewInstaller.formula_installed_and_up_to_date?(formula, no_upgrade: no_upgrade) + Bundle::BrewInstaller.formula_installed_and_up_to_date?(formula, no_upgrade:) end end end diff --git a/lib/bundle/brew_dumper.rb b/lib/bundle/brew_dumper.rb index 45b95c7f9..504193392 100644 --- a/lib/bundle/brew_dumper.rb +++ b/lib/bundle/brew_dumper.rb @@ -164,7 +164,7 @@ def formula_to_hash(formula) aliases: formula.aliases, any_version_installed?: formula.any_version_installed?, args: Array(args).uniq, - version: version, + version:, installed_as_dependency?: installed_as_dependency || false, installed_on_request?: installed_on_request || false, dependencies: runtime_dependencies, diff --git a/lib/bundle/brew_installer.rb b/lib/bundle/brew_installer.rb index 2b4d12d12..337ddf240 100644 --- a/lib/bundle/brew_installer.rb +++ b/lib/bundle/brew_installer.rb @@ -9,11 +9,11 @@ def self.reset! end def self.preinstall(name, no_upgrade: false, verbose: false, **options) - new(name, options).preinstall(no_upgrade: no_upgrade, verbose: verbose) + new(name, options).preinstall(no_upgrade:, verbose:) end def self.install(name, preinstall: true, no_upgrade: false, verbose: false, **options) - new(name, options).install(preinstall: preinstall, no_upgrade: no_upgrade, verbose: verbose) + new(name, options).install(preinstall:, no_upgrade:, verbose:) end def initialize(name, options = {}) @@ -39,26 +39,26 @@ def preinstall(no_upgrade: false, verbose: false) def install(preinstall: true, no_upgrade: false, verbose: false, force: false) install_result = if preinstall - install_change_state!(no_upgrade: no_upgrade, verbose: verbose, force: force) + install_change_state!(no_upgrade:, verbose:, force:) else true end if installed? - service_change_state!(verbose: verbose) if install_result - link_change_state!(verbose: verbose, force: force) + service_change_state!(verbose:) if install_result + link_change_state!(verbose:, force:) end install_result end def install_change_state!(no_upgrade:, verbose:, force:) - return false unless resolve_conflicts!(verbose: verbose) + return false unless resolve_conflicts!(verbose:) if installed? - upgrade!(verbose: verbose, force: force) + upgrade!(verbose:, force:) else - install!(verbose: verbose, force: force) + install!(verbose:, force:) end end @@ -88,10 +88,10 @@ def changed? def service_change_state!(verbose:) if restart_service_needed? puts "Restarting #{@name} service." if verbose - BrewServices.restart(@full_name, verbose: verbose) + BrewServices.restart(@full_name, verbose:) elsif start_service_needed? puts "Starting #{@name} service." if verbose - BrewServices.start(@full_name, verbose: verbose) + BrewServices.start(@full_name, verbose:) else true end @@ -102,22 +102,22 @@ def link_change_state!(verbose: false, force: false) when true unless linked_and_keg_only? puts "Force-linking #{@name} formula." if verbose - Bundle.system(HOMEBREW_BREW_FILE, "link", "--force", @name, verbose: verbose) + Bundle.system(HOMEBREW_BREW_FILE, "link", "--force", @name, verbose:) end when false unless unlinked_and_not_keg_only? puts "Unlinking #{@name} formula." if verbose - Bundle.system(HOMEBREW_BREW_FILE, "unlink", @name, verbose: verbose) + Bundle.system(HOMEBREW_BREW_FILE, "unlink", @name, verbose:) end when nil if unlinked_and_not_keg_only? puts "Linking #{@name} formula." if verbose link_args = "link" link_args << "--overwrite" if force - Bundle.system(HOMEBREW_BREW_FILE, *link_args, @name, verbose: verbose) + Bundle.system(HOMEBREW_BREW_FILE, *link_args, @name, verbose:) elsif linked_and_keg_only? puts "Unlinking #{@name} formula." if verbose - Bundle.system(HOMEBREW_BREW_FILE, "unlink", @name, verbose: verbose) + Bundle.system(HOMEBREW_BREW_FILE, "unlink", @name, verbose:) end end end @@ -233,11 +233,11 @@ def resolve_conflicts!(verbose:) It is currently installed and conflicts with #{@name}. EOS end - return false unless Bundle.system(HOMEBREW_BREW_FILE, "unlink", conflict, verbose: verbose) + return false unless Bundle.system(HOMEBREW_BREW_FILE, "unlink", conflict, verbose:) if restart_service? puts "Stopping #{conflict} service (if it is running)." if verbose - BrewServices.stop(conflict, verbose: verbose) + BrewServices.stop(conflict, verbose:) end end @@ -249,7 +249,7 @@ def install!(verbose:, force:) install_args << "--force" << "--overwrite" if force with_args = " with #{install_args.join(" ")}" if install_args.present? puts "Installing #{@name} formula#{with_args}. It is not currently installed." if verbose - unless Bundle.system(HOMEBREW_BREW_FILE, "install", "--formula", @full_name, *install_args, verbose: verbose) + unless Bundle.system(HOMEBREW_BREW_FILE, "install", "--formula", @full_name, *install_args, verbose:) @changed = nil return false end @@ -264,7 +264,7 @@ def upgrade!(verbose:, force:) upgrade_args << "--force" if force with_args = " with #{upgrade_args.join(" ")}" if upgrade_args.present? puts "Upgrading #{@name} formula#{with_args}. It is installed but not up-to-date." if verbose - unless Bundle.system(HOMEBREW_BREW_FILE, "upgrade", "--formula", @name, *upgrade_args, verbose: verbose) + unless Bundle.system(HOMEBREW_BREW_FILE, "upgrade", "--formula", @name, *upgrade_args, verbose:) @changed = nil return false end diff --git a/lib/bundle/brewfile.rb b/lib/bundle/brewfile.rb index cbeb2c2cd..a15726bae 100644 --- a/lib/bundle/brewfile.rb +++ b/lib/bundle/brewfile.rb @@ -28,7 +28,7 @@ def path(dash_writes_to_stdout: false, global: false, file: nil) end def read(global: false, file: nil) - Brewfile.path(global: global, file: file).read + Brewfile.path(global:, file:).read rescue Errno::ENOENT raise "No Brewfile found" end diff --git a/lib/bundle/cask_checker.rb b/lib/bundle/cask_checker.rb index e5f85e6b3..28e1b5baf 100644 --- a/lib/bundle/cask_checker.rb +++ b/lib/bundle/cask_checker.rb @@ -7,7 +7,7 @@ class CaskChecker < Bundle::Checker::Base PACKAGE_TYPE_NAME = "Cask" def installed_and_up_to_date?(cask, no_upgrade: false) - Bundle::CaskInstaller.cask_installed_and_up_to_date?(cask, no_upgrade: no_upgrade) + Bundle::CaskInstaller.cask_installed_and_up_to_date?(cask, no_upgrade:) end end end diff --git a/lib/bundle/cask_installer.rb b/lib/bundle/cask_installer.rb index 345ea3ec1..29afa959f 100644 --- a/lib/bundle/cask_installer.rb +++ b/lib/bundle/cask_installer.rb @@ -34,7 +34,7 @@ def install(name, preinstall: true, no_upgrade: false, verbose: false, force: fa if installed_casks.include?(name) && upgrading?(no_upgrade, name, options) status = "#{options[:greedy] ? "may not be" : "not"} up-to-date" puts "Upgrading #{name} cask. It is installed but #{status}." if verbose - return Bundle.system HOMEBREW_BREW_FILE, "upgrade", "--cask", full_name, verbose: verbose + return Bundle.system HOMEBREW_BREW_FILE, "upgrade", "--cask", full_name, verbose: end args = options.fetch(:args, []).filter_map do |k, v| diff --git a/lib/bundle/checker.rb b/lib/bundle/checker.rb index 9cd05b411..44859940f 100644 --- a/lib/bundle/checker.rb +++ b/lib/bundle/checker.rb @@ -9,7 +9,7 @@ class Base def exit_early_check(packages, no_upgrade:) work_to_be_done = packages.find do |pkg| - !installed_and_up_to_date?(pkg, no_upgrade: no_upgrade) + !installed_and_up_to_date?(pkg, no_upgrade:) end Array(work_to_be_done) @@ -25,8 +25,8 @@ def failure_reason(name, no_upgrade:) end def full_check(packages, no_upgrade:) - packages.reject { |pkg| installed_and_up_to_date?(pkg, no_upgrade: no_upgrade) } - .map { |pkg| failure_reason(pkg, no_upgrade: no_upgrade) } + packages.reject { |pkg| installed_and_up_to_date?(pkg, no_upgrade:) } + .map { |pkg| failure_reason(pkg, no_upgrade:) } end def checkable_entries(all_entries) @@ -46,9 +46,9 @@ def find_actionable(entries, exit_on_first_error: false, no_upgrade: false, verb requested = format_checkable entries if exit_on_first_error - exit_early_check(requested, no_upgrade: no_upgrade) + exit_early_check(requested, no_upgrade:) else - full_check(requested, no_upgrade: no_upgrade) + full_check(requested, no_upgrade:) end end end @@ -67,7 +67,7 @@ def find_actionable(entries, exit_on_first_error: false, no_upgrade: false, verb }.freeze def check(global: false, file: nil, exit_on_first_error: false, no_upgrade: false, verbose: false) - @dsl ||= Bundle::Dsl.new(Brewfile.read(global: global, file: file)) + @dsl ||= Bundle::Dsl.new(Brewfile.read(global:, file:)) check_method_names = CHECKS.keys @@ -76,7 +76,7 @@ def check(global: false, file: nil, exit_on_first_error: false, no_upgrade: fals work_to_be_done = check_method_names.public_send(enumerator) do |check_method| check_errors = - send(check_method, exit_on_first_error: exit_on_first_error, no_upgrade: no_upgrade, verbose: verbose) + send(check_method, exit_on_first_error:, no_upgrade:, verbose:) any_errors = check_errors.any? errors.concat(check_errors) if any_errors any_errors @@ -90,42 +90,42 @@ def check(global: false, file: nil, exit_on_first_error: false, no_upgrade: fals def casks_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false) Bundle::Checker::CaskChecker.new.find_actionable( @dsl.entries, - exit_on_first_error: exit_on_first_error, no_upgrade: no_upgrade, verbose: verbose, + exit_on_first_error:, no_upgrade:, verbose:, ) end def formulae_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false) Bundle::Checker::BrewChecker.new.find_actionable( @dsl.entries, - exit_on_first_error: exit_on_first_error, no_upgrade: no_upgrade, verbose: verbose, + exit_on_first_error:, no_upgrade:, verbose:, ) end def taps_to_tap(exit_on_first_error: false, no_upgrade: false, verbose: false) Bundle::Checker::TapChecker.new.find_actionable( @dsl.entries, - exit_on_first_error: exit_on_first_error, no_upgrade: no_upgrade, verbose: verbose, + exit_on_first_error:, no_upgrade:, verbose:, ) end def apps_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false) Bundle::Checker::MacAppStoreChecker.new.find_actionable( @dsl.entries, - exit_on_first_error: exit_on_first_error, no_upgrade: no_upgrade, verbose: verbose, + exit_on_first_error:, no_upgrade:, verbose:, ) end def extensions_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false) Bundle::Checker::VscodeExtensionChecker.new.find_actionable( @dsl.entries, - exit_on_first_error: exit_on_first_error, no_upgrade: no_upgrade, verbose: verbose, + exit_on_first_error:, no_upgrade:, verbose:, ) end def formulae_to_start(exit_on_first_error: false, no_upgrade: false, verbose: false) Bundle::Checker::BrewServiceChecker.new.find_actionable( @dsl.entries, - exit_on_first_error: exit_on_first_error, no_upgrade: no_upgrade, verbose: verbose, + exit_on_first_error:, no_upgrade:, verbose:, ) end diff --git a/lib/bundle/commands/check.rb b/lib/bundle/commands/check.rb index 32e15dccd..9a4e7c0c3 100644 --- a/lib/bundle/commands/check.rb +++ b/lib/bundle/commands/check.rb @@ -12,8 +12,8 @@ def run(global: false, file: nil, no_upgrade: false, verbose: false) output_errors = verbose exit_on_first_error = !verbose check_result = Bundle::Checker.check( - global: global, file: file, - exit_on_first_error: exit_on_first_error, no_upgrade: no_upgrade, verbose: verbose + global:, file:, + exit_on_first_error:, no_upgrade:, verbose: ) if check_result.work_to_be_done diff --git a/lib/bundle/commands/cleanup.rb b/lib/bundle/commands/cleanup.rb index 2f9feafc9..2f2974247 100644 --- a/lib/bundle/commands/cleanup.rb +++ b/lib/bundle/commands/cleanup.rb @@ -19,10 +19,10 @@ def reset! end def run(global: false, file: nil, force: false, zap: false) - casks = casks_to_uninstall(global: global, file: file) - formulae = formulae_to_uninstall(global: global, file: file) - taps = taps_to_untap(global: global, file: file) - vscode_extensions = vscode_extensions_to_uninstall(global: global, file: file) + casks = casks_to_uninstall(global:, file:) + formulae = formulae_to_uninstall(global:, file:) + taps = taps_to_untap(global:, file:) + vscode_extensions = vscode_extensions_to_uninstall(global:, file:) if force if casks.any? args = zap ? ["--zap"] : [] @@ -77,11 +77,11 @@ def run(global: false, file: nil, force: false, zap: false) end def casks_to_uninstall(global: false, file: nil) - Bundle::CaskDumper.cask_names - kept_casks(global: global, file: file) + Bundle::CaskDumper.cask_names - kept_casks(global:, file:) end def formulae_to_uninstall(global: false, file: nil) - @dsl ||= Bundle::Dsl.new(Brewfile.read(global: global, file: file)) + @dsl ||= Bundle::Dsl.new(Brewfile.read(global:, file:)) kept_formulae = @dsl.entries.select { |e| e.type == :brew }.map(&:name) kept_cask_formula_dependencies = Bundle::CaskDumper.formula_dependencies(kept_casks) kept_formulae += kept_cask_formula_dependencies @@ -102,7 +102,7 @@ def formulae_to_uninstall(global: false, file: nil) def kept_casks(global: false, file: nil) return @kept_casks if @kept_casks - @dsl ||= Bundle::Dsl.new(Brewfile.read(global: global, file: file)) + @dsl ||= Bundle::Dsl.new(Brewfile.read(global:, file:)) @kept_casks = @dsl.entries.select { |e| e.type == :cask }.map(&:name) end @@ -135,14 +135,14 @@ def recursive_dependencies(current_formulae, formulae_names, top_level: true) IGNORED_TAPS = %w[homebrew/core homebrew/bundle].freeze def taps_to_untap(global: false, file: nil) - @dsl ||= Bundle::Dsl.new(Brewfile.read(global: global, file: file)) + @dsl ||= Bundle::Dsl.new(Brewfile.read(global:, file:)) kept_taps = @dsl.entries.select { |e| e.type == :tap }.map(&:name) current_taps = Bundle::TapDumper.tap_names current_taps - kept_taps - IGNORED_TAPS end def vscode_extensions_to_uninstall(global: false, file: nil) - @dsl ||= Bundle::Dsl.new(Brewfile.read(global: global, file: file)) + @dsl ||= Bundle::Dsl.new(Brewfile.read(global:, file:)) kept_extensions = @dsl.entries.select { |e| e.type == :vscode }.map { |x| x.name.downcase } # To provide a graceful migration from `Brewfile`s that don't yet or diff --git a/lib/bundle/commands/dump.rb b/lib/bundle/commands/dump.rb index 5ede365d5..1366c7209 100644 --- a/lib/bundle/commands/dump.rb +++ b/lib/bundle/commands/dump.rb @@ -9,9 +9,9 @@ def run(global: false, file: nil, describe: false, force: false, no_restart: fal all: false, taps: false, brews: false, casks: false, mas: false, whalebrew: false, vscode: false) Bundle::Dumper.dump_brewfile( - global: global, file: file, describe: describe, force: force, no_restart: no_restart, - all: all, taps: taps, brews: brews, casks: casks, - mas: mas, whalebrew: whalebrew, vscode: vscode + global:, file:, describe:, force:, no_restart:, + all:, taps:, brews:, casks:, + mas:, whalebrew:, vscode: ) end end diff --git a/lib/bundle/commands/exec.rb b/lib/bundle/commands/exec.rb index 392d5347b..ea24c8d0f 100644 --- a/lib/bundle/commands/exec.rb +++ b/lib/bundle/commands/exec.rb @@ -25,7 +25,7 @@ def run(*args, global: false, file: nil) command_path = command_path.dirname.to_s end - brewfile = Bundle::Dsl.new(Brewfile.read(global: global, file: file)) + brewfile = Bundle::Dsl.new(Brewfile.read(global:, file:)) require "formula" require "formulary" diff --git a/lib/bundle/commands/install.rb b/lib/bundle/commands/install.rb index 72d7370e6..558dfff33 100644 --- a/lib/bundle/commands/install.rb +++ b/lib/bundle/commands/install.rb @@ -6,10 +6,10 @@ module Install module_function def run(global: false, file: nil, no_lock: false, no_upgrade: false, verbose: false, force: false) - parsed_entries = Bundle::Dsl.new(Brewfile.read(global: global, file: file)).entries + parsed_entries = Bundle::Dsl.new(Brewfile.read(global:, file:)).entries Bundle::Installer.install( parsed_entries, - global: global, file: file, no_lock: no_lock, no_upgrade: no_upgrade, verbose: verbose, force: force, + global:, file:, no_lock:, no_upgrade:, verbose:, force:, ) || exit(1) end end diff --git a/lib/bundle/commands/list.rb b/lib/bundle/commands/list.rb index ce0cc4a45..d24c3144e 100644 --- a/lib/bundle/commands/list.rb +++ b/lib/bundle/commands/list.rb @@ -7,10 +7,10 @@ module List def run(global: false, file: nil, all: false, casks: false, taps: false, mas: false, whalebrew: false, vscode: false, brews: false) - parsed_entries = Bundle::Dsl.new(Brewfile.read(global: global, file: file)).entries + parsed_entries = Bundle::Dsl.new(Brewfile.read(global:, file:)).entries Bundle::Lister.list( parsed_entries, - all: all, casks: casks, taps: taps, mas: mas, whalebrew: whalebrew, vscode: vscode, brews: brews, + all:, casks:, taps:, mas:, whalebrew:, vscode:, brews:, ) end end diff --git a/lib/bundle/dsl.rb b/lib/bundle/dsl.rb index e21f2df2f..9cc190ab1 100644 --- a/lib/bundle/dsl.rb +++ b/lib/bundle/dsl.rb @@ -65,7 +65,7 @@ def mas(name, options = {}) raise "name(#{name.inspect}) should be a String object" unless name.is_a? String raise "options[:id](#{id}) should be an Integer object" unless id.is_a? Integer - @entries << Entry.new(:mas, name, id: id) + @entries << Entry.new(:mas, name, id:) end def whalebrew(name) diff --git a/lib/bundle/dumper.rb b/lib/bundle/dumper.rb index 72f88f469..da6cebc6e 100644 --- a/lib/bundle/dumper.rb +++ b/lib/bundle/dumper.rb @@ -19,8 +19,8 @@ def build_brewfile(describe: false, no_restart: false, all ||= !(taps || brews || casks || mas || whalebrew || vscode) content = [] content << TapDumper.dump if taps || all - content << BrewDumper.dump(describe: describe, no_restart: no_restart) if brews || all - content << CaskDumper.dump(describe: describe) if casks || all + content << BrewDumper.dump(describe:, no_restart:) if brews || all + content << CaskDumper.dump(describe:) if casks || all content << MacAppStoreDumper.dump if mas || all content << WhalebrewDumper.dump if whalebrew || all content << VscodeExtensionDumper.dump if vscode || all @@ -30,16 +30,16 @@ def build_brewfile(describe: false, no_restart: false, def dump_brewfile(global: false, file: nil, describe: false, force: false, no_restart: false, all: false, taps: false, brews: false, casks: false, mas: false, whalebrew: false, vscode: false) - path = brewfile_path(global: global, file: file) - can_write_to_brewfile?(path, force: force) - content = build_brewfile(describe: describe, no_restart: no_restart, - all: all, taps: taps, brews: brews, casks: casks, - mas: mas, whalebrew: whalebrew, vscode: vscode) + path = brewfile_path(global:, file:) + can_write_to_brewfile?(path, force:) + content = build_brewfile(describe:, no_restart:, + all:, taps:, brews:, casks:, + mas:, whalebrew:, vscode:) write_file path, content end def brewfile_path(global: false, file: nil) - Brewfile.path(dash_writes_to_stdout: true, global: global, file: file) + Brewfile.path(dash_writes_to_stdout: true, global:, file:) end def should_not_write_file?(file, overwrite: false) diff --git a/lib/bundle/installer.rb b/lib/bundle/installer.rb index 519e3895f..d50f1adb2 100644 --- a/lib/bundle/installer.rb +++ b/lib/bundle/installer.rb @@ -38,7 +38,7 @@ def install(entries, global: false, file: nil, no_lock: false, no_upgrade: false next if Bundle::Skipper.skip? entry - preinstall = if cls.preinstall(*args, **options, no_upgrade: no_upgrade, verbose: verbose) + preinstall = if cls.preinstall(*args, **options, no_upgrade:, verbose:) puts Formatter.success("#{verb} #{name}") true else @@ -47,7 +47,7 @@ def install(entries, global: false, file: nil, no_lock: false, no_upgrade: false end if cls.install(*args, **options, - preinstall: preinstall, no_upgrade: no_upgrade, verbose: verbose, force: force) + preinstall:, no_upgrade:, verbose:, force:) success += 1 else puts Formatter.error("#{verb} #{name} has failed!") @@ -58,13 +58,13 @@ def install(entries, global: false, file: nil, no_lock: false, no_upgrade: false unless failure.zero? puts Formatter.error "Homebrew Bundle failed! " \ "#{failure} Brewfile #{Bundle::Dsl.pluralize_dependency(failure)} failed to install." - if (lock = Bundle::Locker.lockfile(global: global, file: file)) && lock.exist? + if (lock = Bundle::Locker.lockfile(global:, file:)) && lock.exist? puts Formatter.error("Check for differences in your #{lock.basename}!") end return false end - Bundle::Locker.lock(entries, global: global, file: file, no_lock: no_lock) + Bundle::Locker.lock(entries, global:, file:, no_lock:) puts Formatter.success "Homebrew Bundle complete! " \ "#{success} Brewfile #{Bundle::Dsl.pluralize_dependency(success)} now installed." diff --git a/lib/bundle/lister.rb b/lib/bundle/lister.rb index e35f87e7f..2769f777e 100644 --- a/lib/bundle/lister.rb +++ b/lib/bundle/lister.rb @@ -7,8 +7,8 @@ module Lister def list(entries, all: false, casks: false, taps: false, mas: false, whalebrew: false, vscode: false, brews: false) entries.each do |entry| - if show?(entry.type, all: all, casks: casks, taps: taps, mas: mas, whalebrew: whalebrew, vscode: vscode, -brews: brews) + if show?(entry.type, all:, casks:, taps:, mas:, whalebrew:, vscode:, +brews:) puts entry.name end end diff --git a/lib/bundle/locker.rb b/lib/bundle/locker.rb index 1bd0608bc..dfcd7883d 100644 --- a/lib/bundle/locker.rb +++ b/lib/bundle/locker.rb @@ -10,7 +10,7 @@ module Locker module_function def lockfile(global: false, file: nil) - brew_file_path = Brewfile.path(global: global, file: file) + brew_file_path = Brewfile.path(global:, file:) lock_file_path = brew_file_path.dirname/"#{brew_file_path.basename}.lock.json" # no need to call realpath if the lockfile is not a symlink @@ -25,15 +25,15 @@ def write_lockfile?(global: false, file: nil, no_lock: false) return false if ENV["HOMEBREW_BUNDLE_NO_LOCK"] # handle the /dev/stdin and /dev/stdout cases - return false if lockfile(global: global, file: file).parent.to_s == "/dev" + return false if lockfile(global:, file:).parent.to_s == "/dev" true end def lock(entries, global: false, file: nil, no_lock: false) - return false unless write_lockfile?(global: global, file: file, no_lock: no_lock) + return false unless write_lockfile?(global:, file:, no_lock:) - lockfile = lockfile(global: global, file: file) + lockfile = lockfile(global:, file:) lock = JSON.parse(lockfile.read) if lockfile.exist? lock ||= {} @@ -131,8 +131,8 @@ def mas_list version = line.pop.delete("()") name = line.join(" ") name_id_versions[name] = { - id: id, - version: version, + id:, + version:, } end end diff --git a/lib/bundle/mac_app_store_checker.rb b/lib/bundle/mac_app_store_checker.rb index 96f8b7de9..b5d426f06 100644 --- a/lib/bundle/mac_app_store_checker.rb +++ b/lib/bundle/mac_app_store_checker.rb @@ -7,7 +7,7 @@ class MacAppStoreChecker < Bundle::Checker::Base PACKAGE_TYPE_NAME = "App" def installed_and_up_to_date?(id, no_upgrade: false) - Bundle::MacAppStoreInstaller.app_id_installed_and_up_to_date?(id, no_upgrade: no_upgrade) + Bundle::MacAppStoreInstaller.app_id_installed_and_up_to_date?(id, no_upgrade:) end def format_checkable(entries) @@ -16,15 +16,15 @@ def format_checkable(entries) def exit_early_check(app_ids_with_names, no_upgrade:) work_to_be_done = app_ids_with_names.find do |id, _name| - !installed_and_up_to_date?(id, no_upgrade: no_upgrade) + !installed_and_up_to_date?(id, no_upgrade:) end Array(work_to_be_done) end def full_check(app_ids_with_names, no_upgrade:) - app_ids_with_names.reject { |id, _name| installed_and_up_to_date?(id, no_upgrade: no_upgrade) } - .map { |_id, name| failure_reason(name, no_upgrade: no_upgrade) } + app_ids_with_names.reject { |id, _name| installed_and_up_to_date?(id, no_upgrade:) } + .map { |_id, name| failure_reason(name, no_upgrade:) } end end end diff --git a/lib/bundle/mac_app_store_installer.rb b/lib/bundle/mac_app_store_installer.rb index 6b4fea307..fba924f4e 100644 --- a/lib/bundle/mac_app_store_installer.rb +++ b/lib/bundle/mac_app_store_installer.rb @@ -14,7 +14,7 @@ def reset! def preinstall(name, id, no_upgrade: false, verbose: false) unless Bundle.mas_installed? puts "Installing mas. It is not currently installed." if verbose - Bundle.system HOMEBREW_BREW_FILE, "install", "mas", verbose: verbose + Bundle.system(HOMEBREW_BREW_FILE, "install", "mas", verbose:) raise "Unable to install #{name} app. mas installation failed." unless Bundle.mas_installed? end diff --git a/lib/bundle/tap_installer.rb b/lib/bundle/tap_installer.rb index e90cab30a..09ebef996 100644 --- a/lib/bundle/tap_installer.rb +++ b/lib/bundle/tap_installer.rb @@ -21,9 +21,9 @@ def install(name, preinstall: true, verbose: false, force: false, **options) args.append("--force-auto-update") if options[:force_auto_update] success = if options[:clone_target] - Bundle.system HOMEBREW_BREW_FILE, "tap", name, options[:clone_target], *args, verbose: verbose + Bundle.system(HOMEBREW_BREW_FILE, "tap", name, options[:clone_target], *args, verbose:) else - Bundle.system HOMEBREW_BREW_FILE, "tap", name, *args, verbose: verbose + Bundle.system(HOMEBREW_BREW_FILE, "tap", name, *args, verbose:) end unless success diff --git a/lib/bundle/vscode_extension_installer.rb b/lib/bundle/vscode_extension_installer.rb index 377fb6392..85150baa4 100644 --- a/lib/bundle/vscode_extension_installer.rb +++ b/lib/bundle/vscode_extension_installer.rb @@ -11,7 +11,7 @@ def reset! def preinstall(name, no_upgrade: false, verbose: false) if !Bundle.vscode_installed? && Bundle.cask_installed? puts "Installing visual-studio-code. It is not currently installed." if verbose - Bundle.system HOMEBREW_BREW_FILE, "install", "--cask", "visual-studio-code", verbose: verbose + Bundle.system HOMEBREW_BREW_FILE, "install", "--cask", "visual-studio-code", verbose: end if extension_installed?(name) diff --git a/lib/bundle/whalebrew_installer.rb b/lib/bundle/whalebrew_installer.rb index 0402d2395..123c7aad9 100644 --- a/lib/bundle/whalebrew_installer.rb +++ b/lib/bundle/whalebrew_installer.rb @@ -11,7 +11,7 @@ def reset! def preinstall(name, verbose: false, **_options) unless Bundle.whalebrew_installed? puts "Installing whalebrew. It is not currently installed." if verbose - Bundle.system HOMEBREW_BREW_FILE, "install", "--formula", "whalebrew", verbose: verbose + Bundle.system(HOMEBREW_BREW_FILE, "install", "--formula", "whalebrew", verbose:) raise "Unable to install #{name} app. Whalebrew installation failed." unless Bundle.whalebrew_installed? end diff --git a/spec/bundle/brew_dumper_spec.rb b/spec/bundle/brew_dumper_spec.rb index 76e8c56a6..5b9f5aafb 100644 --- a/spec/bundle/brew_dumper_spec.rb +++ b/spec/bundle/brew_dumper_spec.rb @@ -69,7 +69,7 @@ keg_only?: false, pinned?: true, outdated?: true, - linked_keg: linked_keg, + linked_keg:, stable: OpenStruct.new(bottle_defined?: true, bottled?: true), tap: OpenStruct.new(official?: true), bottle_hash: { diff --git a/spec/bundle/brew_installer_spec.rb b/spec/bundle/brew_installer_spec.rb index 9035b686c..12d4f687f 100644 --- a/spec/bundle/brew_installer_spec.rb +++ b/spec/bundle/brew_installer_spec.rb @@ -152,12 +152,12 @@ def expectations(verbose:) expect(Bundle).to receive(:system).with(HOMEBREW_BREW_FILE, "unlink", "mysql55", - verbose: verbose).and_return(true) + verbose:).and_return(true) expect(Bundle).to receive(:system).with(HOMEBREW_BREW_FILE, "unlink", "mysql56", - verbose: verbose).and_return(true) - expect(Bundle::BrewServices).to receive(:stop).with("mysql55", verbose: verbose).and_return(true) - expect(Bundle::BrewServices).to receive(:stop).with("mysql56", verbose: verbose).and_return(true) - expect(Bundle::BrewServices).to receive(:restart).with(formula, verbose: verbose).and_return(true) + verbose:).and_return(true) + expect(Bundle::BrewServices).to receive(:stop).with("mysql55", verbose:).and_return(true) + expect(Bundle::BrewServices).to receive(:stop).with("mysql56", verbose:).and_return(true) + expect(Bundle::BrewServices).to receive(:restart).with(formula, verbose:).and_return(true) end # These tests wrap expect() calls in `expectations` diff --git a/spec/bundle/brewfile_spec.rb b/spec/bundle/brewfile_spec.rb index 4f0fae0a0..824b2efc9 100644 --- a/spec/bundle/brewfile_spec.rb +++ b/spec/bundle/brewfile_spec.rb @@ -5,7 +5,7 @@ describe Bundle::Brewfile do describe "path" do subject(:path) do - described_class.path(dash_writes_to_stdout: dash_writes_to_stdout, global: has_global, file: file_value) + described_class.path(dash_writes_to_stdout:, global: has_global, file: file_value) end let(:dash_writes_to_stdout) { false } diff --git a/spec/bundle/commands/check_command_spec.rb b/spec/bundle/commands/check_command_spec.rb index 450293fde..121041534 100644 --- a/spec/bundle/commands/check_command_spec.rb +++ b/spec/bundle/commands/check_command_spec.rb @@ -4,7 +4,7 @@ describe Bundle::Commands::Check do let(:do_check) do - described_class.run(no_upgrade: no_upgrade, verbose: verbose) + described_class.run(no_upgrade:, verbose:) end let(:no_upgrade) { false } let(:verbose) { false }