Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new DSL form container :nested => <inner> #6120

Merged
merged 1 commit into from
Sep 11, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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