Sha256: 4a3867c537cd18bce745fc1de08a715fdcf19320001a4b5db7e574faf4bdc971
Contents?: true
Size: 715 Bytes
Versions: 12
Compression:
Stored size: 715 Bytes
Contents
# frozen_string_literal: true require 'fileutils' module Dpl module Assets class Asset < Struct.new(:provider, :namespace, :name) include FileUtils DIR = File.expand_path('../assets', __dir__) def copy(target) cp path, File.expand_path(target) end def read exists? ? provider.interpolate(File.read(path)) : unknown end def exists? File.exist?(path) end def unknown raise "Could not find asset #{path}" end def path "#{DIR}/#{namespace}/#{name}" end end def asset(*args) name, namespace = args.reverse Asset.new(self, namespace || registry_key, name) end end end
Version data entries
12 entries across 12 versions & 2 rubygems