aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/artifact
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
parent6d8ee395fa5878282a1ce3975b632103448be042 (diff)
downloadbrew-75e8b59aad4814112a53119f68ed629d60b3f97b.tar.bz2
Add `Formatter` module.
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/artifact')
-rw-r--r--Library/Homebrew/cask/lib/hbc/artifact/moved.rb6
-rw-r--r--Library/Homebrew/cask/lib/hbc/artifact/symlinked.rb15
2 files changed, 12 insertions, 9 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/artifact/moved.rb b/Library/Homebrew/cask/lib/hbc/artifact/moved.rb
index ff6e5f273..22124005c 100644
--- a/Library/Homebrew/cask/lib/hbc/artifact/moved.rb
+++ b/Library/Homebrew/cask/lib/hbc/artifact/moved.rb
@@ -79,12 +79,10 @@ module Hbc
load_specification artifact_spec
if target.exist?
- target_abv = " (#{target.abv})"
+ "#{printable_target} (#{target.abv})"
else
- error = "#{Tty.red}Missing #{self.class.artifact_english_name}:#{Tty.reset} "
+ Formatter.error(printable_target, label: "Missing #{self.class.artifact_english_name}")
end
-
- "#{error}#{printable_target}#{target_abv}"
end
end
end
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