Class: Miu::CLI
Class Method Summary collapse
Instance Method Summary collapse
- #cat(tag, room, text) ⇒ Object
- #init ⇒ Object
- #list ⇒ Object
- #monitor(node = :all, *args) ⇒ Object
- #reload(*args) ⇒ Object
- #restart(node = :all, *args) ⇒ Object
- #server ⇒ Object
- #start(node = :all, *args) ⇒ Object
- #status(node = :all, *args) ⇒ Object
- #stop(node = :all, *args) ⇒ Object
- #supervise(*args) ⇒ Object
- #terminate(*args) ⇒ Object
- #unmonitor(node = :all, *args) ⇒ Object
- #version ⇒ Object
Class Method Details
.destination_root ⇒ Object
12 13 14 |
# File 'lib/miu/cli.rb', line 12 def destination_root Miu.root end |
.source_root ⇒ Object
8 9 10 |
# File 'lib/miu/cli.rb', line 8 def source_root File.('../templates', __FILE__) end |
Instance Method Details
#cat(tag, room, text) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/miu/cli.rb', line 56 def cat(tag, room, text) require 'miu/messages' publisher = Miu::Publisher.new :host => [:host], :port => [:port] = Miu::Messages::Text.new do |m| m.network.name = [:network] m.content.tap do |c| c.room.name = room c.text = text end end packet = publisher.write tag, Miu::Logger.info packet.inspect rescue => e Miu::Logger.exception e end |
#init ⇒ Object
24 25 26 27 28 |
# File 'lib/miu/cli.rb', line 24 def init directory 'config' empty_directory 'log' empty_directory 'tmp/pids' end |
#list ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/miu/cli.rb', line 31 def list table = Miu.nodes.map do |name, node| [name, "# #{node.description}"] end say 'Nodes:' print_table table, :indent => 2, :truncate => true end |
#monitor(node = :all, *args) ⇒ Object
110 111 112 113 |
# File 'lib/miu/cli.rb', line 110 def monitor(node = :all, *args) args.unshift 'monitor', node run_god *args end |
#reload(*args) ⇒ Object
128 129 130 131 |
# File 'lib/miu/cli.rb', line 128 def reload(*args) args.unshift "load #{Miu.root.join(Miu.default_god_config)}" run_god *args end |
#restart(node = :all, *args) ⇒ Object
104 105 106 107 |
# File 'lib/miu/cli.rb', line 104 def restart(node = :all, *args) args.unshift 'restart', node run_god *args end |
#server ⇒ Object
47 48 49 50 |
# File 'lib/miu/cli.rb', line 47 def server server = Miu::Server.new Miu::Utility.optionify_keys() server.run end |
#start(node = :all, *args) ⇒ Object
92 93 94 95 |
# File 'lib/miu/cli.rb', line 92 def start(node = :all, *args) args.unshift 'start', node run_god *args end |
#status(node = :all, *args) ⇒ Object
122 123 124 125 |
# File 'lib/miu/cli.rb', line 122 def status(node = :all, *args) args.unshift 'status', node run_god *args end |
#stop(node = :all, *args) ⇒ Object
98 99 100 101 |
# File 'lib/miu/cli.rb', line 98 def stop(node = :all, *args) args.unshift 'stop', node run_god *args end |
#supervise(*args) ⇒ Object
74 75 76 77 78 79 80 81 82 83 |
# File 'lib/miu/cli.rb', line 74 def supervise(*args) args.unshift( 'god', "-c #{Miu.root.join(Miu.default_god_config)}", "-l #{Miu.root.join('log/god.log')}", '--no-syslog', '--no-events', ) run args.join(' '), :verbose => false end |
#terminate(*args) ⇒ Object
86 87 88 89 |
# File 'lib/miu/cli.rb', line 86 def terminate(*args) args.unshift 'terminate' run_god *args end |
#unmonitor(node = :all, *args) ⇒ Object
116 117 118 119 |
# File 'lib/miu/cli.rb', line 116 def unmonitor(node = :all, *args) args.unshift 'unmonitor', node run_god *args end |