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("The '#{environment_name}' environment already exist!.") if Bebox::Environment.environment_exists?(project_root, environment_name) # Environment creation environment = Bebox::Environment.new(environment_name, project_root) output = environment.create ok 'Environment created!.' 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("The '#{environment_name}' environment do not exist!.") unless Bebox::Environment.environment_exists?(project_root, environment_name) # Confirm deletion return warn('No changes were made.') unless confirm_action?('Are you sure that you want to delete the environment?') # Environment deletion environment = Bebox::Environment.new(environment_name, project_root) output = environment.remove ok 'Environment removed!.' return output end |