Sha256: 9f297b2aec4384fe7c33039b16993f10185da53b466904762b20687e52325ef7

Contents?: true

Size: 1.18 KB

Versions: 31

Compression:

Stored size: 1.18 KB

Contents

require 'shellwords'

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

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

    def travis(quiet: false)
      if Travis.update(@config)
        puts "* Updated #{Travis::TRAVIS_FILE}" unless quiet
      end
    end

    def gemfiles(quiet: false)
      if Gemfiles.build(@config)
        puts "* Updated gemfiles" unless quiet
      end
    end

    def readme(quiet: false)
      if Readme.update(@config)
        puts "* Updated README" unless quiet
      end
    end

    def freshen(quiet: false)
      self.travis(quiet: quiet)
      self.gemfiles(quiet: quiet)
      self.readme(quiet: quiet)
    end

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

      matrix = MatrixExecutor.new @config.matrix(quick: quick, ruby: ruby, activerecord: activerecord, 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

31 entries across 31 versions & 1 rubygems

Version Path
schema_dev-4.0.0 lib/schema_dev/runner.rb
schema_dev-3.13.1 lib/schema_dev/runner.rb
schema_dev-3.13.0 lib/schema_dev/runner.rb
schema_dev-3.12.1 lib/schema_dev/runner.rb
schema_dev-3.12.0 lib/schema_dev/runner.rb
schema_dev-3.11.2 lib/schema_dev/runner.rb
schema_dev-3.11.1 lib/schema_dev/runner.rb
schema_dev-3.11.0 lib/schema_dev/runner.rb
schema_dev-3.10.1 lib/schema_dev/runner.rb
schema_dev-3.10.0 lib/schema_dev/runner.rb
schema_dev-3.9.0 lib/schema_dev/runner.rb
schema_dev-3.8.1 lib/schema_dev/runner.rb
schema_dev-3.8.0 lib/schema_dev/runner.rb
schema_dev-3.7.1 lib/schema_dev/runner.rb
schema_dev-3.7.0 lib/schema_dev/runner.rb
schema_dev-3.6.2 lib/schema_dev/runner.rb
schema_dev-3.6.1 lib/schema_dev/runner.rb
schema_dev-3.6.0 lib/schema_dev/runner.rb
schema_dev-3.5.1 lib/schema_dev/runner.rb
schema_dev-3.5.0 lib/schema_dev/runner.rb