github_issue_exporter 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/export-github-issues +2 -1
- data/lib/issue_exporter/export.rb +21 -3
- data/lib/issue_exporter/github.rb +4 -5
- data/lib/issue_exporter/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44d52955013bc1e5eb31bba08f3cb7fd220634dd
|
4
|
+
data.tar.gz: 55d4cc5ab13cf8635af65fd0502710dac8f84612
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa3cec10e92e0b5ff83b42569c228ecaa6f877e6ed674ddd4e09913ac0287d44586a6ebcdbb7018a6eac574c8a3f266f65218f5f8428aee054b3f914b47b6452
|
7
|
+
data.tar.gz: fafc5957ba66bc1eb29760fccdc020a5e2636b42a5c875d57fecefab8949be89ebd18f8684e012650039d4d56ae7178f899201ee7c7e578f9424113a38815e8e
|
data/bin/export-github-issues
CHANGED
@@ -75,7 +75,8 @@ HERE
|
|
75
75
|
options = { path: @output,
|
76
76
|
multiple_files: @multiple_files,
|
77
77
|
include_closed_issues: @include_closed_issues,
|
78
|
-
output_type: @output_type
|
78
|
+
output_type: @output_type,
|
79
|
+
page_size: true }
|
79
80
|
exporter = IssueExporting::Exporter.new(@owner, @repo, @token, options)
|
80
81
|
exporter.export
|
81
82
|
end
|
@@ -7,7 +7,7 @@ module IssueExporting
|
|
7
7
|
|
8
8
|
attr_accessor :outputter
|
9
9
|
|
10
|
-
def initialize(owner, repo, token = nil, options = {})
|
10
|
+
def initialize(owner, repo, token = nil, options = { page_size: true })
|
11
11
|
@owner = owner
|
12
12
|
@repo = repo
|
13
13
|
@token = token
|
@@ -19,7 +19,8 @@ module IssueExporting
|
|
19
19
|
|
20
20
|
def export
|
21
21
|
error_handler = ErrorHandler.new
|
22
|
-
url = IssueExporting.make_uri @owner, @repo, @token
|
22
|
+
url = IssueExporting.make_uri @owner, @repo, @token
|
23
|
+
url.query += build_query_string @options
|
23
24
|
response = Net::HTTP::get url
|
24
25
|
if err = error_handler.error_message(response)
|
25
26
|
error_handler.handle_error err
|
@@ -28,7 +29,24 @@ module IssueExporting
|
|
28
29
|
end
|
29
30
|
end
|
30
31
|
|
31
|
-
|
32
|
+
def build_query_string(options)
|
33
|
+
values = {
|
34
|
+
include_closed_issues: 'state=all',
|
35
|
+
page_size: 'per_page=100'
|
36
|
+
}
|
37
|
+
qs = options.reduce([]) do |arr, kv|
|
38
|
+
key, val = kv
|
39
|
+
query_value = values[key] if val
|
40
|
+
if query_value.nil?
|
41
|
+
arr
|
42
|
+
else
|
43
|
+
arr.push(query_value) unless query_value.nil?
|
44
|
+
end
|
45
|
+
end
|
46
|
+
if qs == [] then return '' end
|
47
|
+
return '&' + qs.join('&')
|
48
|
+
end
|
49
|
+
|
32
50
|
def build_outputter(outputter_options)
|
33
51
|
output_type = outputter_options[:output_type] || 'file'
|
34
52
|
case output_type
|
@@ -3,15 +3,14 @@ module IssueExporting
|
|
3
3
|
"https://api.github.com/repos/%s/%s/issues?access_token=%s"
|
4
4
|
end
|
5
5
|
|
6
|
-
def self.make_url(owner, repo, token
|
6
|
+
def self.make_url(owner, repo, token)
|
7
7
|
url_format = IssueExporting.api_url
|
8
8
|
root_url = url_format % [owner, repo, token]
|
9
|
-
return root_url
|
10
|
-
root_url + "&state=all"
|
9
|
+
return root_url
|
11
10
|
end
|
12
11
|
|
13
|
-
def self.make_uri(owner, repo, token
|
14
|
-
URI(IssueExporting.make_url(owner, repo, token
|
12
|
+
def self.make_uri(owner, repo, token)
|
13
|
+
URI(IssueExporting.make_url(owner, repo, token))
|
15
14
|
end
|
16
15
|
|
17
16
|
def self.turn_options_into_querystring(options)
|