Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save johnboxall/41118 to your computer and use it in GitHub Desktop.
Save johnboxall/41118 to your computer and use it in GitHub Desktop.
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