BibOpsworks 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/bib/opsworks/newrelic.rb +14 -9
- data/lib/bib/opsworks/version.rb +1 -1
- data/tests/newrelic_test.rb +4 -2
- metadata +1 -2
- data/tests/opsworks_test.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3afb8c6e35f8997c1a45aa0331eff4d2c22d7b6e
|
4
|
+
data.tar.gz: 28cdbe8ba37ce1a15cf62aec3e62643fd7b6b0c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 791ba09ecce264081cc57133795055597f000f055454c3bac4184e4665a948bdcb63ccc3ffdc9bd97038200ee0f91994872909f246c2506ca18784d2f2ddef9e
|
7
|
+
data.tar.gz: 425b14655d49e60c7e25f6ba1240e879455abfb0de764f50bc19dbe485cc7eb6b51869e4e84aef58ed1d1c31a577a21fd8ced8c64c95884cb21eb809214649a9
|
data/Gemfile.lock
CHANGED
@@ -5,18 +5,19 @@ module Bib
|
|
5
5
|
class Newrelic
|
6
6
|
|
7
7
|
def publish_deployment(app_name, deploy_data, newrelic_api_key)
|
8
|
-
|
8
|
+
newrelic_params = prepare_publishing_data(app_name, deploy_data)
|
9
9
|
|
10
10
|
newrelic_url = "https://rpm.newrelic.com/deployments.xml"
|
11
11
|
url = URI.parse(newrelic_url)
|
12
12
|
request = Net::HTTP::Post.new(url.request_uri)
|
13
|
-
request.add_field('X-
|
14
|
-
request.
|
13
|
+
request.add_field('X-Api-Key', newrelic_api_key)
|
14
|
+
request.content_type = "application/octet-stream"
|
15
|
+
request.set_form_data(newrelic_params)
|
15
16
|
resp = Net::HTTP.new(url.host, url.port).start do |http|
|
16
17
|
http.request(request)
|
17
18
|
end
|
18
19
|
|
19
|
-
resp.is_a? Net::
|
20
|
+
resp.is_a? Net::HTTPSuccess
|
20
21
|
end
|
21
22
|
|
22
23
|
def prepare_publishing_data(app_name, deploy_data)
|
@@ -28,11 +29,15 @@ module Bib
|
|
28
29
|
deployment_user = deploy_data["deploying_user"].split('/')[1]
|
29
30
|
end
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
newrelic_params = {}
|
33
|
+
{
|
34
|
+
:app_name => app_name,
|
35
|
+
:user => deployment_user,
|
36
|
+
:revision => scm_revision
|
37
|
+
}.each do |k, v|
|
38
|
+
newrelic_params["deployment[#{k}]"] = v unless v.nil? || v == ''
|
39
|
+
end
|
40
|
+
newrelic_params
|
36
41
|
end
|
37
42
|
end
|
38
43
|
end
|
data/lib/bib/opsworks/version.rb
CHANGED
data/tests/newrelic_test.rb
CHANGED
@@ -12,7 +12,8 @@ class NewrelicTest < Minitest::Test
|
|
12
12
|
app_name = 'unittest'
|
13
13
|
|
14
14
|
result = newrelic.prepare_publishing_data(app_name, deploy_data)
|
15
|
-
|
15
|
+
expected = {"deployment[app_name]"=>"unittest", "deployment[user]"=>"gemtest", "deployment[revision]"=>"rev1"}
|
16
|
+
assert_equal(expected, result)
|
16
17
|
end
|
17
18
|
|
18
19
|
def test_publish_deployment_nouser
|
@@ -22,6 +23,7 @@ class NewrelicTest < Minitest::Test
|
|
22
23
|
app_name = 'unittest'
|
23
24
|
|
24
25
|
result = newrelic.prepare_publishing_data(app_name, deploy_data)
|
25
|
-
|
26
|
+
expected = {"deployment[app_name]"=>"unittest", "deployment[user]"=>"opsworks", "deployment[revision]"=>"rev1"}
|
27
|
+
assert_equal(expected, result)
|
26
28
|
end
|
27
29
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: BibOpsworks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- fh
|
@@ -101,7 +101,6 @@ files:
|
|
101
101
|
- lib/bib/opsworks/version.rb
|
102
102
|
- tests/composer_test.rb
|
103
103
|
- tests/newrelic_test.rb
|
104
|
-
- tests/opsworks_test.rb
|
105
104
|
homepage: https://github.com/easybiblabs/bib-opsworks
|
106
105
|
licenses: []
|
107
106
|
metadata: {}
|