Class: PhilColumns::Cli::Reset
- Inherits:
-
Thor
- Object
- Thor
- PhilColumns::Cli::Reset
- Defined in:
- lib/phil_columns/cli/reset.rb
Class Method Summary collapse
- .banner(command, namespace = nil, subcommand = false) ⇒ Object
- .default_tags_explanation ⇒ Object
- .env_option ⇒ Object
- .env_option_description ⇒ Object
- .handle_argument_error(command, error, _, __) ⇒ Object
- .handle_argument_error_default(command, error) ⇒ Object
- .handle_no_command_error(name) ⇒ Object
- .operation_option ⇒ Object
- .operation_option_description ⇒ Object
- .skip_on_purge_description ⇒ Object
- .skip_option ⇒ Object
- .version_option ⇒ Object
- .version_option_description ⇒ Object
Instance Method Summary collapse
Class Method Details
.banner(command, namespace = nil, subcommand = false) ⇒ Object
7 8 9 10 |
# File 'lib/phil_columns/cli/reset.rb', line 7 def self.( command, namespace=nil, subcommand=false ) return "#{basename} reset help [SUBCOMMAND]" if command.name == 'help' "#{basename} #{command.usage}" end |
.default_tags_explanation ⇒ Object
12 13 14 15 |
# File 'lib/phil_columns/cli/reset.rb', line 12 def self. %(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 |
.env_option ⇒ Object
17 18 19 |
# File 'lib/phil_columns/cli/reset.rb', line 17 def self.env_option option :env, type: :string, aliases: '-e', desc: "The environment to execute in", default: 'development' end |
.env_option_description ⇒ Object
21 22 23 |
# File 'lib/phil_columns/cli/reset.rb', line 21 def self.env_option_description %(When --env[-e] option, override the environment. Default: development.) end |
.handle_argument_error(command, error, _, __) ⇒ Object
85 86 87 88 89 90 91 92 93 |
# File 'lib/phil_columns/cli/reset.rb', line 85 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
95 96 97 98 99 100 |
# File 'lib/phil_columns/cli/reset.rb', line 95 def self.handle_argument_error_default( command, error ) $stdout.puts "Incorrect usage of generate subcommand: #{command.name}" $stdout.puts " #{error.message}", '' $stdout.puts "For correct usage:" $stdout.puts " phil_columns generate help #{command.name}" end |
.handle_no_command_error(name) ⇒ Object
102 103 104 |
# File 'lib/phil_columns/cli/reset.rb', line 102 def self.handle_no_command_error( name ) $stdout.puts "Unrecognized command: #{name}" end |
.operation_option ⇒ Object
25 26 27 |
# File 'lib/phil_columns/cli/reset.rb', line 25 def self.operation_option option :operation, type: :string, aliases: '-o', desc: "The operation: all or any", default: 'any' end |
.operation_option_description ⇒ Object
29 30 31 |
# File 'lib/phil_columns/cli/reset.rb', line 29 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 ⇒ Object
37 38 39 40 |
# File 'lib/phil_columns/cli/reset.rb', line 37 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 ⇒ Object
33 34 35 |
# File 'lib/phil_columns/cli/reset.rb', line 33 def self.skip_option option :skip, type: :boolean, desc: "When true, skip tables listed in config", default: true end |
.version_option ⇒ Object
42 43 44 |
# File 'lib/phil_columns/cli/reset.rb', line 42 def self.version_option option :version, type: :string, aliases: '-v', desc: "The version to execute to", default: 'all' end |
.version_option_description ⇒ Object
46 47 48 49 50 |
# File 'lib/phil_columns/cli/reset.rb', line 46 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
#data(*tags) ⇒ Object
70 71 72 |
# File 'lib/phil_columns/cli/reset.rb', line 70 def data( * ) PhilColumns::Command::Reset::Data.new( .merge( tags: )).execute end |
#schema(*tags) ⇒ Object
81 82 83 |
# File 'lib/phil_columns/cli/reset.rb', line 81 def schema( * ) PhilColumns::Command::Reset::Schema.new( ).execute end |