27 lines
797 B
Ruby
Raw Normal View History

2016-08-18 22:11:42 +03:00
require "hbc/artifact/moved"
2016-10-04 15:24:58 +02:00
require "hbc/utils/hash_validator"
2016-09-24 13:52:43 +02:00
module Hbc
module Artifact
class Artifact < Moved
def self.artifact_english_name
"Generic Artifact"
end
2016-08-18 22:11:42 +03:00
2016-09-24 13:52:43 +02:00
def self.artifact_dirmethod
:appdir
end
2016-08-18 22:11:42 +03:00
2016-09-24 13:52:43 +02:00
def load_specification(artifact_spec)
source_string, target_hash = artifact_spec
raise CaskInvalidError.new(@cask.token, "no source given for artifact") if source_string.nil?
@source = @cask.staged_path.join(source_string)
raise CaskInvalidError.new(@cask.token, "target required for generic artifact #{source_string}") unless target_hash.is_a?(Hash)
2016-10-04 15:24:58 +02:00
target_hash.extend(HashValidator).assert_valid_keys(:target)
2016-09-24 13:52:43 +02:00
@target = Pathname.new(target_hash[:target])
end
end
2016-08-18 22:11:42 +03:00
end
end