Module: HomeQ::Base::Commando::InstanceMethods

Extended by:
ClassMethods
Includes:
CP::Commands
Included in:
HomeQ::Base::Configuration::Configuration
Defined in:
lib/homeq/base/commando.rb,
lib/homeq/sobs/topology.rb,
lib/homeq/sobs/server.rb,
lib/homeq/cp/commands.rb,
lib/homeq/base/system.rb,
lib/homeq/base/logger.rb,
lib/homeq/sobs/queue.rb,
lib/homeq/cp/server.rb

Overview

Make our config info available

Instance Method Summary collapse

Methods included from ClassMethods

config_accessor, document_command

Methods included from CP::Commands

#close, #help, #shutdown

Instance Method Details

#add_breakpoint(file, line, expr) ⇒ Object



58
59
60
# File 'lib/homeq/base/system.rb', line 58

def add_breakpoint(file, line, expr)
  sys.add_breakpoint(file, line, expr)
end

#config_file(filename = nil) ⇒ Object



65
66
67
68
# File 'lib/homeq/base/system.rb', line 65

def config_file(filename=nil)
  return sys.config_file unless filename
  sys.config_file = filename
end

#debug_nowObject



55
56
57
# File 'lib/homeq/base/system.rb', line 55

def debug_now
  sys.debug_now
end

#disable_debuggingObject



52
53
54
# File 'lib/homeq/base/system.rb', line 52

def disable_debugging
  sys.disable_debugging
end

#enable_debugging(*args) ⇒ Object



49
50
51
# File 'lib/homeq/base/system.rb', line 49

def enable_debugging(*args)
  sys.enable_debugging
end

#log_file(*args) ⇒ Object



40
41
42
# File 'lib/homeq/base/logger.rb', line 40

def log_file(*args)
  HomeQ::Base::Logging::Logger.instance.log_file(*args)
end

#log_level(*args) ⇒ Object



37
38
39
# File 'lib/homeq/base/logger.rb', line 37

def log_level(*args)
  HomeQ::Base::Logging::Logger.instance.log_level(*args)
end

#pid_file(filename = nil) ⇒ Object



61
62
63
64
# File 'lib/homeq/base/system.rb', line 61

def pid_file(filename=nil)
  return sys.pid_file unless filename
  sys.pid_file = filename
end

#queue(queuename, &block) ⇒ Object



44
45
46
47
48
# File 'lib/homeq/sobs/topology.rb', line 44

def queue(queuename, &block)
  sys.topology.queue(queuename) { |q|
    q.instance_eval(&block)
  }
end

#show_commandsObject



59
60
61
62
63
64
65
66
# File 'lib/homeq/base/commando.rb', line 59

def show_commands
  str = ''
  CommandScheme.instance.command_list.keys.sort.each {|name|
    help = CommandScheme.instance.command_list[name]
    str << "#{'%-24s' % name}: #{help}\n"
  }
  str
end

#show_queue(queuename) ⇒ Object



80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/homeq/base/system.rb', line 80

def show_queue(queuename)
  unless queuename.is_a?(String)
    return "Supply a queue name in string format, plz."
  end
  found = sys.servers.find { |s|
    s.queue_name == queuename
  }
  found ||= sys.queues.find { |s|
    s.queue_name == queuename
  }
  found || "Can't find that queue"
end

#show_queue_listObject



92
93
94
# File 'lib/homeq/base/system.rb', line 92

def show_queue_list
  sys.servers.to_s + "\n" + sys.queues.to_s
end

#start_profilingObject



41
42
43
# File 'lib/homeq/base/system.rb', line 41

def start_profiling
  sys.start_profiling
end

#stop_profilingObject



44
45
46
# File 'lib/homeq/base/system.rb', line 44

def stop_profiling
  sys.stop_profiling
end

#syslogObject



43
44
45
# File 'lib/homeq/base/logger.rb', line 43

def syslog
  HomeQ::Base::Logging::Logger.instance.syslog
end

#topologyObject



37
38
39
40
41
42
43
# File 'lib/homeq/sobs/topology.rb', line 37

def topology
  if block_given?
    yield
  else
    sys.topology
  end
end