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-3.4.0 lib/schema_dev/runner.rb
schema_dev-3.3.0 lib/schema_dev/runner.rb
schema_dev-3.2.4 lib/schema_dev/runner.rb
schema_dev-3.2.3 lib/schema_dev/runner.rb
schema_dev-3.2.2 lib/schema_dev/runner.rb
schema_dev-3.2.1 lib/schema_dev/runner.rb
schema_dev-3.2.0 lib/schema_dev/runner.rb
schema_dev-3.1.1 lib/schema_dev/runner.rb
schema_dev-3.1.0 lib/schema_dev/runner.rb
schema_dev-3.0.1 lib/schema_dev/runner.rb
schema_dev-3.0.0 lib/schema_dev/runner.rb