Created
July 8, 2012 18:00
-
-
Save wyldckat/3072070 to your computer and use it in GitHub Desktop.
enGrid Issue #22
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
Attachments for https://github.com/enGits/engrid/issues/22 | |
Here are some links that I gathered while trying to figure out how to automated the transfer process from MantisBT to Github Issues: | |
* https://gist.github.com/101002 | |
* https://gist.github.com/7f75ced1fa7576412901 | |
* http://stackoverflow.com/questions/7281304/migrate-bugzilla-issues-to-github-issue-tracker | |
* https://github.com/Bazai/pivotal2github/blob/master/import_issues.rb |
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
#encoding:UTF-8 | |
#!/usr/bin/env ruby | |
#Source: https://github.com/Bazai/pivotal2github/blob/master/import_issues.rb | |
require 'rubygems' | |
require 'csv' | |
require 'httparty' | |
require 'json' | |
require 'highline/import' | |
def get_input(prompt="Enter >",show = true) | |
ask(prompt) {|q| q.echo = show} | |
end | |
filename = ARGV.shift or raise "Enter Filepath to CSV as ARG1" | |
class GitHub | |
include HTTParty | |
base_uri 'https://api.github.com' | |
end | |
user = get_input("Enter Username >") | |
password = get_input("Enter Password >", "*") | |
GitHub.basic_auth user, password | |
visited_labels = [] | |
CSV.open filename, :headers => true do |csv| | |
csv.each do |r| | |
body = { | |
:title => r['Story'], | |
:body => r['Description'], | |
} | |
labels = [] | |
if r['Labels'] != '' | |
r['Labels'].split(',').each do |label| | |
label = label.strip | |
color ='' | |
3.times { | |
color << "%02x" % rand(255) | |
} | |
unless visited_labels.include? label | |
labels << {:name => label, :color =>color} | |
end | |
end | |
labels.each do |label| | |
p label | |
# this hack doesn't care if you have an existing label - it just errors and moves on like a zen master | |
# the server however is expected to be equally zen :D | |
visited_labels << label[:name] | |
label = GitHub.post '/repos/your_github_username/your_repository_name/labels', :body => JSON.generate(label) | |
p label | |
end | |
end | |
body[:labels] = r['Labels'].split(',').map {|l|l.strip} if r['Labels'] != '' | |
p json_body = JSON.generate(body) | |
issue = GitHub.post '/repos/your_github_username/your_repository_name/issues', :body => json_body | |
p issue | |
r.each do |f| | |
if f[0] == 'Note' | |
next unless f[1] | |
body = { :body => f[1] } | |
GitHub.post "/repos/Bazai/your_github_username/your_repository_name/#{issue.parsed_response['number']}/comments", :body => JSON.generate(body) | |
end | |
end | |
end | |
end |
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
#encoding:UTF-8 | |
#!/usr/bin/env ruby | |
#Based on: https://github.com/Bazai/pivotal2github/blob/master/import_issues.rb | |
# NOTE: this script ended up not being used, because it would take longer to code | |
# and test the script rather than transfering manually 20 reports... | |
require 'rubygems' | |
require 'csv' | |
require 'httparty' | |
require 'json' | |
require 'highline/import' | |
def get_input(prompt="Enter >",show = true) | |
ask(prompt) {|q| q.echo = show} | |
end | |
filename = ARGV.shift or raise "Enter Filepath to CSV as ARG1" | |
class GitHub | |
include HTTParty | |
base_uri 'https://api.github.com' | |
end | |
user = get_input("Enter Username >") | |
password = get_input("Enter Password >", "*") | |
GitHub.basic_auth user, password | |
CSV.open filename, :headers => true do |csv| | |
csv.each do |r| | |
body = { | |
:title => r['Summary'], | |
:body => r['Description'], | |
} | |
if r['Steps To Reproduce'] != '' | |
body[:body] += r['Steps To Reproduce'] | |
end | |
if r['Additional Information'] != '' | |
body[:body] += r['Additional Information'] | |
end | |
[ r['Category'] = ] case | |
when 'bug' | |
body[:labels] = ['bug'] | |
when 'feature request' | |
body[:labels] = ['enhancement'] | |
end | |
p json_body = JSON.generate(body) | |
issue = GitHub.post '/repos/your_github_username/your_repository_name/issues', :body => json_body | |
p issue | |
r.each do |f| | |
if f[0] == 'Note' | |
next unless f[1] | |
body = { :body => f[1] } | |
GitHub.post "/repos/your_github_username/your_repository_name/#{issue.parsed_response['number']}/comments", :body => JSON.generate(body) | |
end | |
end | |
end | |
end |
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
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | Reporter | Assigned To | Priority | Status | Product Build | Projection | ETA | Platform | OS | OS Version | Product Version | Resolution | Summary | Description | Steps To Reproduce | Additional Information | Attached Files | Unknown | Username | Note Date | Note Message | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | bug | minor | always | 2011-01-27 09:57 | 2011-01-27 10:21 | username1 | username2 | low | resolved | none | none | version1.0 | fixed | 0 | test bug | This is a test bug to see if the BT works. | There are not additional info. | username2 | 2011-01-27 10:18 | Ok, it works! | |||||||
username2 | 2011-01-27 10:21 | Resolved in 1.1. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment