hub_link 0.3.0 → 0.4.0
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.
- checksums.yaml +4 -4
- data/README.md +1 -3
- data/lib/hub_link/stream.rb +4 -14
- data/lib/hub_link/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: 8aad7cd8013fbb914ec24690d5e7f39e72bd3d6a
|
4
|
+
data.tar.gz: 61149d5323fc6ddbfb0051e3e4113203a0015433
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 590c8db368abe5b67324bcb8b83d051fa537c8d55214f461a55a9977cc6ff33e31746c3db6ca56752d3002438c615fa688b5c909413250e48b68369a5d3c0c30
|
7
|
+
data.tar.gz: 826fe2cff33c8dc037912b7feb6624ad2a7145a9f73732c857bb663ddea0c7dfb8a7f86398bfc3101b25afa9e4c519abdc9e9a41115f2f2f65e62f44eb9c3d07
|
data/README.md
CHANGED
@@ -14,9 +14,7 @@ Add this line to your application's Gemfile:
|
|
14
14
|
Then you can do:
|
15
15
|
|
16
16
|
```ruby
|
17
|
-
|
18
|
-
|
19
|
-
stream = HubLink::Stream.new(REPOS, start_date: 3.months.ago)
|
17
|
+
stream = HubLink::Stream.new("balvig/hub_link", start_date: 3.months.ago)
|
20
18
|
|
21
19
|
stream.in_batches do |batch|
|
22
20
|
batch.prs # => [{ id: 34, merge_time: 6400, ... }]
|
data/lib/hub_link/stream.rb
CHANGED
@@ -5,8 +5,8 @@ module HubLink
|
|
5
5
|
class Stream
|
6
6
|
GITHUB_BATCH_SIZE = 14
|
7
7
|
|
8
|
-
def initialize(
|
9
|
-
@
|
8
|
+
def initialize(repo, start_date: 2.years.ago)
|
9
|
+
@repo = repo
|
10
10
|
@start_date = start_date.to_date
|
11
11
|
end
|
12
12
|
|
@@ -18,26 +18,16 @@ module HubLink
|
|
18
18
|
|
19
19
|
private
|
20
20
|
|
21
|
-
attr_accessor :
|
21
|
+
attr_accessor :repo, :start_date
|
22
22
|
|
23
23
|
def queries
|
24
24
|
start_date.step(end_date, GITHUB_BATCH_SIZE).map do |date|
|
25
|
-
"type:pr updated:#{date}..#{date + GITHUB_BATCH_SIZE}
|
25
|
+
"type:pr updated:#{date}..#{date + GITHUB_BATCH_SIZE} repo:#{repo}"
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
def end_date
|
30
30
|
Date.tomorrow
|
31
31
|
end
|
32
|
-
|
33
|
-
def repo_query
|
34
|
-
@_repo_query ||= build_repo_query
|
35
|
-
end
|
36
|
-
|
37
|
-
def build_repo_query
|
38
|
-
repos.map do |r|
|
39
|
-
"repo:#{r}"
|
40
|
-
end.join(" ")
|
41
|
-
end
|
42
32
|
end
|
43
33
|
end
|
data/lib/hub_link/version.rb
CHANGED