Created
June 3, 2010 00:08
-
-
Save jon/423222 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
require 'rubygems' | |
require 'octopi' | |
require 'lighthouse' | |
require 'pp' | |
include Octopi | |
include Lighthouse | |
@username, @project, @lighthouse_account, @lighthouse_token, @lighthouse_project = ARGV | |
@issues = authenticated do | |
open = Issue.find_all(:user => @username, :repo => @project, :state => 'open') | |
closed = Issue.find_all(:user => @username, :repo => @project, :state => 'closed') | |
open + closed | |
end.sort do |i, j| | |
i.number - j.number | |
end | |
Lighthouse.account = @lighthouse_account | |
Lighthouse.token = @lighthouse_token | |
@project = Project.find(:all).detect do |p| | |
p.name == @lighthouse_project | |
end | |
raise "Unable to load project" if !@project | |
@issues.each do |issue| | |
ticket = Ticket.new(:project_id => @project.id) | |
ticket.title = issue.title | |
issue.labels do |label| | |
ticket.tags << label | |
end | |
ticket.body = issue.body | |
ticket.state = issue.state == 'open' ? issue.state : 'resolved' | |
ticket.save | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment