diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml index c94b248a3b..3560552395 100644 --- a/Library/.rubocop.yml +++ b/Library/.rubocop.yml @@ -73,8 +73,8 @@ Metrics/CyclomaticComplexity: Enabled: false Metrics/LineLength: - # 124 is the goal as GitHub diff UI wraps beyond that - Max: 190 + # 118 is the goal as GitHub diff UI wraps beyond that + Max: 189 # ignore manpage comments and long single-line strings IgnoredPatterns: ['#: ', ' url "', ' mirror "', ' plist_options :'] diff --git a/Library/Homebrew/.rubocop.yml b/Library/Homebrew/.rubocop.yml index 43bf51dba0..05f4df0a8f 100644 --- a/Library/Homebrew/.rubocop.yml +++ b/Library/Homebrew/.rubocop.yml @@ -51,8 +51,8 @@ Metrics/CyclomaticComplexity: Max: 75 Metrics/LineLength: - # 124 is the goal as GitHub diff UI wraps beyond that - Max: 244 + # 118 is the goal as GitHub diff UI wraps beyond that + Max: 118 # ignore manpage comments IgnoredPatterns: ['#: '] diff --git a/Library/Homebrew/build_options.rb b/Library/Homebrew/build_options.rb index 8d9e349049..331a624e68 100644 --- a/Library/Homebrew/build_options.rb +++ b/Library/Homebrew/build_options.rb @@ -65,7 +65,8 @@ class BuildOptions include? "devel" end - # True if a {Formula} is being built with {Formula.stable} instead of {Formula.devel} or {Formula.head}. This is the default. + # True if a {Formula} is being built with {Formula.stable} instead of {Formula.devel} + # or {Formula.head}. This is the default. #
args << "--some-beta" if build.devel?
def stable? !(head? || devel?) diff --git a/Library/Homebrew/cask/lib/hbc/artifact/abstract_artifact.rb b/Library/Homebrew/cask/lib/hbc/artifact/abstract_artifact.rb index 0f3ceec626..80d925c879 100644 --- a/Library/Homebrew/cask/lib/hbc/artifact/abstract_artifact.rb +++ b/Library/Homebrew/cask/lib/hbc/artifact/abstract_artifact.rb @@ -72,7 +72,9 @@ module Hbc permitted_keys = [:args, :input, :executable, :must_succeed, :sudo, :print_stdout, :print_stderr] unknown_keys = arguments.keys - permitted_keys unless unknown_keys.empty? - opoo %Q{Unknown arguments to #{description} -- #{unknown_keys.inspect} (ignored). Running "brew update; brew cleanup" will likely fix it.} + opoo "Unknown arguments to #{description} -- " \ + "#{unknown_keys.inspect} (ignored). Running " \ + "\"brew update; brew cleanup\" will likely fix it." end arguments.select! { |k| permitted_keys.include?(k) } diff --git a/Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb b/Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb index c8abee5205..6e03d62a75 100644 --- a/Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb +++ b/Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb @@ -66,7 +66,8 @@ module Hbc def warn_for_unknown_directives(directives) unknown_keys = directives.keys - ORDERED_DIRECTIVES return if unknown_keys.empty? - opoo %Q(Unknown arguments to #{stanza} -- #{unknown_keys.inspect}. Running "brew update; brew cleanup" will likely fix it.) + opoo "Unknown arguments to #{stanza} -- #{unknown_keys.inspect}. " \ + "Running \"brew update; brew cleanup\" will likely fix it." end # Preserve prior functionality of script which runs first. Should rarely be needed. @@ -81,7 +82,11 @@ module Hbc services.each do |service| ohai "Removing launchctl service #{service}" [false, true].each do |with_sudo| - plist_status = command.run("/bin/launchctl", args: ["list", service], sudo: with_sudo, print_stderr: false).stdout + plist_status = command.run( + "/bin/launchctl", + args: ["list", service], + sudo: with_sudo, print_stderr: false + ).stdout if plist_status =~ /^\{/ command.run!("/bin/launchctl", args: ["remove", service], sudo: with_sudo) sleep 1 @@ -157,9 +162,14 @@ module Hbc def uninstall_login_item(*login_items, command: nil, **_) login_items.each do |name| ohai "Removing login item #{name}" - command.run!("/usr/bin/osascript", - args: ["-e", %Q(tell application "System Events" to delete every login item whose name is "#{name}")], - sudo: false) + command.run!( + "/usr/bin/osascript", + args: [ + "-e", + %Q(tell application "System Events" to delete every login item whose name is "#{name}"), + ], + sudo: false, + ) sleep 1 end end @@ -243,7 +253,12 @@ module Hbc ohai "Removing files:" each_resolved_path(:delete, paths) do |path, resolved_paths| puts path - command.run!("/usr/bin/xargs", args: ["-0", "--", "/bin/rm", "-r", "-f", "--"], input: resolved_paths.join("\0"), sudo: true) + command.run!( + "/usr/bin/xargs", + args: ["-0", "--", "/bin/rm", "-r", "-f", "--"], + input: resolved_paths.join("\0"), + sudo: true, + ) end end diff --git a/Library/Homebrew/cask/lib/hbc/artifact/installer.rb b/Library/Homebrew/cask/lib/hbc/artifact/installer.rb index 269e122f54..55102b1432 100644 --- a/Library/Homebrew/cask/lib/hbc/artifact/installer.rb +++ b/Library/Homebrew/cask/lib/hbc/artifact/installer.rb @@ -42,7 +42,13 @@ module Hbc path end - command.run!(executable, **args, env: { "PATH" => PATH.new(HOMEBREW_PREFIX/"bin", HOMEBREW_PREFIX/"sbin", ENV["PATH"]) }) + command.run!( + executable, + **args, + env: { "PATH" => PATH.new( + HOMEBREW_PREFIX/"bin", HOMEBREW_PREFIX/"sbin", ENV["PATH"] + ) }, + ) end end @@ -60,7 +66,10 @@ module Hbc end unless args.keys.count == 1 - raise CaskInvalidError.new(cask, "invalid 'installer' stanza: Only one of #{VALID_KEYS.inspect} is permitted.") + raise CaskInvalidError.new( + cask, + "invalid 'installer' stanza: Only one of #{VALID_KEYS.inspect} is permitted.", + ) end args.assert_valid_keys!(*VALID_KEYS) diff --git a/Library/Homebrew/cask/lib/hbc/artifact/moved.rb b/Library/Homebrew/cask/lib/hbc/artifact/moved.rb index 03d5768079..88323f7177 100644 --- a/Library/Homebrew/cask/lib/hbc/artifact/moved.rb +++ b/Library/Homebrew/cask/lib/hbc/artifact/moved.rb @@ -27,7 +27,8 @@ module Hbc def move(force: false, command: nil, **options) if Utils.path_occupied?(target) - message = "It seems there is already #{self.class.english_article} #{self.class.english_name} at '#{target}'" + message = "It seems there is already #{self.class.english_article} " \ + "#{self.class.english_name} at '#{target}'" raise CaskError, "#{message}." unless force opoo "#{message}; overwriting." delete(target, force: force, command: command, **options) @@ -51,7 +52,8 @@ module Hbc def move_back(skip: false, force: false, command: nil, **options) if Utils.path_occupied?(source) - message = "It seems there is already #{self.class.english_article} #{self.class.english_name} at '#{source}'" + message = "It seems there is already #{self.class.english_article} " \ + "#{self.class.english_name} at '#{source}'" raise CaskError, "#{message}." unless force opoo "#{message}; overwriting." delete(source, force: force, command: command, **options) diff --git a/Library/Homebrew/cask/lib/hbc/artifact/symlinked.rb b/Library/Homebrew/cask/lib/hbc/artifact/symlinked.rb index 3726ebb5c5..5146a8ddb7 100644 --- a/Library/Homebrew/cask/lib/hbc/artifact/symlinked.rb +++ b/Library/Homebrew/cask/lib/hbc/artifact/symlinked.rb @@ -37,11 +37,15 @@ module Hbc def link(**options) unless source.exist? - raise CaskError, "It seems the #{self.class.link_type_english_name.downcase} source '#{source}' is not there." + raise CaskError, + "It seems the #{self.class.link_type_english_name.downcase} " \ + "source '#{source}' is not there." end if target.exist? && !target.symlink? - raise CaskError, "It seems there is already #{self.class.english_article} #{self.class.english_name} at '#{target}'; not linking." + raise CaskError, + "It seems there is already #{self.class.english_article} " \ + "#{self.class.english_name} at '#{target}'; not linking." end ohai "Linking #{self.class.english_name} '#{source.basename}' to '#{target}'." diff --git a/Library/Homebrew/cask/lib/hbc/audit.rb b/Library/Homebrew/cask/lib/hbc/audit.rb index e15bab570c..99192ee1df 100644 --- a/Library/Homebrew/cask/lib/hbc/audit.rb +++ b/Library/Homebrew/cask/lib/hbc/audit.rb @@ -83,7 +83,12 @@ module Hbc add_warning "only a single preflight stanza is allowed" end - return unless cask.artifacts.count { |k| k.is_a?(Hbc::Artifact::PostflightBlock) && k.directives.key?(:postflight) } > 1 + count = cask.artifacts.count do |k| + k.is_a?(Hbc::Artifact::PostflightBlock) && + k.directives.key?(:postflight) + end + return unless count > 1 + add_warning "only a single postflight stanza is allowed" end @@ -94,11 +99,21 @@ module Hbc add_warning "only a single uninstall stanza is allowed" end - if cask.artifacts.count { |k| k.is_a?(Hbc::Artifact::PreflightBlock) && k.directives.key?(:uninstall_preflight) } > 1 + count = cask.artifacts.count do |k| + k.is_a?(Hbc::Artifact::PreflightBlock) && + k.directives.key?(:uninstall_preflight) + end + + if count > 1 add_warning "only a single uninstall_preflight stanza is allowed" end - if cask.artifacts.count { |k| k.is_a?(Hbc::Artifact::PostflightBlock) && k.directives.key?(:uninstall_postflight) } > 1 + count = cask.artifacts.count do |k| + k.is_a?(Hbc::Artifact::PostflightBlock) && + k.directives.key?(:uninstall_postflight) + end + + if count > 1 add_warning "only a single uninstall_postflight stanza is allowed" end diff --git a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb index 921d96d7de..184d3377d0 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb @@ -135,10 +135,14 @@ module Hbc def self.check_sip csrutil = "/usr/bin/csrutil" return "N/A" unless File.executable?(csrutil) - Open3.capture2(csrutil, "status")[0] - .gsub("This is an unsupported configuration, likely to break in the future and leave your machine in an unknown state.", "") + Open3.capture2(csrutil, "status") + .first + .gsub("This is an unsupported configuration, likely to break in " \ + "the future and leave your machine in an unknown state.", "") .gsub("System Integrity Protection status: ", "") - .delete("\t\.").capitalize.strip + .delete("\t\.") + .capitalize + .strip end def self.locale_variables diff --git a/Library/Homebrew/cask/lib/hbc/dsl.rb b/Library/Homebrew/cask/lib/hbc/dsl.rb index 65c41d4614..10255f497f 100644 --- a/Library/Homebrew/cask/lib/hbc/dsl.rb +++ b/Library/Homebrew/cask/lib/hbc/dsl.rb @@ -263,7 +263,8 @@ module Hbc ORDINARY_ARTIFACT_CLASSES.each do |klass| define_method(klass.dsl_key) do |*args| begin - if [*artifacts.map(&:class), klass].include?(Artifact::StageOnly) && (artifacts.map(&:class) & ACTIVATABLE_ARTIFACT_CLASSES).any? + if [*artifacts.map(&:class), klass].include?(Artifact::StageOnly) && + (artifacts.map(&:class) & ACTIVATABLE_ARTIFACT_CLASSES).any? raise CaskInvalidError.new(cask, "'stage_only' must be the only activatable artifact.") end diff --git a/Library/Homebrew/cask/lib/hbc/installer.rb b/Library/Homebrew/cask/lib/hbc/installer.rb index 51259ce7b0..2ecd0328a6 100644 --- a/Library/Homebrew/cask/lib/hbc/installer.rb +++ b/Library/Homebrew/cask/lib/hbc/installer.rb @@ -241,15 +241,23 @@ module Hbc if @cask.depends_on.macos.first.is_a?(Array) operator, release = @cask.depends_on.macos.first unless MacOS.version.send(operator, release) - raise CaskError, "Cask #{@cask} depends on macOS release #{operator} #{release}, but you are running release #{MacOS.version}." + raise CaskError, + "Cask #{@cask} depends on macOS release #{operator} #{release}, " \ + "but you are running release #{MacOS.version}." end elsif @cask.depends_on.macos.length > 1 unless @cask.depends_on.macos.include?(Gem::Version.new(MacOS.version.to_s)) - raise CaskError, "Cask #{@cask} depends on macOS release being one of [#{@cask.depends_on.macos.map(&:to_s).join(", ")}], but you are running release #{MacOS.version}." + raise CaskError, + "Cask #{@cask} depends on macOS release being one of " \ + "[#{@cask.depends_on.macos.map(&:to_s).join(", ")}], " \ + "but you are running release #{MacOS.version}." end else unless MacOS.version == @cask.depends_on.macos.first - raise CaskError, "Cask #{@cask} depends on macOS release #{@cask.depends_on.macos.first}, but you are running release #{MacOS.version}." + raise CaskError, + "Cask #{@cask} depends on macOS release " \ + "#{@cask.depends_on.macos.first}, " \ + "but you are running release #{MacOS.version}." end end end @@ -261,7 +269,10 @@ module Hbc arch[:type] == @current_arch[:type] && Array(arch[:bits]).include?(@current_arch[:bits]) end - raise CaskError, "Cask #{@cask} depends on hardware architecture being one of [#{@cask.depends_on.arch.map(&:to_s).join(", ")}], but you are running #{@current_arch}" + raise CaskError, + "Cask #{@cask} depends on hardware architecture being one of " \ + "[#{@cask.depends_on.arch.map(&:to_s).join(", ")}], " \ + "but you are running #{@current_arch}" end def x11_dependencies @@ -307,7 +318,13 @@ module Hbc ohai "Installing Cask dependencies: #{not_installed.map(&:to_s).join(", ")}" not_installed.each do |cask| - Installer.new(cask, binaries: binaries?, verbose: verbose?, installed_as_dependency: true, force: false).install + Installer.new( + cask, + binaries: binaries?, + verbose: verbose?, + installed_as_dependency: true, + force: false, + ).install end end @@ -349,23 +366,31 @@ module Hbc return unless @cask.accessibility_access ohai "Enabling accessibility access" if MacOS.version <= :mountain_lion - @command.run!("/usr/bin/touch", - args: [MacOS.pre_mavericks_accessibility_dotfile], - sudo: true) + @command.run!( + "/usr/bin/touch", + args: [MacOS.pre_mavericks_accessibility_dotfile], + sudo: true, + ) elsif MacOS.version <= :yosemite - @command.run!("/usr/bin/sqlite3", - args: [ - MacOS.tcc_db, - "INSERT OR REPLACE INTO access VALUES('kTCCServiceAccessibility','#{bundle_identifier}',0,1,1,NULL);", - ], - sudo: true) + @command.run!( + "/usr/bin/sqlite3", + args: [ + MacOS.tcc_db, + "INSERT OR REPLACE INTO access " \ + "VALUES('kTCCServiceAccessibility','#{bundle_identifier}',0,1,1,NULL);", + ], + sudo: true, + ) elsif MacOS.version <= :el_capitan - @command.run!("/usr/bin/sqlite3", - args: [ - MacOS.tcc_db, - "INSERT OR REPLACE INTO access VALUES('kTCCServiceAccessibility','#{bundle_identifier}',0,1,1,NULL,NULL);", - ], - sudo: true) + @command.run!( + "/usr/bin/sqlite3", + args: [ + MacOS.tcc_db, + "INSERT OR REPLACE INTO access " \ + "VALUES('kTCCServiceAccessibility','#{bundle_identifier}',0,1,1,NULL,NULL);", + ], + sudo: true, + ) else opoo <<~EOS Accessibility access cannot be enabled automatically on this version of macOS. diff --git a/Library/Homebrew/cask/lib/hbc/pkg.rb b/Library/Homebrew/cask/lib/hbc/pkg.rb index 8938268a29..5d91adb087 100644 --- a/Library/Homebrew/cask/lib/hbc/pkg.rb +++ b/Library/Homebrew/cask/lib/hbc/pkg.rb @@ -16,12 +16,26 @@ module Hbc def uninstall unless pkgutil_bom_files.empty? odebug "Deleting pkg files" - @command.run!("/usr/bin/xargs", args: ["-0", "--", "/bin/rm", "--"], input: pkgutil_bom_files.join("\0"), sudo: true) + @command.run!( + "/usr/bin/xargs", + args: [ + "-0", "--", "/bin/rm", "--" + ], + input: pkgutil_bom_files.join("\0"), + sudo: true, + ) end unless pkgutil_bom_specials.empty? odebug "Deleting pkg symlinks and special files" - @command.run!("/usr/bin/xargs", args: ["-0", "--", "/bin/rm", "--"], input: pkgutil_bom_specials.join("\0"), sudo: true) + @command.run!( + "/usr/bin/xargs", + args: [ + "-0", "--", "/bin/rm", "--" + ], + input: pkgutil_bom_specials.join("\0"), + sudo: true, + ) end unless pkgutil_bom_dirs.empty? diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb index 30d7eb0aa0..26a58a88e8 100644 --- a/Library/Homebrew/cmd/search.rb +++ b/Library/Homebrew/cmd/search.rb @@ -31,10 +31,14 @@ module Homebrew PACKAGE_MANAGERS = { macports: ->(query) { "https://www.macports.org/ports.php?by=name&substr=#{query}" }, fink: ->(query) { "http://pdb.finkproject.org/pdb/browse.php?summary=#{query}" }, - debian: ->(query) { "https://packages.debian.org/search?keywords=#{query}&searchon=names&suite=all§ion=all" }, opensuse: ->(query) { "https://software.opensuse.org/search?q=#{query}" }, fedora: ->(query) { "https://apps.fedoraproject.org/packages/s/#{query}" }, - ubuntu: ->(query) { "https://packages.ubuntu.com/search?keywords=#{query}&searchon=names&suite=all§ion=all" }, + debian: lambda { |query| + "https://packages.debian.org/search?keywords=#{query}&searchon=names&suite=all§ion=all" + }, + ubuntu: lambda { |query| + "https://packages.ubuntu.com/search?keywords=#{query}&searchon=names&suite=all§ion=all" + }, }.freeze def search(argv = ARGV) diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 9c5900d349..ce80021feb 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -399,7 +399,10 @@ module Homebrew if @new_formula && dep_f.keg_only_reason && !["openssl", "apr", "apr-util"].include?(dep.name) && dep_f.keg_only_reason.reason == :provided_by_macos - new_formula_problem "Dependency '#{dep.name}' may be unnecessary as it is provided by macOS; try to build this formula without it." + new_formula_problem( + "Dependency '#{dep.name}' may be unnecessary as it is provided " \ + "by macOS; try to build this formula without it.", + ) end dep.options.each do |opt| @@ -572,7 +575,10 @@ module Homebrew next if spec.patches.empty? next unless @new_formula - new_formula_problem "Formulae should not require patches to build. Patches should be submitted and accepted upstream first." + new_formula_problem( + "Formulae should not require patches to build. " \ + "Patches should be submitted and accepted upstream first.", + ) end %w[Stable Devel].each do |name| @@ -693,7 +699,11 @@ module Homebrew next unless spec = formula.send(spec_sym) next unless previous_version_and_checksum[spec_sym][:version] == spec.version next if previous_version_and_checksum[spec_sym][:checksum] == spec.checksum - problem "#{spec_sym}: sha256 changed without the version also changing; please create an issue upstream to rule out malicious circumstances and to find out why the file changed." + problem( + "#{spec_sym}: sha256 changed without the version also changing; " \ + "please create an issue upstream to rule out malicious " \ + "circumstances and to find out why the file changed.", + ) end attributes = [:revision, :version_scheme] @@ -795,7 +805,10 @@ module Homebrew # Prefer formula path shortcuts in Pathname+ if line =~ %r{\(\s*(prefix\s*\+\s*(['"])(bin|include|libexec|lib|sbin|share|Frameworks)[/'"])} - problem "\"(#{Regexp.last_match(1)}...#{Regexp.last_match(2)})\" should be \"(#{Regexp.last_match(3).downcase}+...)\"" + problem( + "\"(#{Regexp.last_match(1)}...#{Regexp.last_match(2)})\" should" \ + " be \"(#{Regexp.last_match(3).downcase}+...)\"", + ) end problem "Use separate make calls" if line.include?("make && make") diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index 3a8fb83ecf..7a2eaca733 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -178,48 +178,87 @@ module Homebrew replacement_pairs = [] if requested_spec == :stable && formula.revision.nonzero? - replacement_pairs << [/^ revision \d+\n(\n( head "))?/m, "\\2"] + replacement_pairs << [ + /^ revision \d+\n(\n( head "))?/m, + "\\2", + ] end replacement_pairs += formula_spec.mirrors.map do |mirror| - [/ +mirror \"#{Regexp.escape(mirror)}\"\n/m, ""] + [ + / +mirror \"#{Regexp.escape(mirror)}\"\n/m, + "", + ] end replacement_pairs += if new_url_hash [ - [/#{Regexp.escape(formula_spec.url)}/, new_url], - [old_hash, new_hash], + [ + /#{Regexp.escape(formula_spec.url)}/, + new_url, + ], + [ + old_hash, + new_hash, + ], ] else [ - [formula_spec.specs[:tag], new_tag], - [formula_spec.specs[:revision], new_revision], + [ + formula_spec.specs[:tag], + new_tag, + ], + [ + formula_spec.specs[:revision], + new_revision, + ], ] end backup_file = File.read(formula.path) unless args.dry_run? if new_mirror - replacement_pairs << [/^( +)(url \"#{Regexp.escape(new_url)}\"\n)/m, "\\1\\2\\1mirror \"#{new_mirror}\"\n"] + replacement_pairs << [ + /^( +)(url \"#{Regexp.escape(new_url)}\"\n)/m, + "\\1\\2\\1mirror \"#{new_mirror}\"\n", + ] end if forced_version && forced_version != "0" if requested_spec == :stable if File.read(formula.path).include?("version \"#{old_formula_version}\"") - replacement_pairs << [old_formula_version.to_s, forced_version] + replacement_pairs << [ + old_formula_version.to_s, + forced_version, + ] elsif new_mirror - replacement_pairs << [/^( +)(mirror \"#{new_mirror}\"\n)/m, "\\1\\2\\1version \"#{forced_version}\"\n"] + replacement_pairs << [ + /^( +)(mirror \"#{new_mirror}\"\n)/m, + "\\1\\2\\1version \"#{forced_version}\"\n", + ] else - replacement_pairs << [/^( +)(url \"#{new_url}\"\n)/m, "\\1\\2\\1version \"#{forced_version}\"\n"] + replacement_pairs << [ + /^( +)(url \"#{new_url}\"\n)/m, + "\\1\\2\\1version \"#{forced_version}\"\n", + ] end elsif requested_spec == :devel - replacement_pairs << [/( devel do.+?version \")#{old_formula_version}(\"\n.+?end\n)/m, "\\1#{forced_version}\\2"] + replacement_pairs << [ + /( devel do.+?version \")#{old_formula_version}(\"\n.+?end\n)/m, + "\\1#{forced_version}\\2", + ] end elsif forced_version && forced_version == "0" if requested_spec == :stable - replacement_pairs << [/^ version \"[\w\.\-\+]+\"\n/m, ""] + replacement_pairs << [ + /^ version \"[\w\.\-\+]+\"\n/m, + "", + ] elsif requested_spec == :devel - replacement_pairs << [/( devel do.+?)^ +version \"[^\n]+\"\n(.+?end\n)/m, "\\1\\2"] + replacement_pairs << [ + /( devel do.+?)^ +version \"[^\n]+\"\n(.+?end\n)/m, + "\\1\\2", + ] end end new_contents = inreplace_pairs(formula.path, replacement_pairs) @@ -270,7 +309,8 @@ module Homebrew ohai "fork repository with GitHub API" ohai "git fetch --unshallow origin" if shallow ohai "git checkout --no-track -b #{branch} origin/master" - ohai "git commit --no-edit --verbose --message='#{formula.name} #{new_formula_version}#{devel_message}' -- #{formula.path}" + ohai "git commit --no-edit --verbose --message='#{formula.name} " \ + "#{new_formula_version}#{devel_message}' -- #{formula.path}" ohai "git push --set-upstream $HUB_REMOTE #{branch}:#{branch}" ohai "create pull request with GitHub API" ohai "git checkout -" diff --git a/Library/Homebrew/dev-cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb index 2bae6f05ee..6417605509 100644 --- a/Library/Homebrew/dev-cmd/create.rb +++ b/Library/Homebrew/dev-cmd/create.rb @@ -79,7 +79,11 @@ module Homebrew # unless --force is specified. unless args.force? if reason = MissingFormula.blacklisted_reason(fc.name) - raise "#{fc.name} is blacklisted for creation.\n#{reason}\nIf you really want to create this formula use --force." + raise <<~EOS + #{fc.name} is blacklisted for creation. + #{reason} + If you really want to create this formula use --force. + EOS end if Formula.aliases.include? fc.name diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index 6156769e05..a6ee8058ca 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -66,18 +66,24 @@ module Homebrew variables[:commands] = path_glob_commands("#{HOMEBREW_LIBRARY_PATH}/cmd/*.{rb,sh}") variables[:developer_commands] = path_glob_commands("#{HOMEBREW_LIBRARY_PATH}/dev-cmd/*.{rb,sh}") readme = HOMEBREW_REPOSITORY/"README.md" - variables[:lead_maintainer] = readme.read[/(Homebrew's lead maintainer .*\.)/, 1] - .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') - variables[:leadership] = readme.read[/(Homebrew's project leadership committee .*\.)/, 1] - .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') - variables[:brew_maintainers] = readme.read[%r{(Homebrew/brew's other current maintainers .*\.)}, 1] - .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') - variables[:linux_maintainers] = readme.read[%r{(Homebrew/brew's Linux support \(and Linuxbrew\) maintainers are .*\.)}, 1] - .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') - variables[:core_maintainers] = readme.read[%r{(Homebrew/homebrew-core's other current maintainers .*\.)}, 1] - .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') - variables[:former_maintainers] = readme.read[/(Former maintainers .*\.)/, 1] - .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') + variables[:lead_maintainer] = + readme.read[/(Homebrew's lead maintainer .*\.)/, 1] + .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') + variables[:leadership] = + readme.read[/(Homebrew's project leadership committee .*\.)/, 1] + .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') + variables[:brew_maintainers] = + readme.read[%r{(Homebrew/brew's other current maintainers .*\.)}, 1] + .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') + variables[:linux_maintainers] = + readme.read[%r{(Homebrew/brew's Linux support \(and Linuxbrew\) maintainers are .*\.)}, 1] + .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') + variables[:core_maintainers] = + readme.read[%r{(Homebrew/homebrew-core's other current maintainers .*\.)}, 1] + .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') + variables[:former_maintainers] = + readme.read[/(Former maintainers .*\.)/, 1] + .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') variables[:homebrew_bundle] = help_output(:bundle) variables[:homebrew_services] = help_output(:services) diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 98f6d47981..87c1163889 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -1210,21 +1210,28 @@ class DownloadStrategyDetector case url when %r{^https?://github\.com/[^/]+/[^/]+\.git$} GitHubGitDownloadStrategy - when %r{^https?://.+\.git$}, %r{^git://} + when %r{^https?://.+\.git$}, + %r{^git://} GitDownloadStrategy - when %r{^https?://www\.apache\.org/dyn/closer\.cgi}, %r{^https?://www\.apache\.org/dyn/closer\.lua} + when %r{^https?://www\.apache\.org/dyn/closer\.cgi}, + %r{^https?://www\.apache\.org/dyn/closer\.lua} CurlApacheMirrorDownloadStrategy - when %r{^https?://(.+?\.)?googlecode\.com/svn}, %r{^https?://svn\.}, %r{^svn://}, %r{^https?://(.+?\.)?sourceforge\.net/svnroot/} + when %r{^https?://(.+?\.)?googlecode\.com/svn}, + %r{^https?://svn\.}, + %r{^svn://}, + %r{^https?://(.+?\.)?sourceforge\.net/svnroot/} SubversionDownloadStrategy when %r{^cvs://} CVSDownloadStrategy - when %r{^hg://}, %r{^https?://(.+?\.)?googlecode\.com/hg} + when %r{^hg://}, + %r{^https?://(.+?\.)?googlecode\.com/hg} MercurialDownloadStrategy when %r{^bzr://} BazaarDownloadStrategy when %r{^fossil://} FossilDownloadStrategy - when %r{^svn\+http://}, %r{^http://svn\.apache\.org/repos/} + when %r{^svn\+http://}, + %r{^http://svn\.apache\.org/repos/} SubversionDownloadStrategy when %r{^https?://(.+?\.)?sourceforge\.net/hgweb/} MercurialDownloadStrategy diff --git a/Library/Homebrew/extend/os/mac/system_config.rb b/Library/Homebrew/extend/os/mac/system_config.rb index ebfb442927..0b63b3434f 100644 --- a/Library/Homebrew/extend/os/mac/system_config.rb +++ b/Library/Homebrew/extend/os/mac/system_config.rb @@ -9,7 +9,9 @@ class SystemConfig java_xml = Utils.popen_read("/usr/libexec/java_home", "--xml", "--failfast", err: :close) return "N/A" unless $CHILD_STATUS.success? javas = [] - REXML::XPath.each(REXML::Document.new(java_xml), "//key[text()='JVMVersion']/following-sibling::string") do |item| + REXML::XPath.each( + REXML::Document.new(java_xml), "//key[text()='JVMVersion']/following-sibling::string" + ) do |item| javas << item.text end javas.uniq.join(", ") diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 0863f80647..c8aef3491f 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1073,7 +1073,8 @@ class Formula # file doesn't belong to any keg. else tab_tap = Tab.for_keg(keg).tap - return false if tab_tap.nil? # this keg doesn't below to any core/tap formula, most likely coming from a DIY install. + # this keg doesn't below to any core/tap formula, most likely coming from a DIY install. + return false if tab_tap.nil? begin Formulary.factory(keg.name) rescue FormulaUnavailableError # rubocop:disable Lint/HandleExceptions diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 85f7e0c5f5..cb03e5c9cc 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -186,7 +186,8 @@ class FormulaInstaller return if pinned_unsatisfied_deps.empty? raise CannotInstallFormulaError, - "You must `brew unpin #{pinned_unsatisfied_deps * " "}` as installing #{formula.full_name} requires the latest version of pinned dependencies" + "You must `brew unpin #{pinned_unsatisfied_deps * " "}` as installing " \ + "#{formula.full_name} requires the latest version of pinned dependencies" end def build_bottle_preinstall @@ -527,8 +528,9 @@ class FormulaInstaller if deps.empty? && only_deps? puts "All dependencies for #{formula.full_name} are satisfied." elsif !deps.empty? - oh1 "Installing dependencies for #{formula.full_name}: #{deps.map(&:first).map(&Formatter.method(:identifier)).join(", ")}", - truncate: false + oh1 "Installing dependencies for #{formula.full_name}: " \ + "#{deps.map(&:first).map(&Formatter.method(:identifier)).join(", ")}", + truncate: false deps.each { |dep, options| install_dependency(dep, options) } end diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb index 10fab11f4f..ce38bddd59 100644 --- a/Library/Homebrew/global.rb +++ b/Library/Homebrew/global.rb @@ -38,8 +38,11 @@ RUBY_PATH = Pathname.new(RbConfig.ruby) RUBY_BIN = RUBY_PATH.dirname HOMEBREW_USER_AGENT_CURL = ENV["HOMEBREW_USER_AGENT_CURL"] -HOMEBREW_USER_AGENT_RUBY = "#{ENV["HOMEBREW_USER_AGENT"]} ruby/#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}".freeze -HOMEBREW_USER_AGENT_FAKE_SAFARI = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8".freeze +HOMEBREW_USER_AGENT_RUBY = + "#{ENV["HOMEBREW_USER_AGENT"]} ruby/#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}".freeze +HOMEBREW_USER_AGENT_FAKE_SAFARI = + "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 " \ + "(KHTML, like Gecko) Version/10.0.3 Safari/602.4.8".freeze # Bintray fallback is here for people auto-updating from a version where # HOMEBREW_BOTTLE_DEFAULT_DOMAIN isn't set. diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index ea92f4d757..02164bed77 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -66,7 +66,9 @@ class Keg INFOFILE_RX = %r{info/([^.].*?\.info|dir)$} TOP_LEVEL_DIRECTORIES = %w[bin etc include lib sbin share var Frameworks].freeze ALL_TOP_LEVEL_DIRECTORIES = (TOP_LEVEL_DIRECTORIES + %w[lib/pkgconfig share/locale share/man opt]).freeze - PRUNEABLE_DIRECTORIES = %w[bin etc include lib sbin share opt Frameworks LinkedKegs var/homebrew/linked].map do |dir| + PRUNEABLE_DIRECTORIES = %w[ + bin etc include lib sbin share opt Frameworks LinkedKegs var/homebrew/linked + ].map do |dir| case dir when "LinkedKegs" HOMEBREW_LIBRARY/dir diff --git a/Library/Homebrew/language/python_virtualenv_constants.rb b/Library/Homebrew/language/python_virtualenv_constants.rb index fb961e95ff..a6bf86b2a0 100644 --- a/Library/Homebrew/language/python_virtualenv_constants.rb +++ b/Library/Homebrew/language/python_virtualenv_constants.rb @@ -1,2 +1,6 @@ -PYTHON_VIRTUALENV_URL = "https://files.pythonhosted.org/packages/33/bc/fa0b5347139cd9564f0d44ebd2b147ac97c36b2403943dbee8a25fd74012/virtualenv-16.0.0.tar.gz".freeze -PYTHON_VIRTUALENV_SHA256 = "ca07b4c0b54e14a91af9f34d0919790b016923d157afda5efdde55c96718f752".freeze +PYTHON_VIRTUALENV_URL = + "https://files.pythonhosted.org/packages/33/bc" \ + "/fa0b5347139cd9564f0d44ebd2b147ac97c36b2403943dbee8a25fd74012" \ + "/virtualenv-16.0.0.tar.gz".freeze +PYTHON_VIRTUALENV_SHA256 = + "ca07b4c0b54e14a91af9f34d0919790b016923d157afda5efdde55c96718f752".freeze diff --git a/Library/Homebrew/missing_formula.rb b/Library/Homebrew/missing_formula.rb index 9f5d063bae..3966088c1f 100644 --- a/Library/Homebrew/missing_formula.rb +++ b/Library/Homebrew/missing_formula.rb @@ -136,7 +136,9 @@ module Homebrew end end - log_command = "git log --since='1 month ago' --diff-filter=D --name-only --max-count=1 --format=%H\\\\n%h\\\\n%B -- #{relative_path}" + log_command = "git log --since='1 month ago' --diff-filter=D " \ + "--name-only --max-count=1 " \ + "--format=%H\\\\n%h\\\\n%B -- #{relative_path}" hash, short_hash, *commit_message, relative_path = Utils.popen_read(log_command).gsub("\\n", "\n").lines.map(&:chomp) diff --git a/Library/Homebrew/os/mac/xcode.rb b/Library/Homebrew/os/mac/xcode.rb index 7db1c10429..8f235cbc61 100644 --- a/Library/Homebrew/os/mac/xcode.rb +++ b/Library/Homebrew/os/mac/xcode.rb @@ -211,7 +211,8 @@ module OS EXECUTABLE_PKG_ID = "com.apple.pkg.CLTools_Executables".freeze MAVERICKS_NEW_PKG_ID = "com.apple.pkg.CLTools_Base".freeze # obsolete PKG_PATH = "/Library/Developer/CommandLineTools".freeze - HEADER_PKG_PATH = "/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_:macos_version.pkg".freeze + HEADER_PKG_PATH = + "/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_:macos_version.pkg".freeze HEADER_PKG_ID = "com.apple.pkg.macOS_SDK_headers_for_macOS_10.14".freeze # Returns true even if outdated tools are installed, e.g. diff --git a/Library/Homebrew/requirements/x11_requirement.rb b/Library/Homebrew/requirements/x11_requirement.rb index cc7a153e35..c2ab2944c9 100644 --- a/Library/Homebrew/requirements/x11_requirement.rb +++ b/Library/Homebrew/requirements/x11_requirement.rb @@ -40,7 +40,8 @@ class X11Requirement < Requirement end def message - "X11 is required to install this formula, either Xorg #{min_version} or xdpyinfo #{min_xdpyinfo_version}, or newer. #{super}" + "X11 is required to install this formula, either Xorg #{min_version} or " \ + "xdpyinfo #{min_xdpyinfo_version}, or newer. #{super}" end def <=>(other) diff --git a/Library/Homebrew/rubocops/class_cop.rb b/Library/Homebrew/rubocops/class_cop.rb index 89afda474a..1a41b7b252 100644 --- a/Library/Homebrew/rubocops/class_cop.rb +++ b/Library/Homebrew/rubocops/class_cop.rb @@ -46,9 +46,16 @@ module RuboCop lambda do |corrector| case node.type when :str, :dstr - corrector.replace(node.source_range, node.source.to_s.sub(%r{(/usr/local/(s?bin))}, '#{\2}')) + corrector.replace(node.source_range, + node.source.to_s.sub(%r{(/usr/local/(s?bin))}, + '#{\2}')) when :int - corrector.remove(range_with_surrounding_comma(range_with_surrounding_space(range: node.source_range, side: :left))) + corrector.remove( + range_with_surrounding_comma( + range_with_surrounding_space(range: node.source_range, + side: :left), + ), + ) end end end diff --git a/Library/Homebrew/rubocops/components_order_cop.rb b/Library/Homebrew/rubocops/components_order_cop.rb index 454aed790b..385d368375 100644 --- a/Library/Homebrew/rubocops/components_order_cop.rb +++ b/Library/Homebrew/rubocops/components_order_cop.rb @@ -71,7 +71,9 @@ module RuboCop # Method to format message for reporting component precedence violations def component_problem(c1, c2) return if WHITELIST.include?(@formula_name) - problem "`#{format_component(c1)}` (line #{line_number(c1)}) should be put before `#{format_component(c2)}` (line #{line_number(c2)})" + problem "`#{format_component(c1)}` (line #{line_number(c1)}) " \ + "should be put before `#{format_component(c2)}` " \ + "(line #{line_number(c2)})" end # autocorrect method gets called just after component_problem method call diff --git a/Library/Homebrew/rubocops/dependency_order_cop.rb b/Library/Homebrew/rubocops/dependency_order_cop.rb index 0a57aaeb78..ab30562532 100644 --- a/Library/Homebrew/rubocops/dependency_order_cop.rb +++ b/Library/Homebrew/rubocops/dependency_order_cop.rb @@ -142,7 +142,9 @@ module RuboCop def component_problem(c1, c2) offending_node(c1) - problem "dependency \"#{dependency_name(c1)}\" (line #{line_number(c1)}) should be put before dependency \"#{dependency_name(c2)}\" (line #{line_number(c2)})" + problem "dependency \"#{dependency_name(c1)}\" " \ + "(line #{line_number(c1)}) should be put before dependency "\ + "\"#{dependency_name(c2)}\" (line #{line_number(c2)})" end # Reorder two nodes in the source, using the corrector instance in autocorrect method diff --git a/Library/Homebrew/rubocops/homepage_cop.rb b/Library/Homebrew/rubocops/homepage_cop.rb index 16cc4f056a..1c07f2896b 100644 --- a/Library/Homebrew/rubocops/homepage_cop.rb +++ b/Library/Homebrew/rubocops/homepage_cop.rb @@ -58,7 +58,9 @@ module RuboCop # There's an auto-redirect here, but this mistake is incredibly common too. # Only applies to the homepage and subdomains for now, not the FTP URLs. - when %r{^http://((?:build|cloud|developer|download|extensions|git|glade|help|library|live|nagios|news|people|projects|rt|static|wiki|www)\.)?gnome\.org} + when %r{^http://((?:build|cloud|developer|download|extensions|git| + glade|help|library|live|nagios|news|people| + projects|rt|static|wiki|www)\.)?gnome\.org}x problem "Please use https:// for #{homepage}" # Compact the above into this list as we're able to remove detailed notations, etc over time. diff --git a/Library/Homebrew/rubocops/lines_cop.rb b/Library/Homebrew/rubocops/lines_cop.rb index 3f196073c9..6a17fd2fc6 100644 --- a/Library/Homebrew/rubocops/lines_cop.rb +++ b/Library/Homebrew/rubocops/lines_cop.rb @@ -27,7 +27,8 @@ module RuboCop begin_pos = start_column(parent_class_node) end_pos = end_column(class_node) return unless begin_pos-end_pos != 3 - problem "Use a space in class inheritance: class #{@formula_name.capitalize} < #{class_name(parent_class_node)}" + problem "Use a space in class inheritance: " \ + "class #{@formula_name.capitalize} < #{class_name(parent_class_node)}" end end @@ -112,7 +113,8 @@ module RuboCop find_instance_method_call(body_node, :build, :without?) do |method| arg = parameters(method).first next unless match = regex_match_group(arg, /^-?-?without-(.*)/) - problem "Don't duplicate 'without': Use `build.without? \"#{match[1]}\"` to check for \"--without-#{match[1]}\"" + problem "Don't duplicate 'without': " \ + "Use `build.without? \"#{match[1]}\"` to check for \"--without-#{match[1]}\"" end find_instance_method_call(body_node, :build, :with?) do |method| @@ -124,7 +126,8 @@ module RuboCop find_instance_method_call(body_node, :build, :include?) do |method| arg = parameters(method).first next unless match = regex_match_group(arg, /^with(out)?-(.*)/) - problem "Use build.with#{match[1]}? \"#{match[2]}\" instead of build.include? 'with#{match[1]}-#{match[2]}'" + problem "Use build.with#{match[1]}? \"#{match[2]}\" instead of " \ + "build.include? 'with#{match[1]}-#{match[2]}'" end find_instance_method_call(body_node, :build, :include?) do |method| @@ -345,7 +348,11 @@ module RuboCop problem "Dir([\"#{string_content(path)}\"]) is unnecessary; just use \"#{match[0]}\"" end - fileutils_methods = Regexp.new(FileUtils.singleton_methods(false).map { |m| "(?-mix:^" + Regexp.escape(m) + "$)" }.join("|")) + fileutils_methods = Regexp.new( + FileUtils.singleton_methods(false) + .map { |m| "(?-mix:^" + Regexp.escape(m) + "$)" } + .join("|"), + ) find_every_method_call_by_name(body_node, :system).each do |method| param = parameters(method).first next unless match = regex_match_group(param, fileutils_methods) diff --git a/Library/Homebrew/rubocops/patches_cop.rb b/Library/Homebrew/rubocops/patches_cop.rb index 43f106d3d4..338fcf2355 100644 --- a/Library/Homebrew/rubocops/patches_cop.rb +++ b/Library/Homebrew/rubocops/patches_cop.rb @@ -48,7 +48,8 @@ module RuboCop end end - gh_patch_diff_pattern = %r{https?://patch-diff\.githubusercontent\.com/raw/(.+)/(.+)/pull/(.+)\.(?:diff|patch)} + gh_patch_diff_pattern = + %r{https?://patch-diff\.githubusercontent\.com/raw/(.+)/(.+)/pull/(.+)\.(?:diff|patch)} if match_obj = regex_match_group(patch, gh_patch_diff_pattern) problem <<~EOS use GitHub pull request URLs: diff --git a/Library/Homebrew/style.rb b/Library/Homebrew/style.rb index 5e3534f0e0..8490edf005 100644 --- a/Library/Homebrew/style.rb +++ b/Library/Homebrew/style.rb @@ -92,7 +92,9 @@ module Homebrew system(cache_env, "rubocop", "_#{HOMEBREW_RUBOCOP_VERSION}_", *args) !$CHILD_STATUS.success? when :json - json, err, status = Open3.capture3(cache_env, "rubocop", "_#{HOMEBREW_RUBOCOP_VERSION}_", "--format", "json", *args) + json, err, status = + Open3.capture3(cache_env, "rubocop", "_#{HOMEBREW_RUBOCOP_VERSION}_", + "--format", "json", *args) # exit status of 1 just means violations were found; other numbers mean # execution errors. # exitstatus can also be nil if RuboCop process crashes, e.g. due to @@ -148,7 +150,8 @@ module Homebrew def to_s(options = {}) if options[:display_cop_name] - "#{severity_code}: #{location.to_short_s}: #{cop_name}: #{Tty.green}#{correction_status}#{Tty.reset}#{message}" + "#{severity_code}: #{location.to_short_s}: #{cop_name}: " \ + "#{Tty.green}#{correction_status}#{Tty.reset}#{message}" else "#{severity_code}: #{location.to_short_s}: #{Tty.green}#{correction_status}#{Tty.reset}#{message}" end diff --git a/Library/Homebrew/test/cask/accessibility_spec.rb b/Library/Homebrew/test/cask/accessibility_spec.rb index 2ba7d2a8ae..7f4a943ec5 100644 --- a/Library/Homebrew/test/cask/accessibility_spec.rb +++ b/Library/Homebrew/test/cask/accessibility_spec.rb @@ -26,7 +26,9 @@ describe "Accessibility Access", :cask do it "warns about disabling accessibility access on old macOS releases" do expect { installer.disable_accessibility_access - }.to output(/Warning: Accessibility access cannot be disabled automatically on this version of macOS\./).to_stderr + }.to output( + /Warning: Accessibility access cannot be disabled automatically on this version of macOS\./, + ).to_stderr end end @@ -36,7 +38,10 @@ describe "Accessibility Access", :cask do it "can enable accessibility access" do expect(fake_system_command).to receive(:run!).with( "/usr/bin/sqlite3", - args: [MacOS.tcc_db, "INSERT OR REPLACE INTO access VALUES('kTCCServiceAccessibility','com.example.BasicCask',0,1,1,NULL);"], + args: [ + MacOS.tcc_db, + "INSERT OR REPLACE INTO access VALUES('kTCCServiceAccessibility','com.example.BasicCask',0,1,1,NULL);", + ], sudo: true, ) @@ -62,13 +67,17 @@ describe "Accessibility Access", :cask do expect { installer.enable_accessibility_access }.to output.to_stdout - }.to output(/Warning: Accessibility access cannot be enabled automatically on this version of macOS\./).to_stderr + }.to output( + /Warning: Accessibility access cannot be enabled automatically on this version of macOS\./, + ).to_stderr end it "warns about disabling accessibility access on new macOS releases" do expect { installer.disable_accessibility_access - }.to output(/Warning: Accessibility access cannot be disabled automatically on this version of macOS\./).to_stderr + }.to output( + /Warning: Accessibility access cannot be disabled automatically on this version of macOS\./, + ).to_stderr end end end diff --git a/Library/Homebrew/test/cask/artifact/app_spec.rb b/Library/Homebrew/test/cask/artifact/app_spec.rb index f0b27b378a..8d036eaf51 100644 --- a/Library/Homebrew/test/cask/artifact/app_spec.rb +++ b/Library/Homebrew/test/cask/artifact/app_spec.rb @@ -63,7 +63,10 @@ describe Hbc::Artifact::App, :cask do end it "avoids clobbering an existing app" do - expect { install_phase }.to raise_error(Hbc::CaskError, "It seems there is already an App at '#{target_path}'.") + expect { install_phase }.to raise_error( + Hbc::CaskError, + "It seems there is already an App at '#{target_path}'.", + ) expect(source_path).to be_a_directory expect(target_path).to be_a_directory @@ -110,12 +113,21 @@ describe Hbc::Artifact::App, :cask do end it "overwrites the existing app" do - expect(command).to receive(:run).with("/bin/chmod", args: ["-R", "--", "u+rwx", target_path], must_succeed: false) - .and_call_original - expect(command).to receive(:run).with("/bin/chmod", args: ["-R", "-N", target_path], must_succeed: false) - .and_call_original - expect(command).to receive(:run).with("/usr/bin/chflags", args: ["-R", "--", "000", target_path], must_succeed: false) - .and_call_original + expect(command).to receive(:run).with( + "/bin/chmod", args: [ + "-R", "--", "u+rwx", target_path + ], must_succeed: false + ).and_call_original + expect(command).to receive(:run).with( + "/bin/chmod", args: [ + "-R", "-N", target_path + ], must_succeed: false + ).and_call_original + expect(command).to receive(:run).with( + "/usr/bin/chflags", args: [ + "-R", "--", "000", target_path + ], must_succeed: false + ).and_call_original stdout = <<~EOS ==> Removing App '#{target_path}'. @@ -154,7 +166,9 @@ describe Hbc::Artifact::App, :cask do end it "leaves the target alone" do - expect { install_phase }.to raise_error(Hbc::CaskError, "It seems there is already an App at '#{target_path}'.") + expect { install_phase }.to raise_error( + Hbc::CaskError, "It seems there is already an App at '#{target_path}'." + ) expect(target_path).to be_a_symlink end diff --git a/Library/Homebrew/test/cask/artifact/pkg_spec.rb b/Library/Homebrew/test/cask/artifact/pkg_spec.rb index 4605eeaf81..7a660600d1 100644 --- a/Library/Homebrew/test/cask/artifact/pkg_spec.rb +++ b/Library/Homebrew/test/cask/artifact/pkg_spec.rb @@ -57,7 +57,11 @@ describe Hbc::Artifact::Pkg, :cask do expect(fake_system_command).to receive(:run!).with( "/usr/sbin/installer", - args: ["-pkg", cask.staged_path.join("MyFancyPkg", "Fancy.pkg"), "-target", "/", "-applyChoiceChangesXML", cask.staged_path.join("/tmp/choices.xml")], + args: [ + "-pkg", cask.staged_path.join("MyFancyPkg", "Fancy.pkg"), + "-target", "/", "-applyChoiceChangesXML", + cask.staged_path.join("/tmp/choices.xml") + ], sudo: true, print_stdout: true, env: { diff --git a/Library/Homebrew/test/cask/cask_spec.rb b/Library/Homebrew/test/cask/cask_spec.rb index 7c0c0c97d3..dec3f37496 100644 --- a/Library/Homebrew/test/cask/cask_spec.rb +++ b/Library/Homebrew/test/cask/cask_spec.rb @@ -130,7 +130,8 @@ describe Hbc::Cask, :cask do shared_examples ":latest cask" do |greedy, tap_version, expectations| expectations.each do |installed_version, expected_output| - context "when versions #{installed_version} are installed and the tap version is #{tap_version}, #{greedy ? "" : "not"} greedy" do + context "when versions #{installed_version} are installed and the " \ + "tap version is #{tap_version}, #{"not" unless greedy} greedy" do subject { cask.outdated_versions greedy } it { diff --git a/Library/Homebrew/test/cask/cli/install_spec.rb b/Library/Homebrew/test/cask/cli/install_spec.rb index cc5450c79c..4d3cc87164 100644 --- a/Library/Homebrew/test/cask/cli/install_spec.rb +++ b/Library/Homebrew/test/cask/cli/install_spec.rb @@ -68,12 +68,20 @@ describe Hbc::CLI::Install, :cask do it "returns a suggestion for a misspelled Cask" do expect { described_class.run("localcaffeine") - }.to raise_error(Hbc::CaskUnavailableError, /Cask 'localcaffeine' is unavailable: No Cask with this name exists\. Did you mean “local-caffeine”?/) + }.to raise_error( + Hbc::CaskUnavailableError, + "Cask 'localcaffeine' is unavailable: No Cask with this name exists. "\ + "Did you mean “local-caffeine”?", + ) end it "returns multiple suggestions for a Cask fragment" do expect { described_class.run("local") - }.to raise_error(Hbc::CaskUnavailableError, /Cask 'local' is unavailable: No Cask with this name exists\. Did you mean one of these\?\nlocal-caffeine\nlocal-transmission/) + }.to raise_error( + Hbc::CaskUnavailableError, + "Cask 'local' is unavailable: No Cask with this name exists. " \ + "Did you mean one of these?\nlocal-caffeine\nlocal-transmission\n", + ) end end diff --git a/Library/Homebrew/test/cask/cli/style_spec.rb b/Library/Homebrew/test/cask/cli/style_spec.rb index 8e6655bde5..b04886bd9b 100644 --- a/Library/Homebrew/test/cask/cli/style_spec.rb +++ b/Library/Homebrew/test/cask/cli/style_spec.rb @@ -61,7 +61,10 @@ describe Hbc::CLI::Style, :cask do end specify "`rubocop-cask` supports `HOMEBREW_RUBOCOP_VERSION`", :needs_network do - stdout, status = Open3.capture2("gem", "dependency", "rubocop-cask", "--version", HOMEBREW_RUBOCOP_CASK_VERSION, "--pipe", "--remote") + stdout, status = Open3.capture2( + "gem", "dependency", "rubocop-cask", + "--version", HOMEBREW_RUBOCOP_CASK_VERSION, "--pipe", "--remote" + ) expect(status).to be_a_success @@ -89,7 +92,10 @@ describe Hbc::CLI::Style, :cask do end end - it { is_expected.to contain_exactly(a_path_ending_with("/homebrew/homebrew-cask/Casks"), a_path_ending_with("/third-party/homebrew-tap/Casks")) } + it { + is_expected.to contain_exactly(a_path_ending_with("/homebrew/homebrew-cask/Casks"), + a_path_ending_with("/third-party/homebrew-tap/Casks")) + } end context "when at least one cask token is a path that exists" do diff --git a/Library/Homebrew/test/cask/cli/uninstall_spec.rb b/Library/Homebrew/test/cask/cli/uninstall_spec.rb index 5a34706e9b..45fb600c3c 100644 --- a/Library/Homebrew/test/cask/cli/uninstall_spec.rb +++ b/Library/Homebrew/test/cask/cli/uninstall_spec.rb @@ -144,7 +144,9 @@ describe Hbc::CLI::Uninstall, :cask do describe "when Casks in Taps have been renamed or removed" do let(:app) { Hbc::Config.global.appdir.join("ive-been-renamed.app") } let(:caskroom_path) { Hbc::Caskroom.path.join("ive-been-renamed").tap(&:mkpath) } - let(:saved_caskfile) { caskroom_path.join(".metadata", "latest", "timestamp", "Casks").join("ive-been-renamed.rb") } + let(:saved_caskfile) { + caskroom_path.join(".metadata", "latest", "timestamp", "Casks").join("ive-been-renamed.rb") + } before do app.tap(&:mkpath) diff --git a/Library/Homebrew/test/cask/cli/zap_spec.rb b/Library/Homebrew/test/cask/cli/zap_spec.rb index 308c832695..0440f04b3c 100644 --- a/Library/Homebrew/test/cask/cli/zap_spec.rb +++ b/Library/Homebrew/test/cask/cli/zap_spec.rb @@ -27,28 +27,4 @@ describe Hbc::CLI::Zap, :cask do expect(transmission).not_to be_installed expect(Hbc::Config.global.appdir.join("Transmission.app")).not_to be_a_symlink end - - # TODO: Explicit test that both zap and uninstall directives get dispatched. - # The above tests that implicitly. - # - # it "dispatches both uninstall and zap stanzas" do - # with_zap = Hbc::CaskLoader.load('with-zap') - # - # Hbc::Installer.new(with_zap).install - # - # with_zap.must_be :installed? - # - # FakeSystemCommand.stubs_command(['/usr/bin/sudo', '-E', '--', '/usr/bin/osascript', '-e', 'tell application "System Events" to count processes whose bundle identifier is "my.fancy.package.app"'], '1') - # FakeSystemCommand.stubs_command(['/usr/bin/sudo', '-E', '--', '/usr/bin/osascript', '-e', 'tell application id "my.fancy.package.app" to quit']) - # FakeSystemCommand.stubs_command(['/usr/bin/sudo', '-E', '--', '/usr/bin/osascript', '-e', 'tell application "System Events" to count processes whose bundle identifier is "my.fancy.package.app.from.uninstall"'], '1') - # FakeSystemCommand.stubs_command(['/usr/bin/sudo', '-E', '--', '/usr/bin/osascript', '-e', 'tell application id "my.fancy.package.app.from.uninstall" to quit']) - # - # FakeSystemCommand.expects_command(['/usr/bin/sudo', '-E', '--', with_zap.staged_path.join('MyFancyPkg','FancyUninstaller.tool'), '--please']) - # FakeSystemCommand.expects_command(['/usr/bin/sudo', '-E', '--', '/bin/rm', '-rf', '--', - # Pathname.new('~/Library/Preferences/my.fancy.app.plist').expand_path]) - # - # Hbc::CLI::Zap.run('with-zap') - # - # with_zap.wont_be :installed? - # end end diff --git a/Library/Homebrew/test/cask/depends_on_spec.rb b/Library/Homebrew/test/cask/depends_on_spec.rb index 85279f96c7..230daafb5d 100644 --- a/Library/Homebrew/test/cask/depends_on_spec.rb +++ b/Library/Homebrew/test/cask/depends_on_spec.rb @@ -12,8 +12,11 @@ describe "Satisfy Dependencies and Requirements", :cask do let(:cask) { Hbc::CaskLoader.load(cask_path("with-depends-on-cask-cyclic")) } it { - is_expected.to raise_error(Hbc::CaskCyclicDependencyError, - "Cask 'with-depends-on-cask-cyclic' includes cyclic dependencies on other Casks: with-depends-on-cask-cyclic-helper") + is_expected.to raise_error( + Hbc::CaskCyclicDependencyError, + "Cask 'with-depends-on-cask-cyclic' includes cyclic dependencies "\ + "on other Casks: with-depends-on-cask-cyclic-helper", + ) } end diff --git a/Library/Homebrew/test/cask/installer_spec.rb b/Library/Homebrew/test/cask/installer_spec.rb index ab25dde2a3..4ec69e7932 100644 --- a/Library/Homebrew/test/cask/installer_spec.rb +++ b/Library/Homebrew/test/cask/installer_spec.rb @@ -110,7 +110,19 @@ describe Hbc::Installer, :cask do expect { Hbc::Installer.new(with_installer_manual).install - }.to output(/To complete the installation of Cask with-installer-manual, you must also\nrun the installer at\n\n '#{with_installer_manual.staged_path.join('Caffeine.app')}'/).to_stdout + }.to output( + <<~EOS + ==> Satisfying dependencies + ==> Downloading file:#{HOMEBREW_LIBRARY_PATH}/test/support/fixtures/cask/caffeine.zip + ==> Verifying checksum for Cask with-installer-manual + ==> Installing Cask with-installer-manual + To complete the installation of Cask with-installer-manual, you must also + run the installer at + + '#{with_installer_manual.staged_path.join("Caffeine.app")}' + 🍺 with-installer-manual was successfully installed! + EOS + ).to_stdout expect(with_installer_manual).to be_installed end @@ -227,7 +239,8 @@ describe Hbc::Installer, :cask do expect(Hbc::Caskroom.path.join("local-caffeine", caffeine.version)).to be_a_directory expect(Hbc::Caskroom.path.join("local-caffeine", mutated_version)).not_to be_a_directory - FileUtils.mv(Hbc::Caskroom.path.join("local-caffeine", caffeine.version), Hbc::Caskroom.path.join("local-caffeine", mutated_version)) + FileUtils.mv(Hbc::Caskroom.path.join("local-caffeine", caffeine.version), + Hbc::Caskroom.path.join("local-caffeine", mutated_version)) expect(Hbc::Caskroom.path.join("local-caffeine", caffeine.version)).not_to be_a_directory expect(Hbc::Caskroom.path.join("local-caffeine", mutated_version)).to be_a_directory diff --git a/Library/Homebrew/test/cask/pkg_spec.rb b/Library/Homebrew/test/cask/pkg_spec.rb index 6871514dda..47257812a1 100644 --- a/Library/Homebrew/test/cask/pkg_spec.rb +++ b/Library/Homebrew/test/cask/pkg_spec.rb @@ -57,7 +57,9 @@ describe Hbc::Pkg, :cask do it "removes broken symlinks" do fake_root = mktmpdir fake_dir = mktmpdir - fake_file = fake_dir.join("ima_file").tap { |path| FileUtils.touch(path) } + fake_file = fake_dir.join("ima_file").tap do |path| + FileUtils.touch(path) + end intact_symlink = fake_dir.join("intact_symlink").tap { |path| path.make_symlink(fake_file) } broken_symlink = fake_dir.join("broken_symlink").tap { |path| path.make_symlink("im_nota_file") } diff --git a/Library/Homebrew/test/download_strategies_spec.rb b/Library/Homebrew/test/download_strategies_spec.rb index f654f17692..012370b70e 100644 --- a/Library/Homebrew/test/download_strategies_spec.rb +++ b/Library/Homebrew/test/download_strategies_spec.rb @@ -234,13 +234,21 @@ describe CurlDownloadStrategy do subject { described_class.new(url, name, version, **specs).cached_location } context "when URL ends with file" do - it { is_expected.to eq(HOMEBREW_CACHE/"downloads/3d1c0ae7da22be9d83fb1eb774df96b7c4da71d3cf07e1cb28555cf9a5e5af70--foo.tar.gz") } + it { + is_expected.to eq( + HOMEBREW_CACHE/"downloads/3d1c0ae7da22be9d83fb1eb774df96b7c4da71d3cf07e1cb28555cf9a5e5af70--foo.tar.gz", + ) + } end context "when URL file is in middle" do let(:url) { "https://example.com/foo.tar.gz/from/this/mirror" } - it { is_expected.to eq(HOMEBREW_CACHE/"downloads/1ab61269ba52c83994510b1e28dd04167a2f2e8393a35a9c50c1f7d33fd8f619--foo.tar.gz") } + it { + is_expected.to eq( + HOMEBREW_CACHE/"downloads/1ab61269ba52c83994510b1e28dd04167a2f2e8393a35a9c50c1f7d33fd8f619--foo.tar.gz", + ) + } end end @@ -282,7 +290,12 @@ describe CurlDownloadStrategy do it "adds the appropriate curl args" do expect(subject).to receive(:system_command!) { |*, args:, **| - expect(args.each_cons(2).to_a).to include(["--user-agent", a_string_matching(/Mozilla.*Mac OS X 10.*AppleWebKit/)]) + expect(args.each_cons(2).to_a).to include( + [ + "--user-agent", + a_string_matching(/Mozilla.*Mac OS X 10.*AppleWebKit/), + ], + ) } subject.fetch @@ -505,8 +518,8 @@ describe SubversionDownloadStrategy do it "adds the appropriate svn args" do expect(subject).to receive(:system_command!) - .with("svn", args: array_including("--trust-server-cert", "--non-interactive")) - + .with("svn", args: array_including("--trust-server-cert", + "--non-interactive")) subject.fetch end end diff --git a/Library/Homebrew/test/rubocops/urls_cop_spec.rb b/Library/Homebrew/test/rubocops/urls_cop_spec.rb index 514f895132..5664b93ccb 100644 --- a/Library/Homebrew/test/rubocops/urls_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/urls_cop_spec.rb @@ -19,15 +19,18 @@ describe RuboCop::Cop::FormulaAudit::Urls do "col" => 2, }, { "url" => "http://search.mcpan.org/CPAN/authors/id/Z/ZE/ZEFRAM/Perl4-CoreLibs-0.003.tar.gz", - "msg" => "http://search.mcpan.org/CPAN/authors/id/Z/ZE/ZEFRAM/Perl4-CoreLibs-0.003.tar.gz should be `https://cpan.metacpan.org/authors/id/Z/ZE/ZEFRAM/Perl4-CoreLibs-0.003.tar.gz`", + "msg" => "http://search.mcpan.org/CPAN/authors/id/Z/ZE/ZEFRAM/Perl4-CoreLibs-0.003.tar.gz should be " \ + "`https://cpan.metacpan.org/authors/id/Z/ZE/ZEFRAM/Perl4-CoreLibs-0.003.tar.gz`", "col" => 2, }, { "url" => "http://ftp.gnome.org/pub/GNOME/binaries/mac/banshee/banshee-2.macosx.intel.dmg", - "msg" => "http://ftp.gnome.org/pub/GNOME/binaries/mac/banshee/banshee-2.macosx.intel.dmg should be `https://download.gnome.org/binaries/mac/banshee/banshee-2.macosx.intel.dmg`", + "msg" => "http://ftp.gnome.org/pub/GNOME/binaries/mac/banshee/banshee-2.macosx.intel.dmg should be " \ + "`https://download.gnome.org/binaries/mac/banshee/banshee-2.macosx.intel.dmg`", "col" => 2, }, { "url" => "git://anonscm.debian.org/users/foo/foostrap.git", - "msg" => "git://anonscm.debian.org/users/foo/foostrap.git should be `https://anonscm.debian.org/git/users/foo/foostrap.git`", + "msg" => "git://anonscm.debian.org/users/foo/foostrap.git should be " \ + "`https://anonscm.debian.org/git/users/foo/foostrap.git`", "col" => 2, }, { "url" => "ftp://ftp.mirrorservice.org/foo-1.tar.gz", @@ -39,15 +42,18 @@ describe RuboCop::Cop::FormulaAudit::Urls do "col" => 2, }, { "url" => "http://sourceforge.net/projects/something/files/Something-1.2.3.dmg", - "msg" => "Use https://downloads.sourceforge.net to get geolocation (url is http://sourceforge.net/projects/something/files/Something-1.2.3.dmg).", + "msg" => "Use https://downloads.sourceforge.net to get geolocation (url is " \ + "http://sourceforge.net/projects/something/files/Something-1.2.3.dmg).", "col" => 2, }, { "url" => "https://downloads.sourceforge.net/project/foo/download", - "msg" => "Don't use /download in SourceForge urls (url is https://downloads.sourceforge.net/project/foo/download).", + "msg" => "Don't use /download in SourceForge urls (url is " \ + "https://downloads.sourceforge.net/project/foo/download).", "col" => 2, }, { "url" => "https://sourceforge.net/project/foo", - "msg" => "Use https://downloads.sourceforge.net to get geolocation (url is https://sourceforge.net/project/foo).", + "msg" => "Use https://downloads.sourceforge.net to get geolocation " \ + "(url is https://sourceforge.net/project/foo).", "col" => 2, }, { "url" => "http://prdownloads.sourceforge.net/foo/foo-1.tar.gz", @@ -58,7 +64,8 @@ describe RuboCop::Cop::FormulaAudit::Urls do "col" => 2, }, { "url" => "http://foo.dl.sourceforge.net/sourceforge/foozip/foozip_1.0.tar.bz2", - "msg" => "Don't use specific dl mirrors in SourceForge urls (url is http://foo.dl.sourceforge.net/sourceforge/foozip/foozip_1.0.tar.bz2).", + "msg" => "Don't use specific dl mirrors in SourceForge urls (url is " \ + "http://foo.dl.sourceforge.net/sourceforge/foozip/foozip_1.0.tar.bz2).", "col" => 2, }, { "url" => "http://downloads.sourceforge.net/project/foo/foo/2/foo-2.zip", @@ -107,7 +114,8 @@ describe RuboCop::Cop::FormulaAudit::Urls do "col" => 2, }, { "url" => "https://central.maven.org/maven2/com/bar/foo/1.1/foo-1.1.jar", - "msg" => "https://central.maven.org/maven2/com/bar/foo/1.1/foo-1.1.jar should be `https://search.maven.org/remotecontent?filepath=com/bar/foo/1.1/foo-1.1.jar`", + "msg" => "https://central.maven.org/maven2/com/bar/foo/1.1/foo-1.1.jar should be " \ + "`https://search.maven.org/remotecontent?filepath=com/bar/foo/1.1/foo-1.1.jar`", "col" => 2, }] formulas.each do |formula| diff --git a/Library/Homebrew/test/system_command_spec.rb b/Library/Homebrew/test/system_command_spec.rb index 118499c0d6..f77b992795 100644 --- a/Library/Homebrew/test/system_command_spec.rb +++ b/Library/Homebrew/test/system_command_spec.rb @@ -223,9 +223,15 @@ describe SystemCommand do it 'does not format `stderr` when it starts with \r' do expect { - system_command "bash", - args: ["-c", 'printf "\r%s" "################### 27.6%" 1>&2'] - }.to output("\r################### 27.6%").to_stderr + system_command \ + "bash", + args: [ + "-c", + 'printf "\r%s" "################### 27.6%" 1>&2', + ] + }.to output( \ + "\r################### 27.6%", + ).to_stderr end context "when given an executable with spaces and no arguments" do diff --git a/Library/Homebrew/test/tab_spec.rb b/Library/Homebrew/test/tab_spec.rb index acbac36cc1..216a4532f2 100644 --- a/Library/Homebrew/test/tab_spec.rb +++ b/Library/Homebrew/test/tab_spec.rb @@ -243,7 +243,10 @@ describe Tab do end it "raises a parse exception message including the Tab filename" do - expect { described_class.from_file_content("''", "receipt.json") }.to raise_error(JSON::ParserError, /receipt.json:/) + expect { described_class.from_file_content("''", "receipt.json") }.to raise_error( + JSON::ParserError, + /receipt.json:/, + ) end end diff --git a/Library/Homebrew/test/tap_spec.rb b/Library/Homebrew/test/tap_spec.rb index 635008a2f4..63f4125d5c 100644 --- a/Library/Homebrew/test/tap_spec.rb +++ b/Library/Homebrew/test/tap_spec.rb @@ -214,7 +214,9 @@ describe Tap do touch subject.path/".git/shallow" expect(already_tapped_tap).to be_installed wrong_remote = "#{subject.remote}-oops" - expect { already_tapped_tap.install clone_target: wrong_remote, full_clone: true }.to raise_error(TapRemoteMismatchError) + expect { + already_tapped_tap.install clone_target: wrong_remote, full_clone: true + }.to raise_error(TapRemoteMismatchError) end it "raises an error when the Tap is already unshallow" do diff --git a/Library/Homebrew/test/update_migrator_spec.rb b/Library/Homebrew/test/update_migrator_spec.rb index 811d035e1e..211932fd6b 100644 --- a/Library/Homebrew/test/update_migrator_spec.rb +++ b/Library/Homebrew/test/update_migrator_spec.rb @@ -54,7 +54,9 @@ describe UpdateMigrator do } let(:old_cache_file) { HOMEBREW_CACHE/"#{formula_name}--1.2.3.tar.gz" } let(:new_cache_symlink) { HOMEBREW_CACHE/"#{formula_name}--1.2.3.tar.gz" } - let(:new_cache_file) { HOMEBREW_CACHE/"downloads/5994e3a27baa3f448a001fb071ab1f0bf25c87aebcb254d91a6d0b02f46eef86--foo-1.2.3.tar.gz" } + let(:new_cache_file) { + HOMEBREW_CACHE/"downloads/5994e3a27baa3f448a001fb071ab1f0bf25c87aebcb254d91a6d0b02f46eef86--foo-1.2.3.tar.gz" + } before(:each) do old_cache_file.dirname.mkpath diff --git a/Library/Homebrew/test/utils_spec.rb b/Library/Homebrew/test/utils_spec.rb index fa3409479a..63a6833a3c 100644 --- a/Library/Homebrew/test/utils_spec.rb +++ b/Library/Homebrew/test/utils_spec.rb @@ -261,7 +261,10 @@ describe "globally-scoped helper methods" do caller: ["#{HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core/"], disable: true ) - }.to raise_error(MethodDeprecatedError, %r{method.*replacement.*homebrew/core.*\/Taps\/homebrew\/homebrew-core\/}m) + }.to raise_error( + MethodDeprecatedError, + %r{method.*replacement.*homebrew/core.*\/Taps\/homebrew\/homebrew-core\/}m, + ) end end diff --git a/Library/Homebrew/test/version_spec.rb b/Library/Homebrew/test/version_spec.rb index d18dd48d05..900b61344c 100644 --- a/Library/Homebrew/test/version_spec.rb +++ b/Library/Homebrew/test/version_spec.rb @@ -312,7 +312,10 @@ describe Version do specify "elasticsearch alpha style" do expect(described_class.create("5.0.0-alpha5")) - .to be_detected_from("https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/5.0.0-alpha5/elasticsearch-5.0.0-alpha5.tar.gz") + .to be_detected_from( + "https://download.elastic.co/elasticsearch/release/org/elasticsearch" \ + "/distribution/tar/elasticsearch/5.0.0-alpha5/elasticsearch-5.0.0-alpha5.tar.gz", + ) end specify "gloox beta style" do @@ -480,7 +483,9 @@ describe Version do expect(described_class.create("2.074.0-rc1")) .to be_detected_from("https://github.com/dlang/dmd/archive/v2.074.0-rc1.tar.gz") expect(described_class.create("5.0.0-alpha10")) - .to be_detected_from("https://github.com/premake/premake-core/releases/download/v5.0.0-alpha10/premake-5.0.0-alpha10-src.zip") + .to be_detected_from( + "https://github.com/premake/premake-core/releases/download/v5.0.0-alpha10/premake-5.0.0-alpha10-src.zip", + ) end specify "jenkins version style" do @@ -512,14 +517,21 @@ describe Version do expect(described_class.create("9.2")) .to be_detected_from("https://cdn.nuxeo.com/nuxeo-9.2/nuxeo-server-9.2-tomcat.zip") expect(described_class.create("0.181")) - .to be_detected_from("https://search.maven.org/remotecontent?filepath=com/facebook/presto/presto-cli/0.181/presto-cli-0.181-executable.jar") + .to be_detected_from( + "https://search.maven.org/remotecontent?filepath=" \ + "com/facebook/presto/presto-cli/0.181/presto-cli-0.181-executable.jar", + ) expect(described_class.create("1.2.3")) - .to be_detected_from("https://search.maven.org/remotecontent?filepath=org/apache/orc/orc-tools/1.2.3/orc-tools-1.2.3-uber.jar") + .to be_detected_from( + "https://search.maven.org/remotecontent?filepath=org/apache/orc/orc-tools/1.2.3/orc-tools-1.2.3-uber.jar", + ) end specify "apache version style" do expect(described_class.create("1.2.0-rc2")) - .to be_detected_from("https://www.apache.org/dyn/closer.cgi?path=/cassandra/1.2.0/apache-cassandra-1.2.0-rc2-bin.tar.gz") + .to be_detected_from( + "https://www.apache.org/dyn/closer.cgi?path=/cassandra/1.2.0/apache-cassandra-1.2.0-rc2-bin.tar.gz", + ) end specify "jpeg version style" do @@ -556,7 +568,9 @@ describe Version do specify "cmucl version style" do expect(described_class.create("20c")) - .to be_detected_from("https://common-lisp.net/project/cmucl/downloads/release/20c/cmucl-20c-x86-darwin.tar.bz2") + .to be_detected_from( + "https://common-lisp.net/project/cmucl/downloads/release/20c/cmucl-20c-x86-darwin.tar.bz2", + ) end specify "fann version style" do @@ -581,7 +595,9 @@ describe Version do specify "suite3270 version style" do expect(described_class.create("3.3.12ga7")) - .to be_detected_from("https://downloads.sourceforge.net/project/x3270/x3270/3.3.12ga7/suite3270-3.3.12ga7-src.tgz") + .to be_detected_from( + "https://downloads.sourceforge.net/project/x3270/x3270/3.3.12ga7/suite3270-3.3.12ga7-src.tgz", + ) end specify "wwwoffle version style" do @@ -596,12 +612,17 @@ describe Version do specify "fontforge version style" do expect(described_class.create("20120731")) - .to be_detected_from("https://downloads.sourceforge.net/project/fontforge/fontforge-source/fontforge_full-20120731-b.tar.bz2") + .to be_detected_from( + "https://downloads.sourceforge.net/project/fontforge/fontforge-source/fontforge_full-20120731-b.tar.bz2", + ) end specify "ezlupdate version style" do expect(described_class.create("2011.10")) - .to be_detected_from("https://github.com/downloads/ezsystems/ezpublish-legacy/ezpublish_community_project-2011.10-with_ezc.tar.bz2") + .to be_detected_from( + "https://github.com/downloads/ezsystems" \ + "/ezpublish-legacy/ezpublish_community_project-2011.10-with_ezc.tar.bz2", + ) end specify "aespipe version style" do diff --git a/Library/Homebrew/unpack_strategy/dmg.rb b/Library/Homebrew/unpack_strategy/dmg.rb index 8348324cb1..b47d7453da 100644 --- a/Library/Homebrew/unpack_strategy/dmg.rb +++ b/Library/Homebrew/unpack_strategy/dmg.rb @@ -124,11 +124,16 @@ module UnpackStrategy Dir.mktmpdir do |mount_dir| mount_dir = Pathname(mount_dir) - without_eula = system_command "hdiutil", - args: ["attach", "-plist", "-nobrowse", "-readonly", "-noidme", "-mountrandom", mount_dir, path], - input: "qn\n", - print_stderr: false, - verbose: verbose + without_eula = system_command( + "hdiutil", + args: [ + "attach", "-plist", "-nobrowse", "-readonly", "-noidme", + "-mountrandom", mount_dir, path + ], + input: "qn\n", + print_stderr: false, + verbose: verbose, + ) # If mounting without agreeing to EULA succeeded, there is none. plist = if without_eula.success? @@ -136,13 +141,22 @@ module UnpackStrategy else cdr_path = mount_dir/path.basename.sub_ext(".cdr") - system_command! "hdiutil", - args: ["convert", "-quiet", "-format", "UDTO", "-o", cdr_path, path], - verbose: verbose + system_command!( + "hdiutil", + args: [ + "convert", "-quiet", "-format", "UDTO", "-o", cdr_path, path + ], + verbose: verbose, + ) - with_eula = system_command! "hdiutil", - args: ["attach", "-plist", "-nobrowse", "-readonly", "-noidme", "-mountrandom", mount_dir, cdr_path], - verbose: verbose + with_eula = system_command!( + "hdiutil", + args: [ + "attach", "-plist", "-nobrowse", "-readonly", "-noidme", + "-mountrandom", mount_dir, cdr_path + ], + verbose: verbose, + ) if verbose && !(eula_text = without_eula.stdout).empty? ohai "Software License Agreement for '#{path}':" diff --git a/Library/Homebrew/unpack_strategy/generic_unar.rb b/Library/Homebrew/unpack_strategy/generic_unar.rb index 6a1403b533..9833635cbb 100644 --- a/Library/Homebrew/unpack_strategy/generic_unar.rb +++ b/Library/Homebrew/unpack_strategy/generic_unar.rb @@ -20,7 +20,10 @@ module UnpackStrategy def extract_to_dir(unpack_dir, basename:, verbose:) system_command! "unar", - args: ["-force-overwrite", "-quiet", "-no-directory", "-output-directory", unpack_dir, "--", path], + args: [ + "-force-overwrite", "-quiet", "-no-directory", + "-output-directory", unpack_dir, "--", path + ], env: { "PATH" => PATH.new(Formula["unar"].opt_bin, ENV["PATH"]) }, verbose: verbose end diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index bcb051c9e8..e697b8f38f 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -9,7 +9,9 @@ module GitHub CREATE_GIST_SCOPES = ["gist"].freeze CREATE_ISSUE_FORK_OR_PR_SCOPES = ["public_repo"].freeze ALL_SCOPES = (CREATE_GIST_SCOPES + CREATE_ISSUE_FORK_OR_PR_SCOPES).freeze - ALL_SCOPES_URL = Formatter.url("https://github.com/settings/tokens/new?scopes=#{ALL_SCOPES.join(",")}&description=Homebrew").freeze + ALL_SCOPES_URL = Formatter.url( + "https://github.com/settings/tokens/new?scopes=#{ALL_SCOPES.join(",")}&description=Homebrew", + ).freeze PR_ENV_KEY = "HOMEBREW_NEW_FORMULA_PULL_REQUEST_URL".freeze PR_ENV = ENV[PR_ENV_KEY]