Sha256: 3bbe99162d3450b244fab148b9e5352765e21a5ddd9ac7c351b298c63c5c6236

Contents?: true

Size: 1.99 KB

Versions: 31

Compression:

Stored size: 1.99 KB

Contents

#!/usr/bin/env ruby

require 'active_support/core_ext/hash'
require 'thor'
require_relative '../lib/schema_dev/config'
require_relative '../lib/schema_dev/gem'
require_relative '../lib/schema_dev/runner'
require_relative '../lib/schema_dev/version'

def runner
    $config ||= SchemaDev::Config.load
    $runner ||= SchemaDev::Runner.new($config)
end

$cmd = File.basename $0

class CLI < Thor

  def self.matrix_options
    method_option :dry_run, aliases: "-n", type: :boolean, desc: "Show what the commands would be without running them"
    method_option :quick, type: :boolean, desc: "Only execute on the 'quick' choice: #{$config ? $config.quick.inspect : "[from schema_dev.yml]"}"
    method_option :ruby, type: :string, desc: "Only execute for the specified version of ruby"
    method_option :activerecord, aliases: "--ar", type: :string, desc: "Only execute for the specified version of activerecord"
    method_option :db, type: :string, desc: "Only execute for the specified database"
  end

  desc "freshen", "update files that depend on schema_dev.yml: .travis, gemfiles/, README.md"
  def freshen
      runner.freshen
  end

  desc "matrix", "run a command over the matrix"
  matrix_options
  def matrix(*args)
    runner.run(args, **options.to_h.symbolize_keys)
  end

  desc "bundle", "shorthand for '#{$cmd} matrix bundle ...'"
  matrix_options
  def bundle(*args)
    runner.run('bundle', args, **options.to_h.symbolize_keys)
  end

  desc "rake", "shorthand for '#{$cmd} matrix bundle exec rake ...'"
  matrix_options
  def rake(*args)
    runner.run('bundle', 'exec', 'rake', args, **options.to_h.symbolize_keys)
  end

  desc "rspec", "shorthand for '#{$cmd} bundle exec rspec ...'"
  matrix_options
  def rspec(*args)
    runner.run('bundle', 'exec', 'rspec', args, **options.to_h.symbolize_keys)
  end

  desc "gem", "create a new SchemaPlus gem"
  def gem(name)
      SchemaDev::Gem.build(name)
  end

end

case
when ARGV[0] == "--version" then puts "SchemaDev #{SchemaDev::VERSION}"
else CLI.start(ARGV)
end

Version data entries

31 entries across 31 versions & 1 rubygems

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