Class: Bebox::EnvironmentWizard
- Inherits:
-
Object
- Object
- Bebox::EnvironmentWizard
- Includes:
- Logger, WizardsHelper
- Defined in:
- lib/bebox/wizards/environment_wizard.rb
Instance Method Summary collapse
-
#create_new_environment(project_root, environment_name) ⇒ Object
Create a new environment.
-
#remove_environment(project_root, environment_name) ⇒ Object
Removes an existing environment.
Methods included from WizardsHelper
#choose_option, #confirm_action?, #valid_puppet_class_name?, #write_input
Methods included from Logger
#error, #highline_quest, #highline_warn, included, #info, #linebreak, #msg, #ok, #quest, #title, #warn
Instance Method Details
#create_new_environment(project_root, environment_name) ⇒ Object
Create a new environment
8 9 10 11 12 13 14 15 16 |
# File 'lib/bebox/wizards/environment_wizard.rb', line 8 def create_new_environment(project_root, environment_name) # Check if the environment exist return error(_('wizard.environment.name_exist')%{environment: environment_name}) if Bebox::Environment.environment_exists?(project_root, environment_name) # Environment creation environment = Bebox::Environment.new(environment_name, project_root) output = environment.create ok _('wizard.environment.creation_success') return output end |
#remove_environment(project_root, environment_name) ⇒ Object
Removes an existing environment
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/bebox/wizards/environment_wizard.rb', line 19 def remove_environment(project_root, environment_name) # Check if the environment exist return error(_('wizard.environment.name_not_exist')%{environment: environment_name}) unless Bebox::Environment.environment_exists?(project_root, environment_name) # Confirm deletion return warn(_('wizard.no_changes')) unless confirm_action?(_('wizard.environment.confirm_deletion')) # Environment deletion environment = Bebox::Environment.new(environment_name, project_root) output = environment.remove ok _('wizard.environment.deletion_success') return output end |