Sha256: 756898db39241531c3451baedca796530d8e6be394b2533b1f0816f5c599d4b7

Contents?: true

Size: 537 Bytes

Versions: 6

Compression:

Stored size: 537 Bytes

Contents

# frozen_string_literal: true

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

      module_function

      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

      def asset(file)
        File.read(asset_path(file))
      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.14.0 lib/travis/tools/assets.rb
travis-1.13.3 lib/travis/tools/assets.rb
travis-1.13.2 lib/travis/tools/assets.rb
travis-1.13.1 lib/travis/tools/assets.rb
travis-1.13.0 lib/travis/tools/assets.rb
travis-1.12.0 lib/travis/tools/assets.rb