hub_store 0.3.0 → 0.4.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
  SHA256:
3
- metadata.gz: 7d8ec203d46de7634c8300d108f465c8a31f2a7f849a54df76bdf486e2086b8c
4
- data.tar.gz: 4427b681d40c533bbd234a34a3c216ee02dcc9de3d94ff5ee413ed861444de34
3
+ metadata.gz: 1f4092b0d303f78da4c96c3b32c44fac4831007d65a12b1e9c3be9e110375902
4
+ data.tar.gz: 37fe2b1198a8437ce5ea8fea1097203527d4e9625dbc14d2209c620537179768
5
5
  SHA512:
6
- metadata.gz: ad6cff429019cb4c7973c65496e0ca53bf3deee57934c10a5dc52be5261b54095ed4d7ecd7aea43ee689d66b32876bddfc7db0825b7dab8a3750f1be2755c15a
7
- data.tar.gz: 72554368bfe5be80168ccee9f51c223613dafe672a99b68caca2055d66660a75a3b694098a3597495f1790170767a787cd4c262ef4b43cefff569014b13cd569
6
+ metadata.gz: fca7fad9c5893ff4bab52d7f5e5e43412749faf11de0bd53270a4b704c341c78a4c38c88105383e3968c56b38692e05052b19a1ed48ee3c535a9ae4574819501
7
+ data.tar.gz: 333e42cedaa64a3ee8374ad1b7831a5b275334d43fd81f3bb1e935b12e43db44ba3dfe2a053f78d71ff3363e3b2275a6a1dce0ef30385a8588fe9cf21bd32243
data/hub_store.gemspec CHANGED
@@ -26,6 +26,8 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency "rake", "~> 10.0"
27
27
  spec.add_development_dependency "minitest", "~> 5.0"
28
28
  spec.add_development_dependency "pry"
29
+ spec.add_development_dependency "vcr"
30
+ spec.add_development_dependency "webmock"
29
31
 
30
32
  spec.add_dependency "activerecord"
31
33
  spec.add_dependency "dotenv"
@@ -2,6 +2,7 @@ require "hub_link"
2
2
  require "hub_store/insert"
3
3
  require "hub_store/pull_request"
4
4
  require "hub_store/review"
5
+ require "hub_store/review_request"
5
6
 
6
7
  module HubStore
7
8
  class Importer
@@ -12,8 +13,9 @@ module HubStore
12
13
 
13
14
  def run
14
15
  stream.in_batches do |batch|
15
- import_prs(batch.pull_requests)
16
- import_reviews(batch.reviews)
16
+ import_prs(batch)
17
+ import_reviews(batch)
18
+ import_review_requests(batch)
17
19
  end
18
20
  end
19
21
 
@@ -21,20 +23,32 @@ module HubStore
21
23
 
22
24
  attr_reader :repos, :start_date
23
25
 
24
- def import_prs(rows)
25
- rows.each do |row|
26
+ def import_prs(batch)
27
+ batch.pull_requests.each do |row|
26
28
  Insert.new(row: row, target: PullRequest).run
27
29
  end
28
30
 
29
- puts "Imported #{PullRequest.count} PRs so far"
31
+ log "Imported #{PullRequest.count} PRs so far"
30
32
  end
31
33
 
32
- def import_reviews(rows)
33
- rows.each do |row|
34
+ def import_reviews(batch)
35
+ batch.reviews.each do |row|
34
36
  Insert.new(row: row, target: Review).run
35
37
  end
36
38
 
37
- puts "Imported #{Review.count} reviews so far"
39
+ log "Imported #{Review.count} reviews so far"
40
+ end
41
+
42
+ def import_review_requests(batch)
43
+ batch.review_requests.each do |row|
44
+ Insert.new(row: row, target: ReviewRequest).run
45
+ end
46
+
47
+ log "Imported #{ReviewRequest.count} review requests so far"
48
+ end
49
+
50
+ def log(msg)
51
+ puts msg
38
52
  end
39
53
 
40
54
  def stream
@@ -0,0 +1,6 @@
1
+ require "active_record"
2
+
3
+ module HubStore
4
+ class ReviewRequest < ActiveRecord::Base
5
+ end
6
+ end
@@ -1,3 +1,3 @@
1
1
  module HubStore
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
data/lib/hub_store.rb CHANGED
@@ -42,5 +42,14 @@ module HubStore
42
42
  t.datetime "updated_at", null: false
43
43
  end
44
44
  end
45
+
46
+ unless ActiveRecord::Base.connection.table_exists?("review_requests")
47
+ create_table "review_requests", force: :cascade do |t|
48
+ t.string "user"
49
+ t.string "reviewer"
50
+ t.datetime "created_at", null: false
51
+ t.datetime "updated_at", null: false
52
+ end
53
+ end
45
54
  end
46
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hub_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Balvig
@@ -66,6 +66,34 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: vcr
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: webmock
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: activerecord
71
99
  requirement: !ruby/object:Gem::Requirement
@@ -149,6 +177,7 @@ files:
149
177
  - lib/hub_store/insert.rb
150
178
  - lib/hub_store/pull_request.rb
151
179
  - lib/hub_store/review.rb
180
+ - lib/hub_store/review_request.rb
152
181
  - lib/hub_store/version.rb
153
182
  homepage: https://balvig.com
154
183
  licenses: