Skip to content

Instantly share code, notes, and snippets.

@acook
Forked from anonymous/gist:9006967
Last active August 29, 2015 13:56
Show Gist options
  • Save acook/9006975 to your computer and use it in GitHub Desktop.
Save acook/9006975 to your computer and use it in GitHub Desktop.
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