print_caveats and get_info return heredocs

This commit is contained in:
Zach Auten 2019-02-24 21:53:04 -05:00
parent ed80b60834
commit 330ae8c6fa
2 changed files with 18 additions and 14 deletions

View File

@ -27,14 +27,12 @@ module Cask
end end
def self.get_info(cask) def self.get_info(cask)
"#{title_info(cask)}\n"\ <<~EOS.chomp
"#{Formatter.url(cask.homepage) if cask.homepage}\n"\ #{title_info(cask)}
"#{installation_info(cask)}\n"\ #{Formatter.url(cask.homepage) if cask.homepage}
"#{repo_info(cask)}"\ #{installation_info(cask)}
"#{name_info(cask)}"\ #{repo_info(cask)}#{name_info(cask)}#{language_info(cask)}#{artifact_info(cask)}#{Installer.print_caveats(cask)}
"#{language_info(cask)}"\ EOS
"#{artifact_info(cask)}"\
"#{Installer.print_caveats(cask)}"\
end end
def self.info(cask) def self.info(cask)
@ -58,8 +56,12 @@ module Cask
versioned_staged_path = cask.caskroom_path.join(version) versioned_staged_path = cask.caskroom_path.join(version)
install_info << versioned_staged_path.to_s install_info << versioned_staged_path.to_s
.concat(" (") .concat(" (")
.concat(versioned_staged_path.exist? ? versioned_staged_path.abv : Formatter.error("does not exist")) .concat(
.concat(")") if versioned_staged_path.exist?
then versioned_staged_path.abv
else Formatter.error("does not exist")
end,
).concat(")")
install_info << "\n" install_info << "\n"
end end
return install_info.strip return install_info.strip

View File

@ -49,8 +49,10 @@ module Cask
caveats = cask.caveats caveats = cask.caveats
return if caveats.empty? return if caveats.empty?
"#{ohai_title "Caveats"}\n"\ <<~EOS
"#{caveats}\n" #{ohai_title "Caveats"}
#{caveats}
EOS
end end
def fetch def fetch