Created
December 29, 2008 01:13
-
-
Save johnboxall/41118 to your computer and use it in GitHub Desktop.
This file contains 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
require 'rubygems' | |
require 'Lighthouse' | |
# Update these settings to reflect your project: | |
Lighthouse.account = 'account' | |
Lighthouse.token = 'token' | |
project_id = 'your project id' | |
now = Time.now | |
current = nil # Will the the current milestone. | |
upcoming = nil # Will be the next milestone. | |
milestones = Lighthouse::Milestone.find(:all, :params => { :project_id => project_id }) | |
for milestone in milestones | |
if current.nil? or now > milestone.due_on | |
current = milestone | |
elsif upcoming.nil? or now < milestone.due_on | |
upcoming = milestone | |
break | |
end | |
end | |
# Lighthouse returns max 30 tickets - continue until no more tickets in the milestone. | |
loop do | |
params = { :project_id => project_id, :q=> "state:open milestone:\"#{current.title}\"" } | |
tickets = Lighthouse::Ticket.find(:all, :params => params) | |
break unless tickets != [] | |
for ticket in tickets | |
ticket.milestone_id = upcoming.id | |
ticket.save() | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment