Sha256: 9ca06e0af6957afc3cd5126f145742ea6abc13888651e72a7262ed25eba9576c

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

module Bebox
  module ProjectCommands

    include Bebox::CommandsHelper

    def self.extended(base)
      base.load_commands
    end

    def load_commands
      load_environment_commands
      load_node_commands
      load_prepare_commands
      load_provision_commands
    end

    # Load environment commands
    def load_environment_commands
      self.extend Bebox::EnvironmentCommands
    end

    # Load node commands if there are environments configured
    def load_node_commands
       Bebox::Environment.list(project_root).count > 0 ? (self.extend Bebox::NodeCommands) : return
    end

    # Load prepare commands if there are at least one node
    def load_prepare_commands
      Bebox::Node.count_all_nodes_by_type(project_root, 'nodes') > 0 ? (self.extend Bebox::PrepareCommands) : return
    end

    # Load provision commands if there are nodes prepared
    def load_provision_commands
      Bebox::Node.count_all_nodes_by_type(project_root, 'prepared_nodes') > 0 ? (self.extend Bebox::ProvisionCommands) : return
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bebox-0.1.2 lib/bebox/commands/project_commands.rb
bebox-0.1.1 lib/bebox/commands/project_commands.rb
bebox-0.1.0 lib/bebox/commands/project_commands.rb