Class: PhilColumns::Cli

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/phil_columns/cli.rb,
lib/phil_columns/cli/list.rb,
lib/phil_columns/cli/reset.rb,
lib/phil_columns/cli/generate.rb

Defined Under Namespace

Classes: Generate, List, Reset

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.default_tags_explanationObject



12
13
14
15
# 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_optionObject



17
18
19
# 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_optionObject



21
22
23
# 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_descriptionObject



25
26
27
# 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, _, __) ⇒ Object



174
175
176
177
178
179
180
181
182
# 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) ⇒ Object



184
185
186
187
188
189
# 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) ⇒ Object



191
192
193
# File 'lib/phil_columns/cli.rb', line 191

def self.handle_no_command_error( name )
  $stdout.puts "Unrecognized command: #{name}"
end

.operation_optionObject



38
39
40
# 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_descriptionObject



42
43
44
# 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_descriptionObject



33
34
35
36
# 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_optionObject



29
30
31
# 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_optionObject



46
47
48
# 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_descriptionObject



50
51
52
53
54
# 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

Instance Method Details

#consoleObject



61
62
63
# File 'lib/phil_columns/cli.rb', line 61

def console
  execute PhilColumns::Command::Console
end

#install(path = '.') ⇒ Object



93
94
95
# File 'lib/phil_columns/cli.rb', line 93

def install( path='.' )
  execute PhilColumns::Command::Install, path: path
end

#mulligan(*tags) ⇒ Object



127
128
129
# File 'lib/phil_columns/cli.rb', line 127

def mulligan( *tags )
  execute PhilColumns::Command::Mulligan, tags: tags
end

#purge(*tags) ⇒ Object



72
73
74
# File 'lib/phil_columns/cli.rb', line 72

def purge( *tags )
  execute PhilColumns::Command::Purge, tags: tags
end

#seed(*tags) ⇒ Object



155
156
157
# File 'lib/phil_columns/cli.rb', line 155

def seed( *tags )
  execute PhilColumns::Command::Seed, tags: tags
end