github-issue-importer 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +7 -0
- data/README.md +6 -0
- data/TODO.md +0 -1
- data/bin/github-issue-importer +16 -11
- data/github-issue-importer.gemspec +1 -1
- data/lib/github-issue-importer/launchpad.rb +24 -4
- data/lib/github-issue-importer/version.rb +1 -1
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f651d414251fa55a7df49d68e70b9950be97d6ae49112853edd61bdb91133331
|
4
|
+
data.tar.gz: 625ffb1a83b11ee250ec2868b654562b158cee3fef2cc6924946e4f749db48e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12f9c825656303da76046668bfe6981af48380b823059ea303bb131680e335396787c79058142b39759b341ca147ddc4b2e93d6c9fd0e7af890f37eaf6ee028b
|
7
|
+
data.tar.gz: 39d5008d3044eb9f1ba6190d73581b85a99859cef2b1cfa422f4e0226cc5247c5357956bcddc43c63af5fae4890a27f264acdc86c50f21c0ebed2f5a60592c09
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# 0.0.5 (2020-06-14)
|
2
|
+
|
3
|
+
* Fix crash on suspended Launchpad user (@Photon89)
|
4
|
+
* Fix crash on comments above size limit by trancating them (@Photon89)
|
5
|
+
* Sort bug with respect to creation date (@Photon89)
|
6
|
+
* Set links to attachments (@Photon89)
|
7
|
+
|
1
8
|
# 0.0.4 (2014-04-21)
|
2
9
|
|
3
10
|
* Support multiple pages of launchpad bugs (@johnf)
|
data/README.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# Project Status
|
2
|
+
|
3
|
+
All my projects have been on GitHub for a very long time, so I haven't personally used this tool in over two years. It really scratched a once off itch when I was moving some projects from LaunchPad.
|
4
|
+
|
5
|
+
While I probably won't do any work on it myself, I'm more than happy to take pull requests and I'll do releases based on those.
|
6
|
+
|
1
7
|
# github-issue-importer
|
2
8
|
|
3
9
|
Github Issue Importer imports bugs into github issues. Currently it only
|
data/TODO.md
CHANGED
data/bin/github-issue-importer
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'optimist'
|
4
4
|
require 'octokit'
|
5
5
|
|
6
6
|
require 'github-issue-importer'
|
@@ -14,7 +14,7 @@ unless nil.respond_to? :blank?
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
options =
|
17
|
+
options = Optimist::options do
|
18
18
|
banner <<-EOS
|
19
19
|
github-issue-importer imports bugs from a Launchpad project into github issues.
|
20
20
|
|
@@ -35,13 +35,13 @@ EOS
|
|
35
35
|
opt :'gh-repo', 'Github repository (e.g. johnf/github-issue-importer)', :type => String
|
36
36
|
end
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
Optimist::die :'lp-project', "Please specify a Launchpad project" if options[:'lp-project'].nil?
|
39
|
+
Optimist::die :'gh-login', "Please specify a GitHub login" if options[:'gh-login'].nil?
|
40
|
+
Optimist::die :'gh-token', "Please specify a GitHub token" if options[:'gh-token'].nil?
|
41
|
+
Optimist::die :'gh-repo', "Please specify a GitHub Repository" if options[:'gh-repo'].nil?
|
42
42
|
|
43
43
|
options[:'gh-repo-user'], options[:'gh-repo-name'] = options[:'gh-repo'].split('/')
|
44
|
-
|
44
|
+
Optimist::die :'gh-repo', "Please specify a valid GitHub Repository" if options[:'gh-repo-user'].nil? or options[:'gh-repo-name'].nil?
|
45
45
|
|
46
46
|
gh_client = Octokit::Client.new :access_token => options[:'gh-token']
|
47
47
|
|
@@ -74,7 +74,7 @@ bug_entries.each do |bug_entry|
|
|
74
74
|
bug_time = Time.parse(bug['date_created'])
|
75
75
|
|
76
76
|
body = "#{bug['description']}\n\n"
|
77
|
-
body += "Launchpad Details: [#LP#{bug['id']}](#{bug['web_link']}) #{bug_owner
|
77
|
+
body += "Launchpad Details: [#LP#{bug['id']}](#{bug['web_link']}) #{bug_owner} - #{bug_time}"
|
78
78
|
|
79
79
|
comments = launchpad.get_bug_comments bug
|
80
80
|
|
@@ -88,12 +88,17 @@ bug_entries.each do |bug_entry|
|
|
88
88
|
|
89
89
|
comments.shift # First comment is always the bug description
|
90
90
|
comments.each do |comment|
|
91
|
-
next if comment['content'].blank?
|
92
91
|
comment_owner = launchpad.get_owner comment
|
93
92
|
|
93
|
+
body = launchpad.get_comment_attachments comment
|
94
|
+
|
94
95
|
comment_time = Time.parse(comment['date_created'])
|
95
|
-
body
|
96
|
-
body
|
96
|
+
body += "#{comment['content']}\n\n"
|
97
|
+
if body.size > 65000
|
98
|
+
puts "Comment body too long, truncating!"
|
99
|
+
body = body[0,65000] + "\n\n... (comment truncated because it was too long)\n\n"
|
100
|
+
end
|
101
|
+
body += "Launchpad Details: [#LPC#{comment['id']}](#{comment['web_link']}) #{comment_owner} - #{comment_time}"
|
97
102
|
|
98
103
|
gh_client.add_comment gh_repo.full_name, issue.number, body
|
99
104
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'json'
|
2
|
-
require '
|
2
|
+
require 'net/http'
|
3
|
+
require 'uri'
|
3
4
|
|
4
5
|
module GithubIssueImporter
|
5
6
|
class Launchpad
|
@@ -20,7 +21,7 @@ module GithubIssueImporter
|
|
20
21
|
break unless url
|
21
22
|
end
|
22
23
|
|
23
|
-
entries
|
24
|
+
entries.sort_by! { |o| o['date_created'] }
|
24
25
|
end
|
25
26
|
|
26
27
|
def get_bug(id)
|
@@ -32,6 +33,19 @@ module GithubIssueImporter
|
|
32
33
|
get bug_link
|
33
34
|
end
|
34
35
|
|
36
|
+
def get_comment_attachments(comment)
|
37
|
+
comment_attachments_link = comment['bug_attachments_collection_link']
|
38
|
+
comment_attachments = get comment_attachments_link
|
39
|
+
body = ""
|
40
|
+
if !comment_attachments.nil?
|
41
|
+
comment_attachments['entries'].each do |attachment|
|
42
|
+
body += "Attachment: [#{attachment['title']}](#{attachment['data_link']})\n"
|
43
|
+
end
|
44
|
+
body += "\n"
|
45
|
+
end
|
46
|
+
return body
|
47
|
+
end
|
48
|
+
|
35
49
|
def get_bug_comments(id)
|
36
50
|
if id.is_a? Hash
|
37
51
|
bug_comments_link = id['messages_collection_link']
|
@@ -50,14 +64,20 @@ module GithubIssueImporter
|
|
50
64
|
end
|
51
65
|
|
52
66
|
if @owners[owner_link].nil?
|
53
|
-
|
67
|
+
response = Net::HTTP.get_response(URI.parse(owner_link)).body
|
68
|
+
if response.include? "User is suspended"
|
69
|
+
@owners[owner_link] = response[22,response.length].concat("suspended user'")
|
70
|
+
else
|
71
|
+
json = JSON.parse response
|
72
|
+
@owners[owner_link] = json['display_name']
|
73
|
+
end
|
54
74
|
end
|
55
75
|
|
56
76
|
@owners[owner_link]
|
57
77
|
end
|
58
78
|
|
59
79
|
def get(url)
|
60
|
-
JSON.parse
|
80
|
+
JSON.parse Net::HTTP.get_response(URI.parse(url)).body rescue nil
|
61
81
|
end
|
62
82
|
|
63
83
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github-issue-importer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Ferlito
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: optimist
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -105,8 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
105
|
- !ruby/object:Gem::Version
|
106
106
|
version: '0'
|
107
107
|
requirements: []
|
108
|
-
|
109
|
-
rubygems_version: 2.2.0
|
108
|
+
rubygems_version: 3.1.2
|
110
109
|
signing_key:
|
111
110
|
specification_version: 4
|
112
111
|
summary: Launchpad to Github bug importer
|