huborg 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +34 -0
- data/README.md +18 -2
- data/huborg.gemspec +2 -1
- data/lib/huborg.rb +43 -9
- data/lib/huborg/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77b0a3fbcce8421c99cb40deb90fd3428b85ac81f238ab0f8b5121d81299a57b
|
4
|
+
data.tar.gz: c4a93167f48a1cf45894e445872a583715df7b6dfe44f5710bd0b70ef1951fdc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e88edb17cbb567fef94563a2a2d060ee8140a5f9f5de0d10618253fb5da229efeac1485d05eaf942a5329afbe24209de021c28b8b8279914cd2291f276cf3126
|
7
|
+
data.tar.gz: 4ffc1475e19ac6b86c127d34c90037b2476e9e92b24b1cfbaeb7d9eb4086df94b380a7cd71b8f0c2a13ecfe57acb3427fdfa9f36672d1452d082d1fd611e2df2
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,36 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v0.3.0](https://github.com/samvera-labs/huborg/tree/v0.3.0) (2020-04-28)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/samvera-labs/huborg/compare/v0.2.0...v0.3.0)
|
6
|
+
|
7
|
+
**Fixed bugs:**
|
8
|
+
|
9
|
+
- Fixing gemspec's changelog\_uri [\#9](https://github.com/samvera-labs/huborg/pull/9) ([jeremyf](https://github.com/jeremyf))
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- Adding Huborg::Client\#each\_pull\_request\_with\_repo [\#10](https://github.com/samvera-labs/huborg/pull/10) ([jeremyf](https://github.com/jeremyf))
|
14
|
+
- Adding guidance on determining Semantic Versioning [\#8](https://github.com/samvera-labs/huborg/pull/8) ([jeremyf](https://github.com/jeremyf))
|
15
|
+
- Highlighting links to API documentation [\#7](https://github.com/samvera-labs/huborg/pull/7) ([jeremyf](https://github.com/jeremyf))
|
16
|
+
|
17
|
+
## [v0.2.0](https://github.com/samvera-labs/huborg/tree/v0.2.0) (2020-02-29)
|
18
|
+
|
19
|
+
[Full Changelog](https://github.com/samvera-labs/huborg/compare/v0.1.0...v0.2.0)
|
20
|
+
|
21
|
+
**Implemented enhancements:**
|
22
|
+
|
23
|
+
- Adding release process [\#4](https://github.com/samvera-labs/huborg/pull/4) ([jeremyf](https://github.com/jeremyf))
|
24
|
+
|
25
|
+
**Merged pull requests:**
|
26
|
+
|
27
|
+
- Tweaking documentation [\#5](https://github.com/samvera-labs/huborg/pull/5) ([jeremyf](https://github.com/jeremyf))
|
28
|
+
- Adding Huborg::Client\#synchronize\_mailmap! [\#3](https://github.com/samvera-labs/huborg/pull/3) ([jeremyf](https://github.com/jeremyf))
|
29
|
+
- Adding Huborg::Client\#audit\_license [\#2](https://github.com/samvera-labs/huborg/pull/2) ([jeremyf](https://github.com/jeremyf))
|
30
|
+
- Adding Huborg::Client\#clone\_and\_rebase! [\#1](https://github.com/samvera-labs/huborg/pull/1) ([jeremyf](https://github.com/jeremyf))
|
31
|
+
|
32
|
+
# Changelog
|
33
|
+
|
3
34
|
## [v0.2.0](https://github.com/samvera-labs/huborg/tree/v0.2.0) (2020-02-28)
|
4
35
|
|
5
36
|
[Full Changelog](https://github.com/samvera-labs/huborg/compare/v0.1.0...v0.2.0)
|
@@ -22,3 +53,6 @@
|
|
22
53
|
- Adding Huborg::Client\#push\_template! ([jeremyf](https://github.com/jeremyf))
|
23
54
|
|
24
55
|
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
56
|
+
|
57
|
+
|
58
|
+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# huborg
|
2
2
|
|
3
|
-
Code: [![Version](https://badge.fury.io/rb/huborg.
|
3
|
+
Code: [![Version](https://badge.fury.io/rb/huborg.svg)](https://rubygems.org/gems/huborg)
|
4
4
|
|
5
|
-
Docs: [![Contribution Guidelines](http://img.shields.io/badge/CONTRIBUTING-Guidelines-blue.svg)](./CONTRIBUTING.md)
|
5
|
+
Docs: [![Code Documentation](https://img.shields.io/badge/CODE-Documentation-blue.svg)](https://www.rubydoc.info/gems/huborg/) [![Contribution Guidelines](http://img.shields.io/badge/CONTRIBUTING-Guidelines-blue.svg)](./CONTRIBUTING.md)
|
6
6
|
[![Apache 2.0 License](http://img.shields.io/badge/APACHE2-license-blue.svg)](./LICENSE)
|
7
7
|
|
8
8
|
Jump in: [![Slack Status](http://slack.samvera.org/badge.svg)](http://slack.samvera.org/)
|
@@ -98,6 +98,21 @@ iterates on all of the repositories, adding any non-duplicates, then
|
|
98
98
|
writing back to the template before creating pull requests against
|
99
99
|
each of the organization's non-archived repositories.
|
100
100
|
|
101
|
+
```ruby
|
102
|
+
require 'huborg'
|
103
|
+
# NOTE: You will need to include GITHUB_ACCESS_TOKEN in your ENV
|
104
|
+
client = Huborg::Client.new(org_names: ["samvera", "samvera-labs"])
|
105
|
+
File.open(File.join(ENV["HOME"], "/Desktop/pull-requests.tsv"), "w+") do |file|
|
106
|
+
file.puts "REPO_FULL_NAME\tPR_CREATED_AT\tPR_URL\tPR_TITLE"
|
107
|
+
client.each_pull_request_with_repo do |pull, repo|
|
108
|
+
file.puts "#{repo.full_name}\t#{pull.created_at}\t#{pull.html_url}\t#{pull.title}"
|
109
|
+
end
|
110
|
+
end
|
111
|
+
```
|
112
|
+
|
113
|
+
The above will write a tab separated file of all of the open pull requests for
|
114
|
+
the non-archived samvera and samvera-labs repositories.
|
115
|
+
|
101
116
|
**All of the commands have several parameters, many set to default values.**
|
102
117
|
|
103
118
|
## Prerequisites
|
@@ -153,6 +168,7 @@ Below is the checklist:
|
|
153
168
|
- [ ] Pull down the latest version of master
|
154
169
|
- [ ] Update the Huborg::VERSION (in ./lib/huborg/version.rb); Remember, huborg
|
155
170
|
uses [Semantic Versioning](https://semver.org). (_**NOTE:** Do not commit the version change_)
|
171
|
+
- [ ] To give some insight on what version to use, you can use `yard diff`. With a clean master branch, run `yard`. Then run `yard diff huborg-<Huborg::VERSION> .yardoc` (where Huborg::VERSION is something like 0.1.0 and `.yarddoc` is the output directory of `yard`).
|
156
172
|
- [ ] Run `bundle exec rake changelog` to generate [CHANGELOG.md](./CHANGELOG.md)
|
157
173
|
- [ ] Review the new Huborg::VERSION CHANGELOG.md entries as they might prompt
|
158
174
|
you to consider a different version (e.g. what you thought was a bug fix
|
data/huborg.gemspec
CHANGED
@@ -13,7 +13,8 @@ Gem::Specification.new do |spec|
|
|
13
13
|
|
14
14
|
spec.metadata["homepage_uri"] = spec.homepage
|
15
15
|
spec.metadata["source_code_uri"] = "https://github.com/samvera-labs/huborg/"
|
16
|
-
spec.metadata["changelog_uri"] = "https://github.com/samvera-labs/huborg/CHANGELOG.md"
|
16
|
+
spec.metadata["changelog_uri"] = "https://github.com/samvera-labs/huborg/blob/master/CHANGELOG.md"
|
17
|
+
spec.metadata["documentation_uri"] = "https://www.rubydoc.info/gems/huborg/"
|
17
18
|
|
18
19
|
# Specify which files should be added to the gem when it is released.
|
19
20
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
data/lib/huborg.rb
CHANGED
@@ -256,6 +256,39 @@ module Huborg
|
|
256
256
|
true
|
257
257
|
end
|
258
258
|
|
259
|
+
# @api public
|
260
|
+
# @since v0.3.0
|
261
|
+
#
|
262
|
+
# Yield each pull request, and associated repository that matches the given
|
263
|
+
# parameters
|
264
|
+
#
|
265
|
+
# @param skip_archived [Boolean] skip any archived projects
|
266
|
+
# @param query [Hash] the query params to use when selecting pull requests
|
267
|
+
#
|
268
|
+
# @yieldparam [Oktokit::PullRequest] responds to #created_at, #title, #html_url, etc
|
269
|
+
# @yieldparam [Oktokit::Repository] responds to #full_name
|
270
|
+
#
|
271
|
+
# @example
|
272
|
+
# require 'huborg'
|
273
|
+
# client = Huborg::Client.new(org_names: ["samvera", "samvera-labs"])
|
274
|
+
# File.open(File.join(ENV["HOME"], "/Desktop/pull-requests.tsv"), "w+") do |file|
|
275
|
+
# file.puts "REPO_FULL_NAME\tPR_CREATED_AT\tPR_URL\tPR_TITLE"
|
276
|
+
# client.each_pull_request_with_repo do |pull, repo|
|
277
|
+
# file.puts "#{repo.full_name}\t#{pull.created_at}\t#{pull.html_url}\t#{pull.title}"
|
278
|
+
# end
|
279
|
+
# end
|
280
|
+
#
|
281
|
+
# @see https://developer.github.com/v3/pulls/#list-pull-requests
|
282
|
+
def each_pull_request_with_repo(skip_archived: true, query: { state: :open})
|
283
|
+
each_github_repository do |repo|
|
284
|
+
next if skip_archived && repo.archived?
|
285
|
+
fetch_rel_for(rel: :pulls, from: repo, query: query).each do |pull|
|
286
|
+
yield(pull, repo)
|
287
|
+
end
|
288
|
+
end
|
289
|
+
true
|
290
|
+
end
|
291
|
+
|
259
292
|
private
|
260
293
|
|
261
294
|
# Fetch all of the repositories for the initialized :org_names that
|
@@ -271,7 +304,7 @@ module Huborg
|
|
271
304
|
repos = []
|
272
305
|
org_names.each do |org_name|
|
273
306
|
org = client.org(org_name)
|
274
|
-
repos += fetch_rel_for(rel: :repos,
|
307
|
+
repos += fetch_rel_for(rel: :repos, from: org)
|
275
308
|
end
|
276
309
|
|
277
310
|
repos.each do |repo|
|
@@ -376,26 +409,27 @@ module Huborg
|
|
376
409
|
#
|
377
410
|
# @param rel [Symbol] The name of the related object(s) for the
|
378
411
|
# given org
|
379
|
-
# @param
|
380
|
-
#
|
412
|
+
# @param from [Object] The receiver of the rels method call. This could be
|
413
|
+
# but is not limited to an Oktokit::Organization or
|
414
|
+
# Oktokit::Repository.
|
381
415
|
#
|
382
416
|
# @return [Array<Object>]
|
383
|
-
def fetch_rel_for(rel:,
|
417
|
+
def fetch_rel_for(rel:, from:, query: {})
|
384
418
|
# Build a list of repositories, note per Github's API, these are
|
385
419
|
# paginated.
|
386
|
-
|
387
|
-
|
420
|
+
from_to_s = from.respond_to?(:name) ? from.name : from.to_s
|
421
|
+
logger.info "Fetching rels[#{rel.inspect}] for '#{from_to_s}' with pattern #{repository_pattern.inspect} and query #{query.inspect}"
|
422
|
+
source = from.rels[rel].get(query)
|
388
423
|
rels = []
|
389
424
|
while source
|
390
425
|
rels += source.data
|
391
426
|
if source.rels[:next]
|
392
|
-
source = source.rels[:next].get
|
427
|
+
source = source.rels[:next].get(query)
|
393
428
|
else
|
394
429
|
source = nil
|
395
430
|
end
|
396
431
|
end
|
397
|
-
rels
|
398
|
-
logger.info "Finished rels[#{rel.inspect}] for '#{org.login}' with pattern #{repository_pattern.inspect}"
|
432
|
+
logger.info "Finished fetching rels[#{rel.inspect}] for '#{from_to_s}' with pattern #{repository_pattern.inspect} and query #{query.inspect}"
|
399
433
|
if block_given?
|
400
434
|
rels
|
401
435
|
else
|
data/lib/huborg/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: huborg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Friesen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|
@@ -92,7 +92,8 @@ licenses: []
|
|
92
92
|
metadata:
|
93
93
|
homepage_uri: https://github.com/samvera-labs/huborg/
|
94
94
|
source_code_uri: https://github.com/samvera-labs/huborg/
|
95
|
-
changelog_uri: https://github.com/samvera-labs/huborg/CHANGELOG.md
|
95
|
+
changelog_uri: https://github.com/samvera-labs/huborg/blob/master/CHANGELOG.md
|
96
|
+
documentation_uri: https://www.rubydoc.info/gems/huborg/
|
96
97
|
post_install_message:
|
97
98
|
rdoc_options: []
|
98
99
|
require_paths:
|