-
-
Save acook/9006975 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TracJob | |
def initialize action, repo, rev | |
@action, @repo, @rev = action, repo, rev | |
end | |
attr :action, :repo, :rev, :failures | |
def run trac_projs | |
trac_projs.each do |project| | |
success = trac_admin_success? project | |
failures << tp unless success | |
end | |
retry | |
end | |
def trac_admin_success? trac_proj | |
system("echo '#{TRAC_ADMIN} #{trac_proj} changeset #{action} #{repo} #{rev}'") | |
end | |
def retry | |
count = 0 | |
while !failures.empty? && count < 4 | |
failures.each do |failure| | |
failures.delete(failure) if trac_admin_success? failure | |
end | |
count += 1 | |
sleep 5 | |
end | |
end | |
def failures | |
@failures ||= Array.new | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment