hub_link 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/hub_link/batch.rb +4 -0
- data/lib/hub_link/stream.rb +5 -6
- data/lib/hub_link/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55820ffa015f5004c8f88f16f18a55a617926a95
|
4
|
+
data.tar.gz: 89d401fa82ab3d62a7c78df1f2dd8a45ceae2e2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c213375c41d32eeeebd6f0867ce64eadcfa0e47b19664603c3f584e64093f645fc9f6408f321765a3dd271dd1e71c3de05d2f9fd30a5a264ede25b9737786b8
|
7
|
+
data.tar.gz: 171461c43bb35bc5b2db94ccde9c971094bc6d255cfd37c5b73502ece8b0b2c31fb45dee039cf03108b9a21a9c666e1ef6b9a5b6d6f4db99619024e27b024cd2
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@ When you just want the loop through all the raw pull request and review data fro
|
|
8
8
|
Add this line to your application's Gemfile:
|
9
9
|
|
10
10
|
```ruby
|
11
|
-
gem "
|
11
|
+
gem "hub_link"
|
12
12
|
```
|
13
13
|
|
14
14
|
Then you can do:
|
@@ -19,7 +19,7 @@ stream = HubLink::Stream.new("balvig/hub_link", start_date: 3.months.ago)
|
|
19
19
|
stream.in_batches do |batch|
|
20
20
|
batch.prs # => [{ id: 34, merge_time: 6400, ... }]
|
21
21
|
batch.reviews # => [{ id: 54, reviewer: "balvig", approval: true, ... }]
|
22
|
-
batch.review_requests # => [{
|
22
|
+
batch.review_requests # => [{ digest: "a45bfa...", reviewer: "balvig", ... }]
|
23
23
|
end
|
24
24
|
```
|
25
25
|
|
data/lib/hub_link/batch.rb
CHANGED
data/lib/hub_link/stream.rb
CHANGED
@@ -3,11 +3,10 @@ require "hub_link/batch"
|
|
3
3
|
|
4
4
|
module HubLink
|
5
5
|
class Stream
|
6
|
-
|
7
|
-
|
8
|
-
def initialize(repo, start_date: nil)
|
6
|
+
def initialize(repo, start_date: nil, batch_size: 7)
|
9
7
|
@repo = repo
|
10
8
|
@start_date = (start_date || date_of_first_pr).to_date
|
9
|
+
@batch_size = batch_size
|
11
10
|
end
|
12
11
|
|
13
12
|
def in_batches(&block)
|
@@ -18,15 +17,15 @@ module HubLink
|
|
18
17
|
|
19
18
|
private
|
20
19
|
|
21
|
-
attr_accessor :repo, :start_date
|
20
|
+
attr_accessor :repo, :start_date, :batch_size
|
22
21
|
|
23
22
|
def date_of_first_pr
|
24
23
|
Api::PullRequest.oldest(repo: repo)&.updated_at
|
25
24
|
end
|
26
25
|
|
27
26
|
def queries
|
28
|
-
start_date.step(end_date,
|
29
|
-
"type:pr updated:#{date}..#{date + (
|
27
|
+
start_date.step(end_date, batch_size).map do |date|
|
28
|
+
"type:pr updated:#{date}..#{date + (batch_size - 1)} repo:#{repo}"
|
30
29
|
end
|
31
30
|
end
|
32
31
|
|
data/lib/hub_link/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hub_link
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Balvig
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|