Skip to content

Commit

Permalink
Merge pull request #6120 from rolandwalker/container_nested
Browse files Browse the repository at this point in the history
new DSL form container :nested => <inner>
  • Loading branch information
rolandwalker committed Sep 11, 2014
2 parents 0e0bb6b + 65cda12 commit 80d44d4
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/cask/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ def container(*args)
if @container.type
@container_type ||= @container.type
end
# todo: remove this backwards compatibility section after removing nested_container
if @container.nested
artifacts[:nested_container] << @container.nested
end
@container
end

Expand Down
1 change: 1 addition & 0 deletions lib/cask/dsl/container.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ class Cask::DSL::Container

VALID_KEYS = Set.new [
:type,
:nested,
]

attr_accessor *VALID_KEYS
Expand Down
11 changes: 11 additions & 0 deletions test/cask/installer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,17 @@
dest_path = Cask.appdir/'MyNestedApp.app'
TestHelper.valid_alias?(dest_path).must_equal true
end

it "supports new DSL form container :nested => <inner-container>" do
nested_app_dsl_one = Cask.load('nested-app-dsl-one')

shutup do
Cask::Installer.new(nested_app_dsl_one).install
end

dest_path = Cask.appdir/'MyNestedApp.app'
TestHelper.valid_alias?(dest_path).must_equal true
end
end

describe "uninstall" do
Expand Down
11 changes: 11 additions & 0 deletions test/support/Casks/nested-app-dsl-one.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class NestedAppDslOne < TestCask
# todo: This Cask can be removed after DSL 1.0 transition,
# b/c the main Cask nested-app.rb will be
# adopting this syntax.
url TestHelper.local_binary('NestedApp.dmg.zip')
homepage 'http://example.com/nested-app'
version '1.2.3'
sha256 '1866dfa833b123bb8fe7fa7185ebf24d28d300d0643d75798bc23730af734216'
container :nested => 'NestedApp.dmg'
link 'MyNestedApp.app'
end

0 comments on commit 80d44d4

Please sign in to comment.