Class: Canals::Cli::Session
- Inherits:
-
Thor
- Object
- Thor
- Canals::Cli::Session
show all
- Includes:
- Helpers, Thor::Actions
- Defined in:
- lib/canals/cli/session.rb
Instance Method Summary
collapse
Methods included from Helpers
#check_completion, #startup_checks, #trestart, #tstart, #tstop
Instance Method Details
#restart ⇒ Object
36
37
38
39
40
|
# File 'lib/canals/cli/session.rb', line 36
def restart
on_all_canals_in_session(:restart) do |name|
trestart(name)
end
end
|
#restore ⇒ Object
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/canals/cli/session.rb', line 24
def restore
on_all_canals_in_session(:restore) do |name|
if Canals.isalive? name
say "Canal #{name.inspect} is running."
else
Canals.session.del(name)
tstart(name)
end
end
end
|
#show ⇒ Object
13
14
15
16
17
18
19
20
21
|
# File 'lib/canals/cli/session.rb', line 13
def show
return if session_empty?
require 'terminal-table'
require 'canals/core_ext/string'
columns = ["pid", "name", "local_port", "socket"]
rows = Canals.session.map{ |s| columns.map{ |c| s[c.to_sym] || get_session_col_val(s, c) } }
table = Terminal::Table.new :headings => columns.map{|c| c.sub("_"," ").titleize }, :rows => rows
say table
end
|
#stop ⇒ Object
43
44
45
46
47
|
# File 'lib/canals/cli/session.rb', line 43
def stop
on_all_canals_in_session(:stop) do |name|
tstop(name)
end
end
|