Class: Blitz

Inherits:
Object
  • Object
show all
Extended by:
Helper
Defined in:
lib/blitz.rb,
lib/blitz/curl.rb,
lib/blitz/utils.rb,
lib/blitz/client.rb,
lib/blitz/helper.rb,
lib/blitz/command.rb,
lib/blitz/curl/rush.rb,
lib/blitz/curl/error.rb,
lib/blitz/traceroute.rb,
lib/blitz/command/api.rb,
lib/blitz/curl/sprint.rb,
lib/blitz/command/curl.rb,
lib/blitz/command/help.rb,
lib/blitz/command/couch.rb,
lib/blitz/command/account.rb,
lib/blitz/command/version.rb,
lib/blitz/traceroute/error.rb,
lib/blitz/command/traceroute.rb

Overview

:nodoc:

Defined Under Namespace

Modules: Helper, Utils Classes: Client, Command, Curl, Traceroute

Constant Summary collapse

Version =
"0.1.25"

Class Method Summary collapse

Methods included from Helper

ask, error, msg

Class Method Details

.run(cmd, argv) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/blitz.rb', line 14

def self.run cmd, argv
    kname, mname = cmd.split(':', 2)
    klass = Blitz::Command.const_get kname.capitalize rescue nil
    mname ||= 'default'
    mname = "cmd_#{mname}".to_sym
    if klass and klass < Blitz::Command and klass.method_defined? mname
        command = klass.new
        begin
            command.send mname, argv
        rescue Test::Unit::AssertionFailedError, ArgumentError => e
            error e.message.chomp('.')
        end
    else
        error "Unknown command #{cmd}"
    end        
end