aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/artifact/symlinked.rb
diff options
context:
space:
mode:
authorMarkus Reiter2016-08-30 21:38:13 +0200
committerMarkus Reiter2016-10-01 20:00:49 +0200
commit75e8b59aad4814112a53119f68ed629d60b3f97b (patch)
treeadca80e4cbeb07c208d9ea1b7b203bec653fb815 /Library/Homebrew/cask/lib/hbc/artifact/symlinked.rb
parent6d8ee395fa5878282a1ce3975b632103448be042 (diff)
downloadbrew-75e8b59aad4814112a53119f68ed629d60b3f97b.tar.bz2
Add `Formatter` module.
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/artifact/symlinked.rb')
-rw-r--r--Library/Homebrew/cask/lib/hbc/artifact/symlinked.rb15
1 files changed, 10 insertions, 5 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/artifact/symlinked.rb b/Library/Homebrew/cask/lib/hbc/artifact/symlinked.rb
index 3ab45cccc..46dd42322 100644
--- a/Library/Homebrew/cask/lib/hbc/artifact/symlinked.rb
+++ b/Library/Homebrew/cask/lib/hbc/artifact/symlinked.rb
@@ -57,12 +57,17 @@ module Hbc
def summarize_artifact(artifact_spec)
load_specification artifact_spec
- return unless self.class.islink?(target)
-
- link_description = "#{Tty.red}Broken Link#{Tty.reset}: " unless target.exist?
- target_readlink_abv = " (#{target.readlink.abv})" if target.readlink.exist?
+ if self.class.islink?(target) && target.exist? && target.readlink.exist?
+ "#{printable_target} -> #{target.readlink} (#{target.readlink.abv})"
+ else
+ string = if self.class.islink?(target)
+ "#{printable_target} -> #{target.readlink}"
+ else
+ printable_target
+ end
- "#{link_description}#{printable_target} -> #{target.readlink}#{target_readlink_abv}"
+ Formatter.error(string, label: "Broken Link")
+ end
end
end
end