diff --git a/Library/Homebrew/Gemfile.lock b/Library/Homebrew/Gemfile.lock index c46299e0bd..230c6e45b0 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -80,7 +80,7 @@ GEM rspec-support (3.8.2) rspec-wait (0.0.9) rspec (>= 3, < 4) - rubocop (0.72.0) + rubocop (0.73.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.6) diff --git a/Library/Homebrew/cask/cmd/info.rb b/Library/Homebrew/cask/cmd/info.rb index bfe4840703..a09291bce0 100644 --- a/Library/Homebrew/cask/cmd/info.rb +++ b/Library/Homebrew/cask/cmd/info.rb @@ -59,23 +59,19 @@ module Cask end def self.installation_info(cask) + return "Not installed\n" unless cask.installed? + install_info = +"" - if cask.installed? - cask.versions.each do |version| - versioned_staged_path = cask.caskroom_path.join(version) - install_info << versioned_staged_path.to_s - .concat(" (") - .concat( - if versioned_staged_path.exist? - then versioned_staged_path.abv - else Formatter.error("does not exist") - end, - ).concat(")\n") + cask.versions.each do |version| + versioned_staged_path = cask.caskroom_path.join(version) + path_details = if versioned_staged_path.exist? + versioned_staged_path.abv + else + Formatter.error("does not exist") end - install_info.freeze - else - "Not installed\n" + install_info << "#{versioned_staged_path} (#{path_details})\n" end + install_info.freeze end def self.name_info(cask) diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 467959f213..ac8225741f 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -66,13 +66,13 @@ class AbstractDownloadStrategy def chdir entries = Dir["*"] - case entries.length - when 0 then raise "Empty archive" - when 1 then begin - Dir.chdir entries.first - rescue - nil - end + raise "Empty archive" if entries.length.zero? + return if entries.length != 1 + + begin + Dir.chdir entries.first + rescue + nil end end private :chdir