hubstats 0.0.19 → 0.0.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/app/models/hubstats/label.rb +8 -0
- data/app/models/hubstats/pull_request.rb +1 -1
- data/lib/hubstats/events_handler.rb +4 -2
- data/lib/hubstats/github_api.rb +6 -0
- data/lib/hubstats/version.rb +1 -1
- data/test/dummy/log/development.log +0 -0
- data/test/dummy/log/test.log +2356 -0
- data/test/dummy/tmp/cache/assets/CAD/3D0/sprockets%2F781852b612e12270af6602bdb8f985a4 +0 -0
- data/test/dummy/tmp/cache/assets/CBC/4C0/sprockets%2F43796510bea9e088167ff07f3d0a8484 +0 -0
- data/test/dummy/tmp/cache/assets/D20/FF0/sprockets%2F941bab9382328e98fd569386d1ec0af5 +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NGU1YzA2ZmVmOTA5NTMzNzdhMTk3NDllZjczNzI2NTc4YjY3ZDZlOQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MWJlNDA1MDAxZWZmNDFjNzE5ZjI0OGUxZjQxYmZhYzRmYmU4YzJmOA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YTQ1YmJlYmE3ZjkxNTcxMzliZTRhMWMwZGRkOTAyMTc1MmZmM2IyZmViNmNi
|
10
|
+
ZTJlMmNjOGQ4N2RkZGExNTUyMTA4YmQzYWE1ZmIzZGIwYjE2N2ExOTMzYjZk
|
11
|
+
N2I2MjRjMWM0NjkwZmQyNzI5MjA4YmQ3Y2IzZTlkMGE5NWU5Yjk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MjJmYjg3MTE5N2Y5NTM5ZDRlMDY5ODgyMmQ0NTEyZDFhZGExYjNmNTUzZmUx
|
14
|
+
Y2RiN2Y5MzNlOWU2Mzg1ZTZjZWI5MjdkNmUyNzVkZDk0MWMyMTBjZGI2ODcy
|
15
|
+
NjAxNjcwMmJkZTU1ZjM3ODZkODI4NmJmYmU1YjE5ZTg2NTA3ZDQ=
|
@@ -17,5 +17,13 @@ module Hubstats
|
|
17
17
|
|
18
18
|
has_and_belongs_to_many :pull_requests, :join_table => 'hubstats_labels_pull_requests'
|
19
19
|
|
20
|
+
def self.first_or_create(label)
|
21
|
+
if exists = Hubstats::Label.where(name: label[:name]).first
|
22
|
+
return exists
|
23
|
+
else
|
24
|
+
Hubstats::Label.new(name: label[:name], url: label[:url], color: label[:color])
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
20
28
|
end
|
21
29
|
end
|
@@ -17,8 +17,10 @@ module Hubstats
|
|
17
17
|
def pull_processor(payload)
|
18
18
|
pull_request = payload[:pull_request]
|
19
19
|
pull_request[:repository] = payload[:repository]
|
20
|
-
|
21
|
-
Hubstats::
|
20
|
+
new_pull = Hubstats::PullRequest.create_or_update(pull_request.with_indifferent_access)
|
21
|
+
repo_name = Hubstats::Repo.where(id: new_pull.repo_id).first.full_name
|
22
|
+
labels = Hubstats::GithubAPI.get_labels(repo_name, new_pull.number )
|
23
|
+
new_pull.add_labels(labels)
|
22
24
|
end
|
23
25
|
|
24
26
|
def comment_processor(payload,kind)
|
data/lib/hubstats/github_api.rb
CHANGED
@@ -111,6 +111,12 @@ module Hubstats
|
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
114
|
+
def self.get_labels(repo_name, pull_request_number)
|
115
|
+
issue = Hubstats::GithubAPI.client.issue(repo_name, pull_request_number)
|
116
|
+
issue[:labels]
|
117
|
+
end
|
118
|
+
|
119
|
+
|
114
120
|
def self.wait_limit(grab_size,rate_limit)
|
115
121
|
if rate_limit.remaining < grab_size
|
116
122
|
puts "Hit Github rate limit, waiting #{Time.at(rate_limit.resets_in).utc.strftime("%H:%M:%S")} to get more"
|
data/lib/hubstats/version.rb
CHANGED
Binary file
|