From b837d6c552a417533e2fc684bd9f69af644c287f Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Wed, 29 Oct 2014 10:53:49 -0400 Subject: [PATCH] remove support for `link` artifact * `app`, `suite`, and `artifact no longer implemented as synonyms for `link` * backward-compatible code/comments removed * creates class `Cask::Artifact::Suite` * updates `brew cask info` to show specific artifact type * fixes stray "Generic artifact" messages --- lib/cask/artifact.rb | 1 + lib/cask/artifact/app.rb | 4 ---- lib/cask/artifact/artifact.rb | 15 ++------------- lib/cask/artifact/suite.rb | 9 +++++++++ lib/cask/cli/internal_stanza.rb | 6 ++++-- lib/cask/dsl.rb | 4 ---- lib/cask/staged.rb | 2 +- test/cask/cli/info_test.rb | 10 +++++----- test/cask/dsl_test.rb | 4 ++-- 9 files changed, 24 insertions(+), 31 deletions(-) create mode 100644 lib/cask/artifact/suite.rb diff --git a/lib/cask/artifact.rb b/lib/cask/artifact.rb index 97e921c18..dec0437d8 100644 --- a/lib/cask/artifact.rb +++ b/lib/cask/artifact.rb @@ -19,6 +19,7 @@ require 'cask/artifact/prefpane' require 'cask/artifact/qlplugin' require 'cask/artifact/widget' require 'cask/artifact/service' +require 'cask/artifact/suite' require 'cask/artifact/caskroom_only' require 'cask/artifact/input_method' require 'cask/artifact/internet_plugin' diff --git a/lib/cask/artifact/app.rb b/lib/cask/artifact/app.rb index c1eba6cda..01effd5ec 100644 --- a/lib/cask/artifact/app.rb +++ b/lib/cask/artifact/app.rb @@ -1,6 +1,2 @@ class Cask::Artifact::App < Cask::Artifact::Symlinked - # todo remove this backward compatibility override - def self.artifact_dsl_key - :link - end end diff --git a/lib/cask/artifact/artifact.rb b/lib/cask/artifact/artifact.rb index 2ad9b726c..40d2c2225 100644 --- a/lib/cask/artifact/artifact.rb +++ b/lib/cask/artifact/artifact.rb @@ -1,20 +1,9 @@ class Cask::Artifact::Artifact < Cask::Artifact::Symlinked - def self.link_type_english_name + def self.artifact_english_name 'Generic artifact' end - # todo remove this backward compatibility override - def self.artifact_dsl_key - :link - end - - # todo remove this backward compatibility override def self.artifact_dirmethod - @artifact_dirmethod ||= :appdir - end - - # todo remove this backward compatibility override - def summary - {} + :appdir end end diff --git a/lib/cask/artifact/suite.rb b/lib/cask/artifact/suite.rb new file mode 100644 index 000000000..36cd53dbc --- /dev/null +++ b/lib/cask/artifact/suite.rb @@ -0,0 +1,9 @@ +class Cask::Artifact::Suite < Cask::Artifact::Symlinked + def self.artifact_english_name + 'App Suite' + end + + def self.artifact_dirmethod + :appdir + end +end diff --git a/lib/cask/cli/internal_stanza.rb b/lib/cask/cli/internal_stanza.rb index 1c1ff47aa..f76c38e8f 100644 --- a/lib/cask/cli/internal_stanza.rb +++ b/lib/cask/cli/internal_stanza.rb @@ -13,7 +13,7 @@ class Cask::CLI::InternalStanza < Cask::CLI::InternalUseBase # Examples # # brew cask _stanza appcast --table - # brew cask _stanza link --table alfred google-chrome adium voicemac logisim vagrant + # brew cask _stanza app --table alfred google-chrome adium voicemac logisim vagrant # brew cask _stanza url --table alfred google-chrome adium voicemac logisim vagrant # brew cask _stanza version --table alfred google-chrome adium voicemac logisim vagrant # brew cask _stanza artifacts --table --inspect alfred google-chrome adium voicemac logisim vagrant @@ -22,7 +22,9 @@ class Cask::CLI::InternalStanza < Cask::CLI::InternalUseBase # todo: this should be retrievable from Cask::DSL ARTIFACTS = Set.new([ - :link, + :app, + :suite, + :artifact, :prefpane, :qlplugin, :font, diff --git a/lib/cask/dsl.rb b/lib/cask/dsl.rb index 801b717ef..c17dc33cd 100644 --- a/lib/cask/dsl.rb +++ b/lib/cask/dsl.rb @@ -214,9 +214,6 @@ module Cask::DSL # semantics. STANZA_ALIASES = { :pkg => :install, # todo remove - :app => :link, # todo upgrade - :suite => :link, # todo upgrade - :artifact => :link, # todo upgrade :preflight => :before_install, # todo remove :postflight => :after_install, # todo remove :uninstall_preflight => :before_uninstall, # todo remove @@ -225,7 +222,6 @@ module Cask::DSL def self.ordinary_artifact_types @@ordinary_artifact_types ||= [ - :link, # todo remove :app, :suite, :artifact, diff --git a/lib/cask/staged.rb b/lib/cask/staged.rb index a72a25568..eaadd3b47 100644 --- a/lib/cask/staged.rb +++ b/lib/cask/staged.rb @@ -1,6 +1,6 @@ module Cask::Staged def info_plist - "#{staged_path}/#{@cask.artifacts[:link].first.first}/Contents/Info.plist" + "#{staged_path}/#{@cask.artifacts[:app].first.first}/Contents/Info.plist" end def plist_exec(cmd) diff --git a/test/cask/cli/info_test.rb b/test/cask/cli/info_test.rb index f216c276f..27a31018c 100644 --- a/test/cask/cli/info_test.rb +++ b/test/cask/cli/info_test.rb @@ -10,7 +10,7 @@ describe Cask::CLI::Info do Not installed https://github.com/caskroom/homebrew-testcasks/blob/master/Casks/local-caffeine.rb ==> Contents - Caffeine.app (link) + Caffeine.app (app) CLIOUTPUT end @@ -22,13 +22,13 @@ describe Cask::CLI::Info do Not installed https://github.com/caskroom/homebrew-testcasks/blob/master/Casks/local-caffeine.rb ==> Contents - Caffeine.app (link) + Caffeine.app (app) local-transmission: 2.61 http://example.com/local-transmission Not installed https://github.com/caskroom/homebrew-testcasks/blob/master/Casks/local-transmission.rb ==> Contents - Transmission.app (link) + Transmission.app (app) CLIOUTPUT end @@ -54,7 +54,7 @@ describe Cask::CLI::Info do Not installed https://github.com/caskroom/homebrew-testcasks/blob/master/Casks/with-caveats.rb ==> Contents - Caffeine.app (link) + Caffeine.app (app) ==> Caveats Here are some things you might want to know. @@ -78,7 +78,7 @@ describe Cask::CLI::Info do Not installed https://github.com/caskroom/homebrew-testcasks/blob/master/Casks/with-conditional-caveats.rb ==> Contents - Caffeine.app (link) + Caffeine.app (app) CLIOUTPUT end diff --git a/test/cask/dsl_test.rb b/test/cask/dsl_test.rb index e01e5e780..aea99070b 100644 --- a/test/cask/dsl_test.rb +++ b/test/cask/dsl_test.rb @@ -54,14 +54,14 @@ describe Cask::DSL do end instance = CaskWithApps.new - Array(instance.artifacts[:link]).sort.must_equal [['Bar.app'], ['Foo.app']] + Array(instance.artifacts[:app]).sort.must_equal [['Bar.app'], ['Foo.app']] end it "allow app stanzas to be empty" do CaskWithNoApps = Class.new(Cask) instance = CaskWithNoApps.new - Array(instance.artifacts[:link]).must_equal %w[] + Array(instance.artifacts[:app]).must_equal %w[] end end