Sha256: 6c42c9b94fe170110030ef3235b7da088e9674e424061c03e60e39482d29f9e1

Contents?: true

Size: 509 Bytes

Versions: 12

Compression:

Stored size: 509 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.first.to_s
      end

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

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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
travis-1.11.1 lib/travis/tools/assets.rb
travis-1.11.0 lib/travis/tools/assets.rb
travis-1.10.1.travis.1341.9 lib/travis/tools/assets.rb
travis-1.10.1.travis.1321.9 lib/travis/tools/assets.rb
travis-1.10.1.travis.1312.9 lib/travis/tools/assets.rb
travis-1.10.1.travis.1311.9 lib/travis/tools/assets.rb
travis-1.10.1.travis.1305.9 lib/travis/tools/assets.rb
travis-1.10.0 lib/travis/tools/assets.rb
travis-1.9.2.travis.1304.9 lib/travis/tools/assets.rb
travis-1.9.2.travis.1303.9 lib/travis/tools/assets.rb
travis-1.10.0.pre.rc4 lib/travis/tools/assets.rb
travis-1.10.0.pre.rc3 lib/travis/tools/assets.rb