codeclimate-services 1.6.0 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/codeclimate-services.gemspec +1 -1
- data/lib/cc/service.rb +2 -2
- data/lib/cc/services/jira.rb +6 -2
- data/lib/cc/services/slack.rb +5 -1
- data/lib/cc/services/version.rb +1 -1
- data/test/github_pull_requests_test.rb +2 -2
- data/test/invocation_test.rb +4 -4
- data/test/jira_test.rb +1 -0
- data/test/service_test.rb +4 -4
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5743e344af855362cf8d9de84add9de905ddef4
|
4
|
+
data.tar.gz: 30a6496f74f2ab59c32bacf37435ebf2a85c5649
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fceef45fc66347e24f12790454d427be003e8fbdc3dec77849d8c3b0692323b1e56439bcd6baf9fce75859e6a8971607edaba0f9281ff860777c5e6f631d13a
|
7
|
+
data.tar.gz: 404ea8ec662df618b3a8e7e0077dbeb79cbdde38f4899c7c07edc8b921c6d1223537da59c023666d038cbf7a5467453820f2be788e54b87faf5904a157de0da3
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
20
|
spec.add_dependency "faraday", "0.8.8"
|
21
|
-
spec.add_dependency "virtus", "1.0.0"
|
21
|
+
spec.add_dependency "virtus", "~> 1.0.0"
|
22
22
|
spec.add_dependency "nokogiri", "~> 1.6.0"
|
23
23
|
spec.add_dependency "activemodel", ">= 3.0"
|
24
24
|
spec.add_dependency "activesupport", ">= 3.0"
|
data/lib/cc/service.rb
CHANGED
@@ -71,7 +71,7 @@ module CC
|
|
71
71
|
def self.title
|
72
72
|
@title ||= begin
|
73
73
|
hook = name.dup
|
74
|
-
hook.sub!
|
74
|
+
hook.sub!(/.*:/, '')
|
75
75
|
hook
|
76
76
|
end
|
77
77
|
end
|
@@ -80,7 +80,7 @@ module CC
|
|
80
80
|
@slug ||= begin
|
81
81
|
hook = name.dup
|
82
82
|
hook.downcase!
|
83
|
-
hook.sub!
|
83
|
+
hook.sub!(/.*:/, '')
|
84
84
|
hook
|
85
85
|
end
|
86
86
|
end
|
data/lib/cc/services/jira.rb
CHANGED
@@ -13,7 +13,11 @@ class CC::Service::Jira < CC::Service
|
|
13
13
|
description: "Your JIRA password"
|
14
14
|
|
15
15
|
attribute :project_id, Axiom::Types::String,
|
16
|
-
description: "Your JIRA project ID number (located in your JIRA admin panel). Project must
|
16
|
+
description: "Your JIRA project ID number (located in your JIRA admin panel). Project must contain only the default required fields."
|
17
|
+
|
18
|
+
attribute :issue_type, Axiom::Types::String,
|
19
|
+
description: "The type of Issue to be created.",
|
20
|
+
default: "Task"
|
17
21
|
|
18
22
|
attribute :labels, Axiom::Types::String,
|
19
23
|
description: "Which labels to add to issues, comma delimited"
|
@@ -65,7 +69,7 @@ private
|
|
65
69
|
project: { id: config.project_id },
|
66
70
|
summary: title,
|
67
71
|
description: ticket_body,
|
68
|
-
issuetype: { name:
|
72
|
+
issuetype: { name: config.issue_type }
|
69
73
|
}
|
70
74
|
}
|
71
75
|
|
data/lib/cc/services/slack.rb
CHANGED
@@ -72,7 +72,11 @@ class CC::Service::Slack < CC::Service
|
|
72
72
|
@response = speak(improvements_message(snapshot.improved_constants_payload), GREEN_HEX)
|
73
73
|
end
|
74
74
|
|
75
|
-
@response
|
75
|
+
if defined?(@response)
|
76
|
+
@response
|
77
|
+
else
|
78
|
+
{ ok: false, ignored: true, message: "No changes in snapshot" }
|
79
|
+
end
|
76
80
|
end
|
77
81
|
|
78
82
|
def alerts_message(constants_payload)
|
data/lib/cc/services/version.rb
CHANGED
@@ -156,7 +156,7 @@ class TestGitHubPullRequests < CC::Service::TestCase
|
|
156
156
|
"state" => "pending",
|
157
157
|
})
|
158
158
|
|
159
|
-
|
159
|
+
receive_pull_request({}, {
|
160
160
|
github_slug: "gordondiggs/ellis",
|
161
161
|
commit_sha: "abc123",
|
162
162
|
state: "pending",
|
@@ -169,7 +169,7 @@ class TestGitHubPullRequests < CC::Service::TestCase
|
|
169
169
|
"state" => "pending",
|
170
170
|
})
|
171
171
|
|
172
|
-
|
172
|
+
receive_pull_request({ context: "sup" }, {
|
173
173
|
github_slug: "gordondiggs/ellis",
|
174
174
|
commit_sha: "abc123",
|
175
175
|
state: "pending",
|
data/test/invocation_test.rb
CHANGED
@@ -76,7 +76,7 @@ class TestInvocation < Test::Unit::TestCase
|
|
76
76
|
|
77
77
|
assert error_occurred
|
78
78
|
assert_equal 1, statsd.incremented_keys.length
|
79
|
-
assert_match
|
79
|
+
assert_match(/^services\.errors\.a_prefix/, statsd.incremented_keys.first)
|
80
80
|
end
|
81
81
|
|
82
82
|
def test_user_message
|
@@ -90,7 +90,7 @@ class TestInvocation < Test::Unit::TestCase
|
|
90
90
|
end
|
91
91
|
|
92
92
|
assert_equal "Hey do this", result[:message]
|
93
|
-
assert_match
|
93
|
+
assert_match(/Boom/, result[:log_message])
|
94
94
|
end
|
95
95
|
|
96
96
|
def test_error_handling
|
@@ -104,7 +104,7 @@ class TestInvocation < Test::Unit::TestCase
|
|
104
104
|
|
105
105
|
assert_equal({ok: false, message: "Boom", log_message: "Exception invoking service: [a_prefix] (RuntimeError) Boom"}, result)
|
106
106
|
assert_equal 1, logger.logged_errors.length
|
107
|
-
assert_match
|
107
|
+
assert_match(/^Exception invoking service: \[a_prefix\]/, logger.logged_errors.first)
|
108
108
|
end
|
109
109
|
|
110
110
|
def test_multiple_middleware
|
@@ -137,7 +137,7 @@ class TestInvocation < Test::Unit::TestCase
|
|
137
137
|
@receive_count += 1
|
138
138
|
|
139
139
|
begin
|
140
|
-
raise
|
140
|
+
raise fake_error if fake_error
|
141
141
|
rescue => e
|
142
142
|
if override_user_message
|
143
143
|
e.user_message = override_user_message
|
data/test/jira_test.rb
CHANGED
@@ -64,6 +64,7 @@ class TestJira < CC::Service::TestCase
|
|
64
64
|
assert_equal "Basic Zm9vOmJhcg==", env[:request_headers]["Authorization"]
|
65
65
|
assert_equal title, body["fields"]["summary"]
|
66
66
|
assert_equal ticket_body, body["fields"]["description"]
|
67
|
+
assert_equal "Task", body["fields"]["issuetype"]["name"]
|
67
68
|
[200, {}, '{"id":"10000"}']
|
68
69
|
end
|
69
70
|
|
data/test/service_test.rb
CHANGED
@@ -34,8 +34,8 @@ class TestService < CC::Service::TestCase
|
|
34
34
|
def test_post_success
|
35
35
|
stub_http("/my/test/url", [200, {}, '{"ok": true, "thing": "123"}'])
|
36
36
|
|
37
|
-
response = service_post("/my/test/url", {token: "1234"}.to_json, {}) do |
|
38
|
-
body = JSON.parse(
|
37
|
+
response = service_post("/my/test/url", {token: "1234"}.to_json, {}) do |inner_response|
|
38
|
+
body = JSON.parse(inner_response.body)
|
39
39
|
{ thing: body["thing"] }
|
40
40
|
end
|
41
41
|
|
@@ -49,8 +49,8 @@ class TestService < CC::Service::TestCase
|
|
49
49
|
stub_http("/my/test/url", [307, {"Location" => "/my/redirect/url"}, '{"ok": false, "redirect": true}'])
|
50
50
|
stub_http("/my/redirect/url", [200, {}, '{"ok": true, "thing": "123"}'])
|
51
51
|
|
52
|
-
response = service_post_with_redirects("/my/test/url", {token: "1234"}.to_json, {}) do |
|
53
|
-
body = JSON.parse(
|
52
|
+
response = service_post_with_redirects("/my/test/url", {token: "1234"}.to_json, {}) do |inner_response|
|
53
|
+
body = JSON.parse(inner_response.body)
|
54
54
|
{ thing: body["thing"] }
|
55
55
|
end
|
56
56
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codeclimate-services
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Helmkamp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -28,14 +28,14 @@ dependencies:
|
|
28
28
|
name: virtus
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 1.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|