Simplify CaskLoader.
This commit is contained in:
parent
4eef60c6a6
commit
0802ad734f
@ -32,17 +32,12 @@ module Hbc
|
|||||||
end
|
end
|
||||||
|
|
||||||
def cask(header_token, &block)
|
def cask(header_token, &block)
|
||||||
@klass = Cask
|
|
||||||
build_cask(header_token, &block)
|
|
||||||
end
|
|
||||||
|
|
||||||
def build_cask(header_token, &block)
|
|
||||||
raise CaskTokenDoesNotMatchError.new(@token, header_token) unless @token == header_token
|
raise CaskTokenDoesNotMatchError.new(@token, header_token) unless @token == header_token
|
||||||
|
|
||||||
if @path.nil?
|
if @path.nil?
|
||||||
@klass.new(@token, &block)
|
Cask.new(@token, &block)
|
||||||
else
|
else
|
||||||
@klass.new(@token, sourcefile_path: @path, &block)
|
Cask.new(@token, sourcefile_path: @path, &block)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
module CaskLoaderCompatibilityLayer
|
module CaskLoaderCompatibilityLayer
|
||||||
private
|
private
|
||||||
|
|
||||||
def build_cask(header_token, &block)
|
def cask(header_token, &block)
|
||||||
if header_token.is_a?(Hash) && header_token.key?(:v1)
|
if header_token.is_a?(Hash) && header_token.key?(:v1)
|
||||||
odeprecated %q("cask :v1 => 'token'"), %q("cask 'token'")
|
odeprecated %q("cask :v1 => 'token'"), %q("cask 'token'")
|
||||||
header_token = header_token[:v1]
|
header_token = header_token[:v1]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user