diff --git a/Library/Homebrew/cask/lib/hbc/artifact/abstract_artifact.rb b/Library/Homebrew/cask/lib/hbc/artifact/abstract_artifact.rb index f9f736662fb4e0c0234c57cb1b2164d6450a7b5b..077105468966131b70a61475c13512904a22a7f3 100644 --- a/Library/Homebrew/cask/lib/hbc/artifact/abstract_artifact.rb +++ b/Library/Homebrew/cask/lib/hbc/artifact/abstract_artifact.rb @@ -95,10 +95,11 @@ module Hbc [executable, arguments] end - attr_reader :cask + attr_reader :cask, :config def initialize(cask) @cask = cask + @config = cask.config end def to_s diff --git a/Library/Homebrew/cask/lib/hbc/artifact/artifact.rb b/Library/Homebrew/cask/lib/hbc/artifact/artifact.rb index 0f37afaded9cc0ae30f7593c4eaf7e2c95e420e9..b7df4b0bd0f24b248ec2b1583687894eae5c3b93 100644 --- a/Library/Homebrew/cask/lib/hbc/artifact/artifact.rb +++ b/Library/Homebrew/cask/lib/hbc/artifact/artifact.rb @@ -25,7 +25,7 @@ module Hbc new(cask, source_string, **target_hash) end - def self.resolve_target(target) + def resolve_target(target) Pathname(target) end diff --git a/Library/Homebrew/cask/lib/hbc/artifact/relocated.rb b/Library/Homebrew/cask/lib/hbc/artifact/relocated.rb index 155d52c0623fac97cb4d3d3580d294bad7e800cc..9195d889a7b840bdd9c23f3947c43c29ac2a62b5 100644 --- a/Library/Homebrew/cask/lib/hbc/artifact/relocated.rb +++ b/Library/Homebrew/cask/lib/hbc/artifact/relocated.rb @@ -18,8 +18,8 @@ module Hbc new(cask, source_string, **target_hash) end - def self.resolve_target(target) - Config.global.public_send(dirmethod).join(target) + def resolve_target(target) + config.public_send(self.class.dirmethod).join(target) end attr_reader :source, :target @@ -32,7 +32,7 @@ module Hbc source = cask.staged_path.join(source) @source = source target ||= source.basename - @target = self.class.resolve_target(target) + @target = resolve_target(target) end def to_a diff --git a/Library/Homebrew/cask/lib/hbc/cask.rb b/Library/Homebrew/cask/lib/hbc/cask.rb index df885371a930d635750e39b81f278e2bc212b58f..681130c1b10146d93fa63aee0af9275ad041f9de 100644 --- a/Library/Homebrew/cask/lib/hbc/cask.rb +++ b/Library/Homebrew/cask/lib/hbc/cask.rb @@ -6,17 +6,18 @@ module Hbc extend Forwardable include Metadata - attr_reader :token, :sourcefile_path + attr_reader :token, :sourcefile_path, :config def tap return super if block_given? # Object#tap @tap end - def initialize(token, sourcefile_path: nil, tap: nil, &block) + def initialize(token, sourcefile_path: nil, tap: nil, config: Config.global, &block) @token = token @sourcefile_path = sourcefile_path @tap = tap + @config = config @dsl = DSL.new(self) return unless block_given? @dsl.instance_eval(&block) diff --git a/Library/Homebrew/cask/lib/hbc/dsl.rb b/Library/Homebrew/cask/lib/hbc/dsl.rb index 969fc86806e77362597ad198b0ad4e92032758d1..9a88f1b62462a816227ea790a8b73c1ceb5692eb 100644 --- a/Library/Homebrew/cask/lib/hbc/dsl.rb +++ b/Library/Homebrew/cask/lib/hbc/dsl.rb @@ -292,7 +292,7 @@ module Hbc end def appdir - Config.global.appdir + cask.config.appdir end end end