miga-base 0.7.0.0 → 0.7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/miga/cli/action/lair.rb +9 -1
- data/lib/miga/lair.rb +8 -0
- data/lib/miga/version.rb +1 -1
- data/test/lair_test.rb +13 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b79a03931c5bc07d34a5fd53d63dcc155f41f2aad1020765394270ebf15a04f1
|
4
|
+
data.tar.gz: b43f5bf76b3950dd661e1dabf30d919c666d344e8861fd7979b14d46ece66834
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e89a031d1a87dc0149211e70a2e261c1d0dd7ede6c9918ba643d45464e302ab055d04529bf91f1b1d9dc3f389fd47a0cdc2308d5fde48f1ebca0e1a28d3e862
|
7
|
+
data.tar.gz: b9c87948e5c2aedd1c35c16cc46cda04560cb4de7e396c7cbc1b0fb9bffae1a8039f9ab321d6844e968e2e16109de14a48eaf712b85c820506c76202ed629257
|
data/lib/miga/cli/action/lair.rb
CHANGED
@@ -15,6 +15,7 @@ class MiGA::Cli::Action::Lair < MiGA::Cli::Action
|
|
15
15
|
stop: 'Start an instance of the application',
|
16
16
|
run: 'Start the application and stay on top',
|
17
17
|
status: 'Show status (PID) of application instances',
|
18
|
+
list: 'List all daemons and their status',
|
18
19
|
terminate: 'Terminate all daemons in the lair and exit'
|
19
20
|
}.each { |k,v| opt.separator sprintf ' %*s%s', -33, k, v }
|
20
21
|
opt.separator ''
|
@@ -79,8 +80,15 @@ class MiGA::Cli::Action::Lair < MiGA::Cli::Action
|
|
79
80
|
|
80
81
|
def perform
|
81
82
|
cli.ensure_par(path: '-p')
|
82
|
-
|
83
|
+
case cli.operation.to_sym
|
84
|
+
when :terminate
|
83
85
|
MiGA::Lair.new(cli[:path]).terminate_daemons
|
86
|
+
when :list
|
87
|
+
o = []
|
88
|
+
MiGA::Lair.new(cli[:path]).each_daemon do |d|
|
89
|
+
o << [d.daemon_name, d.class, d.daemon_home, d.active?, d.last_alive]
|
90
|
+
end
|
91
|
+
cli.table(%w[name class path active last_alive], o)
|
84
92
|
else
|
85
93
|
k_opts = %i[json latency wait_for keep_inactive trust_timestamp name dry]
|
86
94
|
opts = Hash[k_opts.map { |k| [k, cli[k]] }]
|
data/lib/miga/lair.rb
CHANGED
@@ -113,6 +113,14 @@ class MiGA::Lair < MiGA::MiGA
|
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
|
+
##
|
117
|
+
# Perform block for each daemon, including the chief daemon
|
118
|
+
# if +include_self+.
|
119
|
+
def each_daemon(include_self = true)
|
120
|
+
yield(self) if include_self
|
121
|
+
each_project { |project| yield(MiGA::Daemon.new(project)) }
|
122
|
+
end
|
123
|
+
|
116
124
|
##
|
117
125
|
# Traverse directories checking MiGA projects
|
118
126
|
def check_directories
|
data/lib/miga/version.rb
CHANGED
@@ -10,7 +10,7 @@ module MiGA
|
|
10
10
|
# - Float representing the major.minor version.
|
11
11
|
# - Integer representing gem releases of the current version.
|
12
12
|
# - Integer representing minor changes that require new version number.
|
13
|
-
VERSION = [0.7,
|
13
|
+
VERSION = [0.7, 1, 0]
|
14
14
|
|
15
15
|
##
|
16
16
|
# Nickname for the current major.minor version.
|
data/test/lair_test.rb
CHANGED
@@ -90,4 +90,17 @@ class LairTest < Test::Unit::TestCase
|
|
90
90
|
out = capture_stderr { assert { lair.daemon_loop } }.string
|
91
91
|
assert_equal('', out)
|
92
92
|
end
|
93
|
+
|
94
|
+
def test_each_project
|
95
|
+
lair = MiGA::Lair.new($tmp)
|
96
|
+
y = []
|
97
|
+
lair.each_project { |p| y << p }
|
98
|
+
assert_equal(3, y.size)
|
99
|
+
assert_instance_of(MiGA::Project, y[0])
|
100
|
+
x = []
|
101
|
+
lair.each_daemon { |d| x << d }
|
102
|
+
assert_equal(4, x.size)
|
103
|
+
assert_instance_of(MiGA::Lair, x[0])
|
104
|
+
assert_instance_of(MiGA::Daemon, x[1])
|
105
|
+
end
|
93
106
|
end
|