From 92311901c9d85e0e43147386535118b66ca718cd Mon Sep 17 00:00:00 2001 From: Adam Smith Date: Wed, 27 Sep 2017 00:17:47 -0700 Subject: add available languages to cask info command add language tests for dsl add fixtures, tests for languages info output add extra lines --- Library/Homebrew/cask/lib/hbc/cli/info.rb | 8 ++++++++ Library/Homebrew/cask/lib/hbc/dsl.rb | 7 +++++++ 2 files changed, 15 insertions(+) (limited to 'Library/Homebrew/cask/lib') diff --git a/Library/Homebrew/cask/lib/hbc/cli/info.rb b/Library/Homebrew/cask/lib/hbc/cli/info.rb index 9cdada62e..2b4db9530 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/info.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/info.rb @@ -23,6 +23,7 @@ module Hbc installation_info(cask) repo_info(cask) name_info(cask) + language_info(cask) artifact_info(cask) Installer.print_caveats(cask) end @@ -51,6 +52,13 @@ module Hbc puts cask.name.empty? ? Formatter.error("None") : cask.name end + def self.language_info(cask) + return if cask.languages.empty? + + ohai "Languages" + puts cask.languages.join(", ") + end + def self.repo_info(cask) user, repo, token = QualifiedToken.parse(Hbc.all_tokens.detect { |t| t.split("/").last == cask.token }) diff --git a/Library/Homebrew/cask/lib/hbc/dsl.rb b/Library/Homebrew/cask/lib/hbc/dsl.rb index 3824b9761..3822c532c 100644 --- a/Library/Homebrew/cask/lib/hbc/dsl.rb +++ b/Library/Homebrew/cask/lib/hbc/dsl.rb @@ -63,6 +63,7 @@ module Hbc :gpg, :homepage, :language, + :languages, :name, :sha256, :staged_path, @@ -139,6 +140,12 @@ module Hbc @language = @language_blocks.default.call end + def languages + return [] if @language_blocks.nil? + + @language_blocks.keys.flatten + end + def url(*args, &block) set_unique_stanza(:url, args.empty? && !block_given?) do begin -- cgit v1.2.3