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



165
166
167
168
169
170
171
172
173
# File 'lib/phil_columns/cli.rb', line 165

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



175
176
177
178
179
180
# File 'lib/phil_columns/cli.rb', line 175

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



182
183
184
# File 'lib/phil_columns/cli.rb', line 182

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

#install(path = '.') ⇒ Object



84
85
86
# File 'lib/phil_columns/cli.rb', line 84

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

#mulligan(*tags) ⇒ Object



118
119
120
# File 'lib/phil_columns/cli.rb', line 118

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

#purge(*tags) ⇒ Object



63
64
65
# File 'lib/phil_columns/cli.rb', line 63

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

#seed(*tags) ⇒ Object



146
147
148
# File 'lib/phil_columns/cli.rb', line 146

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