Sha256: d408cd06cdcd22416c72af91b50d78f877a9fa9d06d8ba2e88bfd748bac37bf1

Contents?: true

Size: 1.04 KB

Versions: 10

Compression:

Stored size: 1.04 KB

Contents

module Gemika
  class Matrix

    ##
    # Load `.travis.yml` files.
    #
    # @!visibility private
    #
    class TravisConfig
      class << self

        def load_rows(options)
          path = options.fetch(:path, '.travis.yml')
          travis_yml = YAML.load_file(path)
          rubies = travis_yml.fetch('rvm', [])
          gemfiles = travis_yml.fetch('gemfile', [])
          matrix_options = travis_yml.fetch('matrix', {})
          includes = matrix_options.fetch('include', [])
          excludes = matrix_options.fetch('exclude', [])

          rows = []
          rubies.each do |ruby|
            gemfiles.each do |gemfile|
              row = { 'rvm' => ruby, 'gemfile' => gemfile }
              rows << row unless excludes.include?(row)
            end
          end

          rows = rows + includes
          rows = rows.map { |row| convert_row(row) }
          rows
        end

        def convert_row(travis_row)
          Row.new(:ruby => travis_row['rvm'], :gemfile => travis_row['gemfile'])
        end

      end
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
gemika-0.8.4 lib/gemika/matrix/travis_config.rb
gemika-0.8.3 lib/gemika/matrix/travis_config.rb
gemika-0.8.2 lib/gemika/matrix/travis_config.rb
gemika-0.8.1 lib/gemika/matrix/travis_config.rb
gemika-0.8.0 lib/gemika/matrix/travis_config.rb
gemika-0.7.1 lib/gemika/matrix/travis_config.rb
gemika-0.7.0 lib/gemika/matrix/travis_config.rb
gemika-0.6.1 lib/gemika/matrix/travis_config.rb
gemika-0.6.0 lib/gemika/matrix/travis_config.rb
gemika-0.5.0 lib/gemika/matrix/travis_config.rb