hub_link 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b1b882c925dd1d16fd88f93d64b361cb449befcd
4
- data.tar.gz: 358a8e6c3f2b9e4e6ad15b222878695c8cb6a8ed
3
+ metadata.gz: 3f037667483d4be19384393de02f573672c2f359
4
+ data.tar.gz: 0c5b5aba743dda3dc1f39c89d4d2a2c6562310fa
5
5
  SHA512:
6
- metadata.gz: 1b43b91e096f5ec34683fddb6a9c3a27c4b7c2a42d307a6bd674abc0c2562e4b33eb06e719d035bc33c96bfdb33543f5dd624016f00d33a7b20f2ca4deecf7ad
7
- data.tar.gz: c8be56da4b82da26700b00cbc04cbb85d16958264d04c889a7e340da2abcf5f30f956106c320c2c05c5e28b1209dc21e16377d82492fdaafbd7b4dfb13eb9e2e
6
+ metadata.gz: 0b008d5f998e86b7a7881aac5fc34fdb813da908441f9c92c4961f03ca890463e39581db801a0141ff467271fe1e51bf8674f16b06e5c498fe5a8cf10aaaf8db
7
+ data.tar.gz: 664b164a34ecc3cc17c2344f5f04557e58942fd20ceec89aad647e59892acfa122b3598941106c7fb25c31dc1c1a777b0476461a4a7e749bcb531240e63678e3
data/README.md CHANGED
@@ -23,7 +23,8 @@ stream.in_batches do |batch|
23
23
  end
24
24
  ```
25
25
 
26
- Hub Link will loop through the API in batches of 1 day at a time.
26
+ Hub Link will loop through the API in batches of 7 days at a time from
27
+ the start date.
27
28
 
28
29
  ## Contributing
29
30
 
@@ -11,6 +11,10 @@ module HubLink
11
11
  Octokit.search_issues(filter).items.map { |item| new(item) }
12
12
  end
13
13
 
14
+ def self.oldest(repo:)
15
+ search("type:pr sort:updated-asc repo:#{repo}").first
16
+ end
17
+
14
18
  def submitter
15
19
  user.login
16
20
  end
@@ -3,11 +3,11 @@ require "hub_link/batch"
3
3
 
4
4
  module HubLink
5
5
  class Stream
6
- GITHUB_BATCH_SIZE = 1 # Day
6
+ GITHUB_BATCH_SIZE = 7 # Days
7
7
 
8
- def initialize(repo, start_date: 2.years.ago)
8
+ def initialize(repo, start_date: nil)
9
9
  @repo = repo
10
- @start_date = start_date.to_date
10
+ @start_date = (start_date || date_of_first_pr).to_date
11
11
  end
12
12
 
13
13
  def in_batches(&block)
@@ -20,6 +20,10 @@ module HubLink
20
20
 
21
21
  attr_accessor :repo, :start_date
22
22
 
23
+ def date_of_first_pr
24
+ Api::PullRequest.oldest(repo: repo)&.updated_at
25
+ end
26
+
23
27
  def queries
24
28
  start_date.step(end_date, GITHUB_BATCH_SIZE).map do |date|
25
29
  "type:pr updated:#{date}..#{date + GITHUB_BATCH_SIZE} repo:#{repo}"
@@ -1,3 +1,3 @@
1
1
  module HubLink
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
3
3
  end
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.6.0
4
+ version: 0.7.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-01-15 00:00:00.000000000 Z
11
+ date: 2019-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport