Skip to content

Commit

Permalink
bug: fix container :type => <type>
Browse files Browse the repository at this point in the history
Copypasta error in Homebrew#6068 means that container :type
never worked, because it looked for nonexistent container.formula
  • Loading branch information
rolandwalker committed Sep 10, 2014
1 parent 5390f54 commit 3b7ce85
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/cask/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ def container(*args)
raise CaskInvalidError.new(self.title, e)
end
# todo: remove this backwards compatibility section after removing container_type
if @container.formula
@container_type ||= @container.formula
if @container.type
@container_type ||= @container.type
end
@container
end
Expand Down
12 changes: 12 additions & 0 deletions test/cask/installer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,18 @@
executable.must_be :file?
end

it "works properly with the new form container :type => <type>" do
naked_executable_dsl_one = Cask.load('naked-executable-dsl-one')

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

dest_path = Cask.caskroom/'naked-executable-dsl-one'/naked_executable_dsl_one.version
executable = dest_path/'naked_executable'
executable.must_be :file?
end

it "works fine with a nested container" do
nested_app = Cask.load('nested-app')

Expand Down
10 changes: 10 additions & 0 deletions test/support/Casks/naked-executable-dsl-one.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class NakedExecutableDslOne < TestCask
# todo: This Cask can be removed after DSL 1.0 transition,
# b/c the main Cask naked-executable.rb will be
# adopting this syntax.
url TestHelper.local_binary('naked_executable')
homepage 'http://example.com/naked-executable'
version '1.2.3'
sha256 '306c6ca7407560340797866e077e053627ad409277d1b9da58106fce4cf717cb'
container :type => :naked
end

0 comments on commit 3b7ce85

Please sign in to comment.