Class: TyrantManager::Commands::List

Inherits:
TyrantManager::Command show all
Defined in:
lib/tyrant_manager/commands/list.rb

Overview

List all known instances that the manager knows about

Instance Attribute Summary

Attributes inherited from TyrantManager::Command

#manager, #options

Instance Method Summary collapse

Methods inherited from TyrantManager::Command

#after, #before, #command_name, command_name, #error, find, inherited, #initialize, list, #logger

Constructor Details

This class inherits a constructor from TyrantManager::Command

Instance Method Details

#runObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/tyrant_manager/commands/list.rb', line 14

def run
  manager.each_instance( options['instances'] ) do |instance|
    parts = []
    parts << ("%20s" % instance.name)
    parts << "port #{instance.configuration.port}"
    parts << instance.home_dir

    if instance.configuration.master_server then
      parts << "server id #{"%2d" % instance.configuration.server_id}"
      parts << "replicating from #{instance.configuration.master_server}:#{instance.configuration.master_port}"
    end
    puts parts.join(" : ")
  end
end