Skip to content

Commit

Permalink
allow linkables to be set to none
Browse files Browse the repository at this point in the history
sometimes it doesn't make sense for a cask to link anything out to the
Applications dir
  • Loading branch information
phinze committed Apr 28, 2013
1 parent 50782df commit 021c6af
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Casks/adobe-air.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ class AdobeAir < Cask
#caveat 'You need to run {{install_path}}/AdobeAIRInstaller.app to actually install Adobe AIR'

sha1 '8fbd2dffc20442903d8b51e7362a3191f39752b4'

link :app, :none
end
6 changes: 5 additions & 1 deletion lib/cask/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ def linkables
end

def link(type, *files)
linkables[type] += files
if files == [:none]
linkables[type] = []
else
linkables[type] += files
end
end

attr_reader :sums
Expand Down
10 changes: 10 additions & 0 deletions test/cask/dsl_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,14 @@
instance = CaskWithLinkables.new
Array(instance.linkables[:app]).must_equal %w[Foo.app Bar.app]
end

it "allow linkables to be set to empty" do
CaskWithNoLinkables = Class.new(Cask)
CaskWithNoLinkables.class_eval do
link :app, :none
end

instance = CaskWithNoLinkables.new
Array(instance.linkable_apps).must_equal %w[]
end
end

0 comments on commit 021c6af

Please sign in to comment.