hub_store 0.10.0 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/hub_store +1 -0
- data/hub_store.gemspec +0 -2
- data/lib/hub_store/cli.rb +6 -29
- data/lib/hub_store/storage/database.rb +9 -1
- data/lib/hub_store/storage/import.rb +17 -18
- data/lib/hub_store/ui.rb +28 -6
- data/lib/hub_store/version.rb +1 -1
- data/lib/hub_store.rb +8 -0
- metadata +2 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b28b4357b1bd0d79b8dda3ac19b4d3ee599ff1897fbf228e76b8690e2fb5655d
|
4
|
+
data.tar.gz: aa81352822f572d4efc74c5db9b19d2c15613754991e57e5f2c93986f5b0c3b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 721377665ae7ee2800d21f03a9bc7080e12db94a6ed8cef0970ae82d76e39994d3686f687cd28f51fedcdc9cc53ddb0137f533e7c7c74e0df6a367cfa9fa758c
|
7
|
+
data.tar.gz: 0e2319f46da0b74b80c220b385a9de9071e961029f58ac84cc7516f5c7e1f7d033e361b3d69970a56e12f3c6310d6ae16b48a01d36902a47639d6e1ccc8870ed
|
data/exe/hub_store
CHANGED
data/hub_store.gemspec
CHANGED
@@ -26,8 +26,6 @@ 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"
|
31
29
|
|
32
30
|
spec.add_dependency "activerecord"
|
33
31
|
spec.add_dependency "dotenv"
|
data/lib/hub_store/cli.rb
CHANGED
@@ -1,18 +1,9 @@
|
|
1
1
|
require "hub_store/exporter"
|
2
|
-
|
3
|
-
require "hub_store/storage/database"
|
4
2
|
require "hub_store/storage/import"
|
5
|
-
|
6
3
|
require "hub_store/ui"
|
7
4
|
|
8
5
|
module HubStore
|
9
6
|
class Cli
|
10
|
-
RESOURCES = {
|
11
|
-
review_requests: Storage::ReviewRequest,
|
12
|
-
reviews: Storage::Review,
|
13
|
-
pull_requests: Storage::PullRequest
|
14
|
-
}.freeze
|
15
|
-
|
16
7
|
def self.run(*args)
|
17
8
|
new(*args).run
|
18
9
|
end
|
@@ -22,7 +13,7 @@ module HubStore
|
|
22
13
|
end
|
23
14
|
|
24
15
|
def run
|
25
|
-
|
16
|
+
link_logger_to_ui
|
26
17
|
import_data
|
27
18
|
export_csv
|
28
19
|
end
|
@@ -31,27 +22,13 @@ module HubStore
|
|
31
22
|
|
32
23
|
attr_reader :argv
|
33
24
|
|
34
|
-
def
|
35
|
-
|
36
|
-
Storage::Database.new.setup
|
37
|
-
ui.stop("Done.")
|
25
|
+
def link_logger_to_ui
|
26
|
+
HubLink.config.logger = ui
|
38
27
|
end
|
39
28
|
|
40
29
|
def import_data
|
41
30
|
repos.each do |repo|
|
42
|
-
Storage::Import.new(repo: repo,
|
43
|
-
on.init do |query|
|
44
|
-
ui.log "\n-- #{query} --"
|
45
|
-
end
|
46
|
-
|
47
|
-
on.start do |resource|
|
48
|
-
ui.start("Importing #{resource}")
|
49
|
-
end
|
50
|
-
|
51
|
-
on.finish do |count|
|
52
|
-
ui.stop("Total: #{count}")
|
53
|
-
end
|
54
|
-
end
|
31
|
+
Storage::Import.new(repo: repo, since: since).run
|
55
32
|
end
|
56
33
|
end
|
57
34
|
|
@@ -75,8 +52,8 @@ module HubStore
|
|
75
52
|
argv[0].presence || stop
|
76
53
|
end
|
77
54
|
|
78
|
-
def
|
79
|
-
ENV["
|
55
|
+
def since
|
56
|
+
ENV["SINCE"]
|
80
57
|
end
|
81
58
|
|
82
59
|
def stop
|
@@ -23,17 +23,22 @@ module HubStore::Storage
|
|
23
23
|
ActiveRecord::Schema.define do
|
24
24
|
unless ActiveRecord::Base.connection.table_exists?("pull_requests")
|
25
25
|
create_table "pull_requests", force: :cascade do |t|
|
26
|
+
t.string "title"
|
26
27
|
t.string "submitter"
|
27
28
|
t.string "number"
|
28
29
|
t.string "labels"
|
29
30
|
t.string "repo"
|
31
|
+
t.string "state"
|
32
|
+
t.string "html_url"
|
30
33
|
t.integer "approval_time"
|
31
34
|
t.integer "time_to_first_review"
|
32
35
|
t.integer "merge_time"
|
33
36
|
t.integer "additions"
|
34
|
-
t.integer "
|
37
|
+
t.integer "comments_count"
|
38
|
+
t.integer "review_comments_count"
|
35
39
|
t.boolean "straight_approval"
|
36
40
|
t.datetime "closed_at"
|
41
|
+
t.datetime "merged_at"
|
37
42
|
t.datetime "created_at", null: false
|
38
43
|
t.datetime "updated_at", null: false
|
39
44
|
end
|
@@ -45,7 +50,10 @@ module HubStore::Storage
|
|
45
50
|
t.datetime "submitted_at"
|
46
51
|
t.string "reviewer"
|
47
52
|
t.string "state"
|
53
|
+
t.boolean "reply"
|
54
|
+
t.string "html_url"
|
48
55
|
t.boolean "approval"
|
56
|
+
t.text "body"
|
49
57
|
end
|
50
58
|
end
|
51
59
|
|
@@ -1,26 +1,25 @@
|
|
1
1
|
require "hub_link/importer"
|
2
|
-
require "hub_store/storage/
|
3
|
-
require "hub_store/storage/review"
|
4
|
-
require "hub_store/storage/review_request"
|
2
|
+
require "hub_store/storage/database"
|
5
3
|
|
6
|
-
module HubStore
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
4
|
+
module HubStore
|
5
|
+
module Storage
|
6
|
+
class Import
|
7
|
+
def initialize(repo:, since: nil)
|
8
|
+
@repo = repo
|
9
|
+
@since = since
|
10
|
+
end
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
def run(&block)
|
13
|
+
HubLink::Importer.run(repo: repo, since: since, resources: RESOURCES, &block)
|
14
|
+
end
|
17
15
|
|
18
|
-
|
16
|
+
private
|
19
17
|
|
20
|
-
|
18
|
+
attr_reader :repo, :resources
|
21
19
|
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
def since
|
21
|
+
@since.presence || PullRequest.for(repo).latest_update
|
22
|
+
end
|
23
|
+
end
|
25
24
|
end
|
26
25
|
end
|
data/lib/hub_store/ui.rb
CHANGED
@@ -2,17 +2,39 @@ require "tty/spinner"
|
|
2
2
|
|
3
3
|
module HubStore
|
4
4
|
class Ui
|
5
|
+
FORMAT = ":spinner :title :status"
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@spinner = TTY::Spinner.new(FORMAT, format: :dots_3, hide_cursor: true, interval: 20)
|
9
|
+
end
|
10
|
+
|
11
|
+
def info(progname, &block)
|
12
|
+
case progname
|
13
|
+
when HubLink::START
|
14
|
+
start block.call
|
15
|
+
when HubLink::FINISH
|
16
|
+
stop block.call
|
17
|
+
else
|
18
|
+
update block.call
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
5
22
|
def start(msg)
|
6
|
-
|
7
|
-
|
23
|
+
spinner.update(title: msg, status: nil)
|
24
|
+
spinner.auto_spin
|
8
25
|
end
|
9
26
|
|
10
|
-
def
|
11
|
-
|
27
|
+
def update(msg)
|
28
|
+
spinner.update(status: msg)
|
12
29
|
end
|
13
30
|
|
14
|
-
def
|
15
|
-
|
31
|
+
def stop(msg)
|
32
|
+
spinner.update(status: nil)
|
33
|
+
spinner.success("(#{msg})")
|
16
34
|
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
attr_reader :spinner
|
17
39
|
end
|
18
40
|
end
|
data/lib/hub_store/version.rb
CHANGED
data/lib/hub_store.rb
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
require "dotenv/load"
|
2
2
|
require "hub_store/version"
|
3
3
|
require "hub_store/cli"
|
4
|
+
require "hub_store/storage/pull_request"
|
5
|
+
require "hub_store/storage/review"
|
6
|
+
require "hub_store/storage/review_request"
|
4
7
|
|
5
8
|
module HubStore
|
9
|
+
RESOURCES = {
|
10
|
+
review_requests: Storage::ReviewRequest,
|
11
|
+
reviews: Storage::Review,
|
12
|
+
pull_requests: Storage::PullRequest
|
13
|
+
}.freeze
|
6
14
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hub_store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.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-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,34 +66,6 @@ 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'
|
97
69
|
- !ruby/object:Gem::Dependency
|
98
70
|
name: activerecord
|
99
71
|
requirement: !ruby/object:Gem::Requirement
|