cask/cmd/info: fix brew style, refactor.

This commit is contained in:
Mike McQuaid 2019-07-16 21:10:21 +01:00
parent f96afdbf41
commit 12a0c281ea
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70

View File

@ -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)