Sha256: 6697f4a350c969ee6e4c37118cc1f3af148cdbefd67122005378e19ea1cef977

Contents?: true

Size: 504 Bytes

Versions: 6

Compression:

Stored size: 504 Bytes

Contents

require 'pathname'
module Travis
  module Tools
    module Assets
      BASE = File.expand_path('../../../../assets', __FILE__)
      extend self

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

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

      class << self
        alias [] asset_path
        alias read asset
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
travis-1.10.0.pre.rc2 lib/travis/tools/assets.rb
travis-1.9.2.travis.1288.9 lib/travis/tools/assets.rb
travis-1.9.2.travis.1285.9 lib/travis/tools/assets.rb
travis-1.9.2.travis.1279.9 lib/travis/tools/assets.rb
travis-1.10.0.pre.rc1 lib/travis/tools/assets.rb
travis-1.9.2.travis.1254.9 lib/travis/tools/assets.rb