Class: Dsu::Subcommands::Config
- Inherits:
-
BaseSubcommand
- Object
- Thor
- BaseCLI
- BaseSubcommand
- Dsu::Subcommands::Config
- Defined in:
- lib/dsu/subcommands/config.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Dsu::Support::Ask
Methods inherited from BaseCLI
date_option_description, #initialize, mnemonic_option_description
Methods included from Dsu::Support::TimesSortable
#sorted_dsu_times_for, #times_for, #times_sort
Methods included from Dsu::Support::CommandHookable
Methods included from Dsu::Support::CommandHelpColorizable
Methods included from Dsu::Support::ColorThemable
apply_theme, #prompt_with_options
Constructor Details
This class inherits a constructor from Dsu::BaseCLI
Class Method Details
.exit_on_failure? ⇒ Boolean
16 17 18 |
# File 'lib/dsu/subcommands/config.rb', line 16 def exit_on_failure? false end |
Instance Method Details
#delete ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/dsu/subcommands/config.rb', line 45 def delete unless Models::Configuration.exist? = [I18n.t('messages.configuration_file.does_not_exist', configuration_file: Models::Configuration.config_file)] Views::Shared::Warning.new(messages: ).render exit 1 end Models::Configuration.delete! = [I18n.t('messages.configuration_file.deleted', configuration_file: Models::Configuration.config_file)] Views::Shared::Success.new(messages: ).render end |
#info ⇒ Object
23 24 25 26 |
# File 'lib/dsu/subcommands/config.rb', line 23 def info configuration = Models::Configuration.new Views::Configuration::Show.new(config: configuration).call end |
#init ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/dsu/subcommands/config.rb', line 31 def init exit 1 if configuration_errors_or_wanings? Models::Configuration.default.tap do |configuration| configuration.save! = [I18n.t('messages.configuration_file.created', configuration_file: Models::Configuration.config_file)] Views::Shared::Success.new(messages: ).render Views::Configuration::Show.new(config: configuration).render end end |