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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 49712a3cafd6285b934b02dca7f1ad502713c0a1
4
- data.tar.gz: ce9ab3d55447249e6f4e2e3d29742c92cbcbdfae
3
+ metadata.gz: 3afb8c6e35f8997c1a45aa0331eff4d2c22d7b6e
4
+ data.tar.gz: 28cdbe8ba37ce1a15cf62aec3e62643fd7b6b0c8
5
5
  SHA512:
6
- metadata.gz: a964bb945ccdea227401d701379a8d78e4aca2488347f71b1f2f027adb138f65176acff8b1f23819fe21e483a546a4da48f52a34a5e879b8b9f476332ece3ee6
7
- data.tar.gz: 133b5de5e080031a45a96e8892dc7064a9bcc464b6159ebf4212b797098474a194e9e10251dd22b36bac467832d0efb90989d230312c7bae1f8d93d3d7416c09
6
+ metadata.gz: 791ba09ecce264081cc57133795055597f000f055454c3bac4184e4665a948bdcb63ccc3ffdc9bd97038200ee0f91994872909f246c2506ca18784d2f2ddef9e
7
+ data.tar.gz: 425b14655d49e60c7e25f6ba1240e879455abfb0de764f50bc19dbe485cc7eb6b51869e4e84aef58ed1d1c31a577a21fd8ced8c64c95884cb21eb809214649a9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- BibOpsworks (0.0.5)
4
+ BibOpsworks (0.0.6)
5
5
  json
6
6
 
7
7
  GEM
@@ -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
- newrelic_body = prepare_publishing_data(app_name, deploy_data)
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-License-Key', newrelic_api_key)
14
- request.body = newrelic_body
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::HTTPOK
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
- newrelic_appid_body = "deployment[app_name]=#{app_name}"
32
- newrelic_user_body = "deployment[user]=#{deployment_user}"
33
- newrelic_revision_body = "deployment[revision]=#{scm_revision}"
34
-
35
- "#{newrelic_appid_body}&#{newrelic_user_body}&#{newrelic_revision_body}"
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
@@ -1,5 +1,5 @@
1
1
  module Bib
2
2
  module Opsworks
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
@@ -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
- assert_equal("deployment[app_name]=unittest&deployment[user]=gemtest&deployment[revision]=rev1", result)
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
- assert_equal("deployment[app_name]=unittest&deployment[user]=opsworks&deployment[revision]=rev1", result)
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.5
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: {}
@@ -1,11 +0,0 @@
1
- gem 'minitest'
2
-
3
- require 'minitest/autorun'
4
- require 'bib/opsworks'
5
-
6
- class OpsworksTest < Minitest::Test
7
-
8
- def test_version
9
- assert_equal("0.0.5", BibOpsworks.new.version)
10
- end
11
- end