Module: MSPRelease::CLI::ClassMethods

Included in:
MSPRelease::CLI
Defined in:
lib/msp_release/cli.rb

Overview

These are available on the CLI module

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#commandsObject (readonly)

Returns the value of attribute commands.



57
58
59
# File 'lib/msp_release/cli.rb', line 57

def commands
  @commands
end

Instance Method Details

#init_commandsObject



73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/msp_release/cli.rb', line 73

def init_commands
  @commands = {}
  COMMANDS.each do |name|
    require "msp_release/cli/#{name}"
    camel_name =
      name.split(/[^a-z0-9]/i).map{|w| w.capitalize}.join

    command = MSPRelease::CLI.const_get(camel_name)
    @commands[name] = command
    command.set_name(name)
    command.subcommand_of(Root)
  end
end

#run(args) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/msp_release/cli.rb', line 59

def run(args)
  init_commands

  Climate.with_standard_exception_handling do
    begin
      Root.run(args)
    rescue Exec::UnexpectedExitStatus => e
      $stderr.puts(e.message)
      $stderr.puts(e.stderr)
      exit 1
    end
  end
end