Skip to content

Commit

Permalink
add 'cerberus status' command
Browse files Browse the repository at this point in the history
  • Loading branch information
cpjolicoeur committed May 22, 2009
1 parent a6f428b commit f5bb592
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
4 changes: 3 additions & 1 deletion Rakefile
Expand Up @@ -149,13 +149,15 @@ task :publish_news do
end

require 'webgen/webgentask'
task :generate_site => :webgen
task :generate_site => :webgen do

Webgen::WebgenTask.new do |t|
t.directory = File.join( File.dirname( __FILE__ ), 'doc/site')
t.clobber_outdir = true
end

end

task :publish_site => :generate_site do
sh %{scp -r -q doc/site/out/* #{RUBYFORGE_USER}@rubyforge.org:/var/www/gforge-projects/#{RUBYFORGE_PROJECT}/}
end
Expand Down
2 changes: 1 addition & 1 deletion lib/cerberus/constants.rb
Expand Up @@ -4,5 +4,5 @@ module Cerberus

LOCK_WAIT = 30 * 60 #30 minutes

VERSION = '0.4.5.1'
VERSION = '0.4.6'
end
26 changes: 16 additions & 10 deletions lib/cerberus/manager.rb
Expand Up @@ -241,9 +241,9 @@ def run
delim = ' | '
cols = [
['Project Name', 30, lambda { |p, s| p }],
['Revision', 10, lambda { |p, s| "r#{s.revision }"}],
['Revision', 10, lambda { |p, s| "r#{s.revision.slice( 0, 8 ) }"}],
['Status', 10, lambda { |p, s| s.previous_build_successful ? 'Pass' : 'Fail' }],
['Last Success', 10, lambda { |p, s| "r#{s.successful_build_revision}"}],
['Last Success', 10, lambda { |p, s| "r#{s.successful_build_revision.slice( 0, 8 )}"}],
]
header = cols.map { |head, size, lamb| head.ljust(size) }.join(delim)
puts '-' * header.length
Expand All @@ -254,6 +254,7 @@ def run
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 '-' * header.length
end
end

Expand All @@ -271,15 +272,18 @@ def ansi_escape(code, str)

end

#Fields that are contained in status file
# successful (true mean previous build was successful, otherwise - false)
# timestamp
# revision
# brokeness
# successful_build_timestamp
# successful_build_revision
#
# Fields that are contained in status file
#
# successful_build_timestamp
# timestamp
# successful (true mean previous build was successful, otherwise - false)
# revision
# brokeness
# successful_build_revision
#
class Status
attr_reader :previous_build_successful, :previous_brokeness, :current_build_successful, :current_brokeness
attr_reader :previous_build_successful, :previous_brokeness, :current_build_successful, :current_brokeness, :revision, :successful_build_revision

def initialize(param)
if param.is_a? Hash
Expand All @@ -304,6 +308,8 @@ def initialize(param)
@already_kept = false
end

@revision = @hash['revision']
@successful_build_revision = @hash['successful_build_revision']
@previous_build_successful = @hash['successful']
@previous_brokeness = @hash['brokeness']
end
Expand Down

0 comments on commit f5bb592

Please sign in to comment.