Improved `service status` a bit.
parent
b202aa2b5c
commit
cd6fd4c81f
|
@ -343,12 +343,22 @@ class Service
|
||||||
end
|
end
|
||||||
|
|
||||||
def summary
|
def summary
|
||||||
"Name: #{name}\n" +
|
"%-16s #{name.colorize(:white).to_s}\n" % "Name:" +
|
||||||
"Environment: #{environment.name} (#{environment.type.to_s.downcase})\n" +
|
"%-16s #{environment.name.colorize(:white).to_s} (#{environment.type.to_s.downcase})\n" % "Environment:" +
|
||||||
(
|
(
|
||||||
if provides.size > 0
|
if provides.size > 0
|
||||||
"Provides:\n" +
|
"Provides:\n" +
|
||||||
(provides.map { |x| " - " + x.token + "\n" }).join
|
(provides.map { |x|
|
||||||
|
consumers = get_consumers(x.token)
|
||||||
|
|
||||||
|
consumers_string = if consumers.size > 0
|
||||||
|
consumers.map(&.full_id.colorize(:green).to_s).join ", "
|
||||||
|
else
|
||||||
|
"n/a".colorize(:yellow).to_s
|
||||||
|
end
|
||||||
|
|
||||||
|
" - %-12s #{consumers_string}\n" % "#{x.token}:"
|
||||||
|
}).join
|
||||||
else
|
else
|
||||||
""
|
""
|
||||||
end
|
end
|
||||||
|
@ -358,13 +368,26 @@ class Service
|
||||||
"Consumes:\n" +
|
"Consumes:\n" +
|
||||||
(@reference.consumes.map { |x|
|
(@reference.consumes.map { |x|
|
||||||
provider = @providers[x.token]?
|
provider = @providers[x.token]?
|
||||||
if provider
|
|
||||||
" - #{x.token} (from #{provider.id})\n"
|
provider_string = if provider
|
||||||
|
provider.full_id.colorize(:green).to_s
|
||||||
|
elsif x.optional
|
||||||
|
"n/a".colorize(:yellow).to_s
|
||||||
else
|
else
|
||||||
" - #{x.token} " +
|
"MISSING".colorize(:red).to_s
|
||||||
"(NOT CURRENTLY PROVIDED)".colorize(:red).to_s +
|
|
||||||
"\n"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
" - %-12s #{provider_string}\n" % x.token
|
||||||
|
}).join
|
||||||
|
else
|
||||||
|
""
|
||||||
|
end
|
||||||
|
) +
|
||||||
|
(
|
||||||
|
if @ports.size > 0
|
||||||
|
"Ports:\n" +
|
||||||
|
(@ports.map { |name, number|
|
||||||
|
" - %-12s #{number.colorize(:magenta).to_s}\n" % "#{name}:"
|
||||||
}).join
|
}).join
|
||||||
else
|
else
|
||||||
""
|
""
|
||||||
|
|
Loading…
Reference in New Issue