Module: Bebox::ProjectCommands

Includes:
CommandsHelper
Defined in:
lib/bebox/commands/project_commands.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from CommandsHelper

#default_environment, #get_environment, vagrant_installed?, valid_step?

Methods included from WizardsHelper

#choose_option, #confirm_action?, #valid_puppet_class_name?, #write_input

Class Method Details

.extended(base) ⇒ Object



7
8
9
# File 'lib/bebox/commands/project_commands.rb', line 7

def self.extended(base)
  base.load_commands
end

Instance Method Details

#load_commandsObject



11
12
13
14
15
16
17
# File 'lib/bebox/commands/project_commands.rb', line 11

def load_commands
  load_environment_commands
  load_node_commands
  load_role_profile_commands
  load_prepare_commands
  load_provision_commands
end

#load_environment_commandsObject

Load environment commands



20
21
22
# File 'lib/bebox/commands/project_commands.rb', line 20

def load_environment_commands
  self.extend Bebox::EnvironmentCommands
end

#load_node_commandsObject

Load node commands if there are environments configured



25
26
27
# File 'lib/bebox/commands/project_commands.rb', line 25

def load_node_commands
  (self.extend Bebox::NodeCommands) if Bebox::Environment.list(project_root).count > 0
end

#load_prepare_commandsObject

Load prepare commands if there are at least one node



38
39
40
# File 'lib/bebox/commands/project_commands.rb', line 38

def load_prepare_commands
  (self.extend Bebox::PrepareCommands) if Bebox::Node.count_all_nodes_by_type(project_root, 'nodes') > 0
end

#load_provision_commandsObject

Load provision commands if there are nodes prepared



43
44
45
# File 'lib/bebox/commands/project_commands.rb', line 43

def load_provision_commands
  (self.extend Bebox::ProvisionCommands) if Bebox::Node.count_all_nodes_by_type(project_root, 'prepared_nodes') > 0
end

#load_role_profile_commandsObject

Load role/profile commands



30
31
32
33
34
35
# File 'lib/bebox/commands/project_commands.rb', line 30

def load_role_profile_commands
  if Bebox::Node.count_all_nodes_by_type(project_root, 'nodes') > 0
    self.extend Bebox::RoleCommands
    self.extend Bebox::ProfileCommands
  end
end