Module: Qcmd
- Extended by:
- Plaintext
- Defined in:
- lib/qcmd.rb,
lib/qcmd/cli.rb,
lib/qcmd/action.rb,
lib/qcmd/parser.rb,
lib/qcmd/aliases.rb,
lib/qcmd/context.rb,
lib/qcmd/handler.rb,
lib/qcmd/history.rb,
lib/qcmd/machine.rb,
lib/qcmd/network.rb,
lib/qcmd/version.rb,
lib/qcmd/commands.rb,
lib/qcmd/qlab/cue.rb,
lib/qcmd/plaintext.rb,
lib/qcmd/qlab/reply.rb,
lib/qcmd/configuration.rb,
lib/qcmd/qlab/cue_list.rb,
lib/qcmd/qlab/workspace.rb,
lib/qcmd/input_completer.rb
Defined Under Namespace
Modules: Commands, InputCompleter, Parser, Plaintext, QLab
Classes: Action, Aliases, CLI, Configuration, Context, CueAction, Handler, History, Machine, Network
Constant Summary
collapse
- LEVELS =
%w(debug info warning error none)
- VERSION =
"0.1.9"
Class Attribute Summary collapse
Class Method Summary
collapse
Methods included from Plaintext
ascii_qlab, centered_text, columns, joined_wrapped, log, pluralize, print, print_wrapped, right_text, set_columns, split_text, table, word_wrap, wrapped_text
Class Attribute Details
.context ⇒ Object
Returns the value of attribute context.
37
38
39
|
# File 'lib/qcmd.rb', line 37
def context
@context
end
|
.debug_mode ⇒ Object
Returns the value of attribute debug_mode.
36
37
38
|
# File 'lib/qcmd.rb', line 36
def debug_mode
@debug_mode
end
|
Class Method Details
.connected? ⇒ Boolean
96
97
98
|
# File 'lib/qcmd.rb', line 96
def connected?
!!context && !!context.machine && !context.machine.nil?
end
|
.debug(message) ⇒ Object
84
85
86
87
88
89
90
|
# File 'lib/qcmd.rb', line 84
def debug message
Qcmd::Configuration.log.puts "[%s] %s" % [Time.now.strftime('%T'), message]
log(:debug, message)
end
|
.debug? ⇒ Boolean
80
81
82
|
# File 'lib/qcmd.rb', line 80
def debug?
!!debug_mode
end
|
.log_level ⇒ Object
41
42
43
|
# File 'lib/qcmd.rb', line 41
def log_level
@log_level ||= :info
end
|
.log_level=(value) ⇒ Object
45
46
47
48
49
50
51
|
# File 'lib/qcmd.rb', line 45
def log_level=(value)
if LEVELS.include?(value.to_s)
@log_level = value
else
raise "Invalid log_level value: #{ value.to_s }"
end
end
|
.log_level_acheived?(level) ⇒ Boolean
92
93
94
|
# File 'lib/qcmd.rb', line 92
def log_level_acheived? level
LEVELS.index(level.to_s) >= LEVELS.index(log_level.to_s)
end
|
.quiet! ⇒ Object
57
58
59
|
# File 'lib/qcmd.rb', line 57
def quiet!
self.log_level = :warning
end
|
.quiet? ⇒ Boolean
69
70
71
|
# File 'lib/qcmd.rb', line 69
def quiet?
self.log_level == :warning
end
|
.silent! ⇒ Object
61
62
63
|
# File 'lib/qcmd.rb', line 61
def silent!
self.log_level = :none
end
|
.silent? ⇒ Boolean
65
66
67
|
# File 'lib/qcmd.rb', line 65
def silent?
self.log_level == :none
end
|
.verbose! ⇒ Object
53
54
55
|
# File 'lib/qcmd.rb', line 53
def verbose!
self.log_level = :debug
end
|
.while_quiet ⇒ Object
73
74
75
76
77
78
|
# File 'lib/qcmd.rb', line 73
def while_quiet
previous_level = self.log_level
self.log_level = :warning
yield
self.log_level = previous_level
end
|