miga-base 0.7.0.0 → 0.7.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 209e314b880d88c662aa9fbb04d62df7b4676e5d6af885e0cd23cea354accdec
4
- data.tar.gz: d7fd5f25b2132880374693773e4cd1d58a331aa34d06ba31be53a5926e47f0e0
3
+ metadata.gz: b79a03931c5bc07d34a5fd53d63dcc155f41f2aad1020765394270ebf15a04f1
4
+ data.tar.gz: b43f5bf76b3950dd661e1dabf30d919c666d344e8861fd7979b14d46ece66834
5
5
  SHA512:
6
- metadata.gz: d2e34541cd0191e36524aa1f0811fe3933837cdbc2fb550ced6692423ca873bc900b188ddd852a18839f3bb47a13a19cf9e9de60e65ed1b11c112f0bc217996d
7
- data.tar.gz: 1dd8e5a74546e47271fb0f35a983234364ce1e855d0ab6194c3782dabc5a82920504c99ca513409b7e6c60244fc9320c2ff88c0f041f72cbc83733332e605f39
6
+ metadata.gz: 9e89a031d1a87dc0149211e70a2e261c1d0dd7ede6c9918ba643d45464e302ab055d04529bf91f1b1d9dc3f389fd47a0cdc2308d5fde48f1ebca0e1a28d3e862
7
+ data.tar.gz: b9c87948e5c2aedd1c35c16cc46cda04560cb4de7e396c7cbc1b0fb9bffae1a8039f9ab321d6844e968e2e16109de14a48eaf712b85c820506c76202ed629257
@@ -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
- if cli.operation.to_sym == :terminate
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, 0, 0]
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miga-base
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0.0
4
+ version: 0.7.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis M. Rodriguez-R