Module: Travis::Tools::Assets

Included in:
CLI::Command, CLI::Command
Defined in:
lib/travis/tools/assets.rb

Constant Summary collapse

BASE =
File.expand_path('../../../assets', __dir__)

Class Method Summary collapse

Class Method Details

.asset(file) ⇒ Object Also known as: read



17
18
19
# File 'lib/travis/tools/assets.rb', line 17

def asset(file)
  File.read(asset_path(file))
end

.asset_path(file) ⇒ Object Also known as: []



11
12
13
14
15
# File 'lib/travis/tools/assets.rb', line 11

def asset_path(file)
  Pathname.glob(File.expand_path(file, BASE)).tap do |x|
    raise Travis::Client::AssetNotFound, file if x.empty?
  end.first.to_s
end