Class: Thor::AppCmd

Inherits:
Application show all
Defined in:
lib/ThorCmd.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Application

#amqp_handle_failure, #amqp_loop, #amqp_start, #amqp_stop, #run

Constructor Details

#initialize(opts = {}) ⇒ AppCmd

Returns a new instance of AppCmd.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/ThorCmd.rb', line 27

def initialize(opts = {})
  super(ops)

  # AMQP options
  options[:amqp_host] = "localhost"
  options[:amqp_port] = 1234
  options[:amqp_user] = "user"
  options[:amqp_password] = "password"
  options[:amqp_vhost] = "my-vhost"

  options[:amqp_channel_master] = "master"

  initialize_optparser { |opts|
     ############################
    # AMQP Section
    ############################
    # AMQP Host
    opts.on( '-H', '--amqp-host STRING', "AMQP Server hostname") do |host|
      options[:amqp_host] = host
    end

    # AMQP Port
    opts.on( '-p', '--amqp-port NUM', "AMQP Server port number") do |port|
      options[:amqp_port] = port
    end

    # AMQP Username
    opts.on( '-u', '--amqp-user STRING', "AMQP Username") do |user|
      options[:amqp_user] = user
    end

    # AMQP Password
    opts.on( '-P', '--amqp-password STRING', "AMQP Password") do |password|
      options[:amqp_password] = password
    end

    # AMQP Vhost
    opts.on( '-V', '--amqp-vhost STRING', "AMQP Virtual Host") do |vhost|
      options[:amqp_vhost] = vhost
    end

    ## Channels
    # Channel Master
    opts.on( '-acm', '--amqp-channel-master STRING', "AMQP Channel Mastr") do |channel|
      options[:amqp_channel_master] = channel
    end
  }
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



25
26
27
# File 'lib/ThorCmd.rb', line 25

def options
  @options
end

#optparsObject

Returns the value of attribute optpars.



25
26
27
# File 'lib/ThorCmd.rb', line 25

def optpars
  @optpars
end

#request_exitObject

Returns the value of attribute request_exit.



25
26
27
# File 'lib/ThorCmd.rb', line 25

def request_exit
  @request_exit
end

Instance Method Details

#mainObject

Main entry-point



77
78
79
# File 'lib/ThorCmd.rb', line 77

def main
  super()
end