Skip to content

Instantly share code, notes, and snippets.

@rsofaer
Created October 10, 2010 05:32
Show Gist options
  • Select an option

  • Save rsofaer/618994 to your computer and use it in GitHub Desktop.

Select an option

Save rsofaer/618994 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'json'
json = JSON.parse(File.open("github_issues.json").read)
issues = json["issues"]
require 'redmine_client'
RedmineClient::Base.configure do
self.site = 'http://bugs.joindiaspora.com'
self.user = 'ilya'
self.password = '________'
end
issues.each {|issue|
tracker_id = 1
tracker_id = 2 if issue['labels'].include? 'feature request'
tracker_id = 4 if issue['labels'].include? 'documentation'
red_issue = RedmineClient::Issue.new(
:project_id => 1,
:tracker_id => tracker_id,
:subject => issue['title'],
:description => issue['body'] + "\n\n Posted on Github by #{issue['user']} on #{issue['created_at']}"
)
red_issue.category = RedmineClient::Issue::Category.new('name' => 'UI', 'id' => 4) if issue['labels'].include? 'UI'
red_issue.category = RedmineClient::Issue::Category.new('name' => 'Legal', 'id' => 2) if issue['labels'].include? 'copyright'
red_issue.category = RedmineClient::Issue::Category.new('name' => 'Security', 'id' => 1) if issue['labels'].include? 'security'
puts red_issue.inspect
comments = JSON.parse(`curl http://github.com/api/v2/json/issues/comments/diaspora/diaspora/#{issue['number']}/`)['comments']
comments ||= []
comments.each{|comment|
red_issue.description += "\n\n Posted on Github by #{issue['user']} on #{issue['created_at']} : \n \n" + comment['body']
}
red_issue.save
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment