Skip to content
Snippets Groups Projects
Commit 5b593ebb authored by Joshua Hagins's avatar Joshua Hagins
Browse files

Allow deprecated hash syntax in Cask headers

parent 1b6908f4
No related branches found
No related tags found
No related merge requests found
......@@ -55,6 +55,10 @@ class Hbc::Source::PathBase
end
def build_cask(cask_class, header_token, &block)
if header_token.is_a?(Hash)
# Cask file is using old `cask :v1 => 'token'` syntax
header_token = header_token.values.first
end
raise Hbc::CaskTokenDoesNotMatchError.new(cask_token, header_token) unless cask_token == header_token
cask_class.new(cask_token, sourcefile_path: path, &block)
end
......
......@@ -62,6 +62,15 @@ describe Hbc::DSL do
it "does not require a DSL version in the header" do
test_cask = Hbc.load("no-dsl-version")
test_cask.token.must_equal "no-dsl-version"
test_cask.url.to_s.must_equal "http://example.com/TestCask.dmg"
test_cask.homepage.must_equal "http://example.com/"
test_cask.version.to_s.must_equal "1.2.3"
end
it "may use deprecated DSL version hash syntax" do
test_cask = Hbc.load("with-dsl-version")
test_cask.token.must_equal "with-dsl-version"
test_cask.url.to_s.must_equal "http://example.com/TestCask.dmg"
test_cask.homepage.must_equal "http://example.com/"
test_cask.version.to_s.must_equal "1.2.3"
......
test_cask :v1 => 'with-dsl-version' do
version '1.2.3'
sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
url 'http://example.com/TestCask.dmg'
homepage 'http://example.com/'
app 'TestCask.app'
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment