Class: WeBee::Commands::Enterprise

Inherits:
WeBee::Command show all
Includes:
Mixlib::CLI
Defined in:
lib/webee/commands/enterprise.rb

Instance Method Summary collapse

Methods inherited from WeBee::Command

execute, #help, #initialize, list_all, print_help

Constructor Details

This class inherits a constructor from WeBee::Command

Instance Method Details

#runObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/webee/commands/enterprise.rb', line 18

def run
  actions = %w{create}
  if not actions.include? ARGV.first
    $stderr.puts "Invalid action.\n\nAVAILABLE ACTIONS: #{actions.join(' ')}\n\n"
    return 
  else
    if config[:name].nil?
      $stderr.puts 'Invalid Enterprise name.'
      $stderr.puts opt_parser.help
      return
    end

    begin
      ::WeBee::Enterprise.create :name => config[:name]
    rescue Exception => e
      puts e.message
    end

  end
end