class PhilColumns::Cli

Public Class Methods

default_tags_explanation() click to toggle source
# File lib/phil_columns/cli.rb, line 12
def self.default_tags_explanation
  %(If default_tags are specified in the config file and no tags are provided as parameters to the command, the default tags are applied
    as the tags.  However, if tags are provided as parameters they override the defult tags.)
end
dry_run_option() click to toggle source
# File lib/phil_columns/cli.rb, line 17
def self.dry_run_option
  option :dry_run, type: :boolean, desc: "When true, output steps but does not execute protected blocks"
end
env_option() click to toggle source
# File lib/phil_columns/cli.rb, line 21
def self.env_option
  option :env, type: :string, aliases: '-e', desc: "The environment to execute in", default: 'development'
end
env_option_description() click to toggle source
# File lib/phil_columns/cli.rb, line 25
def self.env_option_description
  %(When --env[-e] option, override the environment.  Default: development.)
end
handle_argument_error( command, error, _, __ ) click to toggle source
# File lib/phil_columns/cli.rb, line 174
def self.handle_argument_error( command, error, _, __ )
  method = "handle_argument_error_for_#{command.name}"

  if respond_to?( method )
    send( method, command, error )
  else
    handle_argument_error_default( command, error )
  end
end
handle_argument_error_default( command, error ) click to toggle source
# File lib/phil_columns/cli.rb, line 184
def self.handle_argument_error_default( command, error )
  $stdout.puts "Incorrect usage of command: #{command.name}"
  $stdout.puts "  #{error.message}", ''
  $stdout.puts "For correct usage:"
  $stdout.puts "  phil_columns help #{command.name}"
end
handle_no_command_error( name ) click to toggle source
# File lib/phil_columns/cli.rb, line 191
def self.handle_no_command_error( name )
  $stdout.puts "Unrecognized command: #{name}"
end
operation_option() click to toggle source
# File lib/phil_columns/cli.rb, line 38
def self.operation_option
  option :operation, type: :string, aliases: '-o', desc: "The operation: all or any", default: 'any'
end
operation_option_description() click to toggle source
# File lib/phil_columns/cli.rb, line 42
def self.operation_option_description
  %(When --operation[-o] option, override the operation to one of any or all.  Default: any.)
end
skip_on_purge_description() click to toggle source
# File lib/phil_columns/cli.rb, line 33
def self.skip_on_purge_description
  %(When --no-skip, override the skip_tables_on_purge configuration.  Otherwise, the tables specified in the skip_tables_on_purge configuration
    will be skipped.)
end
skip_option() click to toggle source
# File lib/phil_columns/cli.rb, line 29
def self.skip_option
  option :skip, type: :boolean, desc: "When true, skip tables listed in config", default: true
end
version_option() click to toggle source
# File lib/phil_columns/cli.rb, line 46
def self.version_option
  option :version, type: :string, aliases: '-v', desc: "The version to execute to", default: 'all'
end
version_option_description() click to toggle source
# File lib/phil_columns/cli.rb, line 50
def self.version_option_description
  %(When --version[-v] option, override the version.  Default: all.  Provide the timestamp from the beginning of the seed file name
  as the version parameter.  When seeding up, the specified version is included in the seed set.  When seeding down the specified
  version is not included in the set.)
end

Public Instance Methods

console() click to toggle source
# File lib/phil_columns/cli.rb, line 61
def console
  execute PhilColumns::Command::Console
end
execute( klass, additional_options={} ) click to toggle source
# File lib/phil_columns/cli.rb, line 161
def execute( klass, additional_options={} )
  klass.new( options.merge( additional_options )).execute
rescue PhilColumns::Error => e
  handle_error( e )
  exit 1
end
handle_error( e ) click to toggle source
# File lib/phil_columns/cli.rb, line 168
def handle_error( e )
  say "Error: #{e.message}", :red
end
install( path='.' ) click to toggle source
# File lib/phil_columns/cli.rb, line 93
def install( path='.' )
  execute PhilColumns::Command::Install, path: path
end
mulligan( *tags ) click to toggle source
# File lib/phil_columns/cli.rb, line 127
def mulligan( *tags )
  execute PhilColumns::Command::Mulligan, tags: tags
end
purge( *tags ) click to toggle source
# File lib/phil_columns/cli.rb, line 72
def purge( *tags )
  execute PhilColumns::Command::Purge, tags: tags
end
seed( *tags ) click to toggle source
# File lib/phil_columns/cli.rb, line 155
def seed( *tags )
  execute PhilColumns::Command::Seed, tags: tags
end