export-pull-requests 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/Changes +7 -1
  3. data/README.md +2 -1
  4. data/bin/epr +17 -2
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 929623e66a1f68647fabb6f245e3ca7215cd167c
4
- data.tar.gz: 6caa7e29e8fc21d83ef30b668f249a44e76529d4
3
+ metadata.gz: 1415cd62e08619538dbdec7223e66a1f60fab235
4
+ data.tar.gz: a58ad25901d787bbb288f9c1727993f2dc2fd68c
5
5
  SHA512:
6
- metadata.gz: 1db30f68f7b7dc619d7db177c322976cb8276cb47c9efa50315eb4c8ab2198bf9386f8c433591958d08f8530503a09fe54915c342b7591e01331fec6a37aacb5
7
- data.tar.gz: 2e0d613b81ca451402f4e772faff8872de6c4ab9dead6e2cc4d9e88d4ca0b2bae2c1b676420e4bf9091dd664c5ce821c0f99dfeca6f647b499a853a0822e5652
6
+ metadata.gz: 338d6bd1513bf8f18d654662a783e50d15aba5d5b5e2164dd745c8af033139e83533e5ef6966b2b44442a793697c054d54f8b6cd425d04c8b4d51330e0ac43bd
7
+ data.tar.gz: 2d562890c7fe9795cab0d11f1712e39cd47ace2c2e977493513622e5c4f3ea2b05b14f2e032c8f44ad671e5256ec870a75e6472cc473a3fea7eb0c64065577dc
data/Changes CHANGED
@@ -1,3 +1,9 @@
1
+ --------------------
2
+ v0.2.2 2018-11-30
3
+ --------------------
4
+ Enhancements:
5
+ * Add support for exporting issue body (GitHub only)
6
+
1
7
  --------------------
2
8
  v0.2.1 2018-06-05
3
9
  --------------------
@@ -26,4 +32,4 @@ Enhancements:
26
32
  * Add support for GitLab
27
33
 
28
34
  Changes:
29
- * Do not require a token
35
+ * Do not require a token
data/README.md CHANGED
@@ -16,7 +16,8 @@ This installs the `epr` executable.
16
16
 
17
17
  ## Usage
18
18
 
19
- usage: epr [-hv] [-e url] [-s state] [-t token] [-c user1,user2...] user/repo1 [user/repo2...]
19
+ usage: epr [-bhv] [-e url] [-s state] [-t token] [-c user1,user2...] user/repo1 [user/repo2...]
20
+ -b, --body Include the issue/pr body description in the output (GitHub only)
20
21
  -c, --creator=USER1,USER2,... Export PRs created by given username(s); prepend `!' to exclude user
21
22
  -e, --endpoint=URL Endpoint URL for 'enterprise', etc... repositories
22
23
  -h, --help Show this message
data/bin/epr CHANGED
@@ -9,7 +9,7 @@ require "github_api"
9
9
  require "gitlab"
10
10
  require "bitbucket_rest_api"
11
11
 
12
- VERSION = "0.2.1"
12
+ VERSION = "0.2.2"
13
13
  SERVICES = %w[github gitlab bitbucket]
14
14
  GIT_CONFIGS = %w[epr.token github.oauth-token]
15
15
 
@@ -19,6 +19,8 @@ TYPE_PR = "PR"
19
19
  EXPORT_ISSUES = "issues"
20
20
  EXPORT_PRS = "pr"
21
21
 
22
+ DEFAULT_BODY_LENGTH = 2 ** 32 - 1
23
+
22
24
  def localtime(t)
23
25
  Time.parse(t).localtime.strftime("%x %X")
24
26
  end
@@ -155,6 +157,13 @@ def github(user, repo)
155
157
  localtime(item.updated_at),
156
158
  item.html_url,
157
159
  ]
160
+
161
+ if $body
162
+ body = item.body
163
+ # -3 for "..."
164
+ body = body.slice(0, DEFAULT_BODY_LENGTH - 3) << "..." if body.size > DEFAULT_BODY_LENGTH unless body == nil
165
+ rows[-1].insert(4, body)
166
+ end
158
167
  end
159
168
  end
160
169
 
@@ -202,6 +211,7 @@ end
202
211
  def export_repos(argv)
203
212
  rows = []
204
213
  rows << %w[Repository Type # User Title State Created Updated URL]
214
+ rows[-1].insert(4, "Body") if $body
205
215
 
206
216
  repos = parse_repos(argv)
207
217
  repos.each do |user, repo|
@@ -232,9 +242,14 @@ $endpoint = nil
232
242
  $filter = "open"
233
243
  $provider = ENV["EPR_SERVICE"] || SERVICES[0]
234
244
  $token = lookup_token
245
+ $body = false
235
246
 
236
247
  parser = OptionParser.new do |opts|
237
- opts.banner = "usage: #{File.basename($0)} [-hv] [-e url] [-s state] [-t token] [-c user1,user2...] user/repo1 [user/repo2...]"
248
+ opts.banner = "usage: #{File.basename($0)} [-bhv] [-e url] [-s state] [-t token] [-c user1,user2...] user/repo1 [user/repo2...]"
249
+
250
+ opts.on "-b", "--body", "Include the issue/pr body description in the output (GitHub only)" do
251
+ $body = true
252
+ end
238
253
 
239
254
  opts.on "-c", "--creator=USER1,USER2,...", Array, "Export PRs created by given username(s); prepend `!' to exclude user" do |u|
240
255
  $exclude_users, $include_users = u.partition { |name| name.start_with?("!") }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: export-pull-requests
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Skye Shaw
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-08 00:00:00.000000000 Z
11
+ date: 2018-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: github_api