Sha256: 2b6239f66d56ff1e69950e5ae1cf522baed709da3ac7113e43d14be1e459cd86

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

module Bebox
  module CommandsHelper

    include Bebox::WizardsHelper

    # Obtain the environment from command parameters or menu
    def get_environment(options)
      environment = options[:environment]
      # Ask for environment of node if flag environment not set
      environment ||= choose_option(Environment.list(project_root), 'Choose an existing environment:')
      # Check environment existence
      Bebox::Environment.environment_exists?(project_root, environment) ? (return environment) : exit_now!(error("The '#{environment}' environment does not exist."))
    end

    # Obtain the default environment for a project
    def default_environment
      environments = Bebox::Environment.list(project_root)
      if environments.count > 0
        return environments.include?('vagrant') ? 'vagrant' : environments.first
      else
        return ''
      end
    end

    # Check if vagrant is installed on the machine
    def self.vagrant_installed?
      (`which vagrant`) == 'vagrant not found' ? false : true
    end

    # Check if the step argument is valid
    def self.valid_step?(step)
      steps = %w{step-0 step-1 step-2 step-3}
      steps.include?(step)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bebox-0.1.3 lib/bebox/commands/commands_helper.rb