Sha256: 77eb573ece437f700f8f47173cbd9bcdecfde17a1f2bb0efbd8ed3cc669e3847
Contents?: true
Size: 689 Bytes
Versions: 19
Compression:
Stored size: 689 Bytes
Contents
require 'fileutils' module Dpl module Assets class Asset < Struct.new(:provider, :namespace, :name) include FileUtils DIR = File.expand_path('../../assets', __FILE__) def copy(target) cp path, File.expand_path(target) end def read exists? ? provider.interpolate(File.read(path)) : unknown end def exists? File.exists?(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
19 entries across 19 versions & 1 rubygems