Sha256: 9e6cc6b4327cdf47b7b0f5c31806a8e023ae0fac93b871b20361b22fd55c1dc4

Contents?: true

Size: 877 Bytes

Versions: 2

Compression:

Stored size: 877 Bytes

Contents

require 'shellwords'

require_relative 'matrix_executor'
require_relative 'travis'
require_relative 'gemfiles'

module SchemaDev
  class Runner
    def initialize(config)
      @config = config
    end

    def travis
      Travis.update(@config) and puts "* Updated #{Travis::TRAVIS_FILE}"
    end

    def gemfiles
      Gemfiles.build(@config) and puts "* Updated gemfiles"
    end

    def refresh
      self.travis
      self.gemfiles
    end

    def run(*args, dry_run: false, quick: false, ruby: nil, rails: nil, db: nil, freshen: true)
      self.refresh if freshen

      matrix = MatrixExecutor.new @config.matrix(quick: quick, ruby: ruby, rails: rails, db: db)

      return true if matrix.run(Shellwords.join(args.flatten), dry_run: dry_run)

      puts "\n*** #{matrix.errors.size} failures:\n\t#{matrix.errors.join("\n\t")}"
      return false
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
schema_dev-1.4.0 lib/schema_dev/runner.rb
schema_dev-1.3.0 lib/schema_dev/runner.rb