Skip to content

Commit

Permalink
Merge pull request #7065 from rolandwalker/remove_link_stanza
Browse files Browse the repository at this point in the history
remove support for `link` artifact
  • Loading branch information
rolandwalker committed Oct 30, 2014
2 parents 32321b1 + b837d6c commit 1bbf387
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 45 deletions.
1 change: 1 addition & 0 deletions lib/cask/artifact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module Cask::Artifact; end
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'
Expand Down
4 changes: 0 additions & 4 deletions lib/cask/artifact/app.rb
Original file line number Diff line number Diff line change
@@ -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
15 changes: 2 additions & 13 deletions lib/cask/artifact/artifact.rb
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions lib/cask/artifact/suite.rb
Original file line number Diff line number Diff line change
@@ -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
6 changes: 4 additions & 2 deletions lib/cask/cli/internal_stanza.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down
4 changes: 0 additions & 4 deletions lib/cask/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,6 @@ def caveats(*string, &block)
# 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
Expand All @@ -225,7 +222,6 @@ def caveats(*string, &block)

def self.ordinary_artifact_types
@@ordinary_artifact_types ||= [
:link, # todo remove
:app,
:suite,
:artifact,
Expand Down
2 changes: 1 addition & 1 deletion lib/cask/staged.rb
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
6 changes: 3 additions & 3 deletions test/cask/artifact/alt_target_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}

describe 'install to alternate target' do
it "links the noted applications to the proper directory" do
it "activates the given apps using the proper target directory" do
cask = local_alt_caffeine

shutup do
Expand All @@ -18,7 +18,7 @@
TestHelper.valid_alias?(Cask.appdir/'AnotherName.app').must_equal true
end

it "creates metadata containing the altername target name" do
it "creates metadata containing the alternate target name" do
cask = local_alt_caffeine

shutup do
Expand Down Expand Up @@ -64,7 +64,7 @@
end
end

it "only uses linkables when they are specified" do
it "only uses apps when they are specified" do
cask = local_alt_caffeine

app_path = cask.staged_path.join('Caffeine.app')
Expand Down
4 changes: 2 additions & 2 deletions test/cask/artifact/app_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}

describe 'install_phase' do
it "links the noted applications to the proper directory" do
it "activates the given apps using the proper target directory" do
cask = local_caffeine

shutup do
Expand Down Expand Up @@ -50,7 +50,7 @@
end
end

it "only uses linkables when they are specified" do
it "only uses apps when they are specified" do
cask = local_caffeine

app_path = cask.staged_path.join('Caffeine.app')
Expand Down
4 changes: 2 additions & 2 deletions test/cask/artifact/two_apps_correct_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}

describe 'install multiple apps' do
it "links both noted applications to the proper directory" do
it "activates both apps using the proper target directory" do
cask = local_two_apps_caffeine

shutup do
Expand Down Expand Up @@ -54,7 +54,7 @@
end

# @@@ todo
# it "only uses linkables when they are specified" do
# it "only uses apps when they are specified" do
# cask = local_two_apps_caffeine
#
# app_path = cask.staged_path.join('Caffeine.app')
Expand Down
10 changes: 5 additions & 5 deletions test/cask/cli/info_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Not installed
https://github.com/caskroom/homebrew-testcasks/blob/master/Casks/local-caffeine.rb
==> Contents
Caffeine.app (link)
Caffeine.app (app)
CLIOUTPUT
end

Expand All @@ -22,13 +22,13 @@
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

Expand All @@ -54,7 +54,7 @@
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.
Expand All @@ -78,7 +78,7 @@
Not installed
https://github.com/caskroom/homebrew-testcasks/blob/master/Casks/with-conditional-caveats.rb
==> Contents
Caffeine.app (link)
Caffeine.app (app)
CLIOUTPUT
end

Expand Down
2 changes: 1 addition & 1 deletion test/cask/cli/install_test.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'test_helper'

describe Cask::CLI::Install do
it "allows install and link of multiple Casks at once" do
it "allows install and activation of multiple Casks at once" do
shutup do
Cask::CLI::Install.run('local-transmission', 'local-caffeine')
end
Expand Down
16 changes: 8 additions & 8 deletions test/cask/dsl_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,21 @@

describe "app stanza" do
it "allows you to specify app stanzas" do
CaskWithLinkables = Class.new(Cask)
CaskWithLinkables.class_eval do
CaskWithApps = Class.new(Cask)
CaskWithApps.class_eval do
app 'Foo.app'
app 'Bar.app'
end

instance = CaskWithLinkables.new
Array(instance.artifacts[:link]).sort.must_equal [['Bar.app'], ['Foo.app']]
instance = CaskWithApps.new
Array(instance.artifacts[:app]).sort.must_equal [['Bar.app'], ['Foo.app']]
end

it "allow app stanzas to be set to empty" do
CaskWithNoLinkables = Class.new(Cask)
it "allow app stanzas to be empty" do
CaskWithNoApps = Class.new(Cask)

instance = CaskWithNoLinkables.new
Array(instance.artifacts[:link]).must_equal %w[]
instance = CaskWithNoApps.new
Array(instance.artifacts[:app]).must_equal %w[]
end
end

Expand Down

0 comments on commit 1bbf387

Please sign in to comment.