241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
|
# File 'lib/cerberus/manager.rb', line 241
def run
projects = Dir["#{HOME}/config/*.yml"].sort.map { |fn| fn.gsub(/.*\/(.*).yml$/, '\1') }
if projects.empty?
puts "There are not any active projects"
else
delim = ' | '
cols = [
['Project Name', 30, lambda { |p, s| p }],
['Revision', 10, lambda { |p, s| "#{s.revision.to_s.slice( 0, 8 ) }"}],
['Status', 10, lambda { |p, s| s.previous_build_successful ? 'Pass' : 'Fail' }],
['Last Success', 10, lambda { |p, s| "#{s.successful_build_revision.to_s.slice( 0, 8 )}"}],
]
= cols.map { |head, size, lamb| head.ljust(size) }.join(delim)
puts '-' * .length
puts
puts '-' * .length
projects.each do |proj|
status = Status.read("#{HOME}/work/#{proj}/status.log")
row = cols.map { |head, size, lamb| lamb.call(proj, status).to_s.ljust(size) }.join(delim)
puts status.previous_build_successful ? ansi_green(row) : ansi_red(row)
end
puts '-' * .length
end
end
|