backstop-deploys 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +18 -2
- data/lib/backstop-deploys/version.rb +1 -1
- data/lib/backstop-deploys/web.rb +2 -2
- data/spec/backstop-deploys/web_spec.rb +2 -2
- metadata +13 -13
data/README.md
CHANGED
@@ -18,9 +18,25 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
This is generally meant to be coupled with your `backstop` Rack app, but doesn't necessarily have to be. An example `config.ru`:
|
22
22
|
|
23
|
-
|
23
|
+
```
|
24
|
+
$:.unshift File.dirname(__FILE__) + '/lib'
|
25
|
+
require "backstop/web"
|
26
|
+
require "backstop-deploys"
|
27
|
+
|
28
|
+
run Rack::Cascade.new [Backstop::Application, Backstop::Deploys::Web]
|
29
|
+
```
|
30
|
+
|
31
|
+
It assumes the pressence of `LIBRATO_EMAIL` and `LIBRATO_KEY` in `ENV`.
|
32
|
+
|
33
|
+
Example curl interaction:
|
34
|
+
|
35
|
+
```bash
|
36
|
+
$ curl -X PUT localhost:5000/deploys/my_app.v73.1350581323 -d 'source=production&end_time=1350581423'
|
37
|
+
```
|
38
|
+
|
39
|
+
The resource id is broken down into `component.version.epoch_time`. `source` is required in the body and represents the environment that is reporting the deploy, `end_time` is optional.
|
24
40
|
|
25
41
|
## Contributing
|
26
42
|
|
data/lib/backstop-deploys/web.rb
CHANGED
@@ -38,12 +38,12 @@ module Backstop
|
|
38
38
|
# events already exists, we just need to update
|
39
39
|
event = events.first
|
40
40
|
event_id = event['id']
|
41
|
-
payload = { :title => "#{app}.#{version}" }
|
41
|
+
payload = { :title => "#{source}.#{app}.#{version}" }
|
42
42
|
payload[:end_time] = params[:end_time] if params[:end_time]
|
43
43
|
RestClient.put "#{api_endpoint}/annotations/deploys/#{event_id}", payload
|
44
44
|
else
|
45
45
|
# new event needs to be created
|
46
|
-
payload = { :start_time => start_time, :title => "#{app}.#{version}", :source => source }
|
46
|
+
payload = { :start_time => start_time, :title => "#{source}.#{app}.#{version}", :source => source }
|
47
47
|
payload[:end_time] = end_time if end_time
|
48
48
|
q = payload.map { |k,v| "#{k}=#{v}" }.sort.join("&")
|
49
49
|
RestClient.post "#{api_endpoint}/annotations/deploys", q
|
@@ -13,10 +13,10 @@ describe Backstop::Deploys::Web do
|
|
13
13
|
let(:api_endpoint) { "https://#{CGI.escape(librato_email)}:#{librato_key}@metrics-api.librato.com/v1" }
|
14
14
|
let(:app_name) { 'foo' }
|
15
15
|
let(:version) { 'v75' }
|
16
|
+
let(:source) { 'test' }
|
16
17
|
let(:t) { Time.now }
|
17
18
|
let(:id) { "#{app_name}.#{version}.#{t.to_i}" }
|
18
|
-
let(:title) { "#{app_name}.#{version}" }
|
19
|
-
let(:source) { 'test' }
|
19
|
+
let(:title) { "#{source}.#{app_name}.#{version}" }
|
20
20
|
let(:params) { {:source => source} }
|
21
21
|
|
22
22
|
before(:each) do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: backstop-deploys
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-10-18 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack-test
|
16
|
-
requirement: &
|
16
|
+
requirement: &70193935516580 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70193935516580
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70193935530040 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70193935530040
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70193935524160 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70193935524160
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: webmock
|
49
|
-
requirement: &
|
49
|
+
requirement: &70193935543080 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70193935543080
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rest-client
|
60
|
-
requirement: &
|
60
|
+
requirement: &70193935561520 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70193935561520
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: sinatra
|
71
|
-
requirement: &
|
71
|
+
requirement: &70193935557720 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70193935557720
|
80
80
|
description: An extension to backstop to allow submission to Librato Metrics
|
81
81
|
email:
|
82
82
|
- michael.gorsuch@gmail.com
|