prophet 2.1.0 → 2.2.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/lib/prophet/prophet.rb +15 -21
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63a3b73db0063a2926440a4e1f19a0ae76d62be4a5ae20e7a88fb677229000b5
|
4
|
+
data.tar.gz: 7fff7b419b81c22b5f612a3523a04a73b71c53f935d1bdd7f0aca05ec4470ee5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12ce2eda7bcb9e7e401b32c0f28375a7e873188d41b83dc1a6ec892dc7f4f14f64daeb79f6e3509f918f086852368e0fb2ba0b8bc7310f00d7ec4e00621409e5
|
7
|
+
data.tar.gz: 0bd79da7a4d39026bc89e3cdb31a8efcc7109cf1c98948f57e915349fa4689a162c9ac6814b54156c480aabd7561bb9e4fe22d4580eadc195b912ac642d85840
|
data/lib/prophet/prophet.rb
CHANGED
@@ -3,10 +3,10 @@ require 'open3'
|
|
3
3
|
|
4
4
|
class Prophet
|
5
5
|
|
6
|
-
attr_accessor :
|
7
|
-
:
|
6
|
+
attr_accessor :username_pass,
|
7
|
+
:access_token_pass,
|
8
8
|
:username_fail,
|
9
|
-
:
|
9
|
+
:access_token_fail,
|
10
10
|
:rerun_on_source_change,
|
11
11
|
:rerun_on_target_change,
|
12
12
|
:prepare_block,
|
@@ -100,11 +100,10 @@ class Prophet
|
|
100
100
|
end
|
101
101
|
|
102
102
|
def configure
|
103
|
+
self.username_fail ||= self.username_pass
|
104
|
+
self.access_token_fail ||= self.access_token_pass
|
105
|
+
|
103
106
|
# Set default fall back values for options that aren't set.
|
104
|
-
self.username ||= git_config['github.login']
|
105
|
-
self.password ||= git_config['github.password']
|
106
|
-
self.username_fail ||= self.username
|
107
|
-
self.password_fail ||= self.password
|
108
107
|
self.rerun_on_source_change = true if self.rerun_on_source_change.nil?
|
109
108
|
self.rerun_on_target_change = true if self.rerun_on_target_change.nil?
|
110
109
|
self.reuse_comments = false if self.reuse_comments.nil?
|
@@ -119,22 +118,17 @@ class Prophet
|
|
119
118
|
# Find environment (tasks, project, ...).
|
120
119
|
self.prepare_block ||= lambda {}
|
121
120
|
self.exec_block ||= lambda { `rake` }
|
122
|
-
@github = connect_to_github
|
123
|
-
@github_fail =
|
124
|
-
@github
|
125
|
-
else
|
126
|
-
connect_to_github self.username_fail, self.password_fail
|
127
|
-
end
|
121
|
+
@github = connect_to_github(access_token: access_token_pass)
|
122
|
+
@github_fail = connect_to_github(access_token: access_token_fail)
|
128
123
|
end
|
129
124
|
|
130
|
-
def connect_to_github(
|
131
|
-
github = Octokit::Client.new(
|
132
|
-
|
133
|
-
:password => pass
|
134
|
-
)
|
125
|
+
def connect_to_github(access_token:)
|
126
|
+
github = Octokit::Client.new(access_token: access_token)
|
127
|
+
|
135
128
|
# Check user login to GitHub.
|
136
129
|
github.login
|
137
|
-
logger.info "Successfully logged into GitHub with user '#{user}'."
|
130
|
+
logger.info "Successfully logged into GitHub with user '#{github.user.login}'."
|
131
|
+
|
138
132
|
# Ensure the user has access to desired project.
|
139
133
|
# NOTE: All three variants should work:
|
140
134
|
# 'ssh://git@github.com:user/project.git'
|
@@ -146,7 +140,7 @@ class Prophet
|
|
146
140
|
logger.info "Successfully accessed GitHub project '#{@project}'"
|
147
141
|
github
|
148
142
|
rescue Octokit::Unauthorized => e
|
149
|
-
logger.error "Unable to access GitHub project with user '#{user}':\n#{e.message}"
|
143
|
+
logger.error "Unable to access GitHub project with user '#{github.user}':\n#{e.message}"
|
150
144
|
abort
|
151
145
|
end
|
152
146
|
end
|
@@ -172,7 +166,7 @@ class Prophet
|
|
172
166
|
# Compare current sha ids of target and source branch with those from the last test run.
|
173
167
|
@request.target_head_sha = @github.commits(@project).first.sha
|
174
168
|
comments = @github.issue_comments(@project, @request.id)
|
175
|
-
comments = comments.select { |c| [
|
169
|
+
comments = comments.select { |c| [username_pass, username_fail].include?(c.user.login) }.reverse
|
176
170
|
comments.each do |comment|
|
177
171
|
@request.comment = comment if /Merged ([\w]+) into ([\w]+)/.match(comment.body)
|
178
172
|
end
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prophet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dominik Bamberger
|
8
8
|
- Thomas Schmidt
|
9
9
|
- Jordi Massaguer Pla
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2020-09-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: faraday_middleware
|
@@ -73,7 +73,7 @@ homepage: http://github.com/b4mboo/prophet
|
|
73
73
|
licenses:
|
74
74
|
- MIT
|
75
75
|
metadata: {}
|
76
|
-
post_install_message:
|
76
|
+
post_install_message:
|
77
77
|
rdoc_options: []
|
78
78
|
require_paths:
|
79
79
|
- lib
|
@@ -88,8 +88,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
requirements: []
|
91
|
-
rubygems_version: 3.
|
92
|
-
signing_key:
|
91
|
+
rubygems_version: 3.1.4
|
92
|
+
signing_key:
|
93
93
|
specification_version: 4
|
94
94
|
summary: An easy way to loop through open pull requests and run code onthe merged
|
95
95
|
branch.
|