backstop-deploys 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,5 +19,6 @@ Gem::Specification.new do |gem|
19
19
  gem.add_development_dependency('rspec')
20
20
  gem.add_development_dependency('webmock')
21
21
  gem.add_dependency('rest-client')
22
+ gem.add_dependency('scrolls')
22
23
  gem.add_dependency('sinatra')
23
24
  end
@@ -1,6 +1,7 @@
1
1
  require 'cgi'
2
2
  require 'json'
3
3
  require 'rest_client'
4
+ require 'scrolls'
4
5
  require 'securerandom'
5
6
  require 'sinatra/base'
6
7
 
@@ -1,5 +1,5 @@
1
1
  module Backstop
2
2
  module Deploys
3
- VERSION = '0.0.5'
3
+ VERSION = '0.0.6'
4
4
  end
5
5
  end
@@ -21,9 +21,11 @@ module Backstop
21
21
 
22
22
  put '/deploys/:id' do |id|
23
23
  app, version, start_time = parse_id(id)
24
+ description = params[:description]
24
25
  halt [400, {:message => ':id should be in the format of app.version.epoch'}.to_json] if app.nil? or version.nil? or start_time.nil?
25
26
  end_time = params[:end_time]
26
27
  halt [400, {:message => ':source is a required param'}.to_json] unless source = params[:source]
28
+ title = "#{source}.#{app}.#{version}"
27
29
  stream_exists = true
28
30
  data = nil
29
31
 
@@ -38,14 +40,18 @@ module Backstop
38
40
  # events already exists, we just need to update
39
41
  event = events.first
40
42
  event_id = event['id']
41
- payload = { :title => "#{source}.#{app}.#{version}" }
42
- payload[:end_time] = params[:end_time] if params[:end_time]
43
+ payload = { :title => title }
44
+ payload[:end_time] = end_time if end_time
45
+ payload[:description] = description if description
46
+ Scrolls.log(:lib => 'backstop-deploys', :title => title, :start_time => start_time, :end_time => end_time, :description => description)
43
47
  RestClient.put "#{api_endpoint}/annotations/deploys/#{event_id}", payload
44
48
  else
45
49
  # new event needs to be created
46
- payload = { :start_time => start_time, :title => "#{source}.#{app}.#{version}", :source => source }
50
+ payload = { :start_time => start_time, :title => title, :source => source }
47
51
  payload[:end_time] = end_time if end_time
52
+ payload[:description] = description if description
48
53
  q = payload.map { |k,v| "#{k}=#{v}" }.sort.join("&")
54
+ Scrolls.log(:lib => 'backstop-deploys', :title => title, :start_time => start_time, :end_time => end_time, :description => description)
49
55
  RestClient.post "#{api_endpoint}/annotations/deploys", q
50
56
  end
51
57
  end
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.5
4
+ version: 0.0.6
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: &70193935516580 !ruby/object:Gem::Requirement
16
+ requirement: &70241047936460 !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: *70193935516580
24
+ version_requirements: *70241047936460
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &70193935530040 !ruby/object:Gem::Requirement
27
+ requirement: &70241047935660 !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: *70193935530040
35
+ version_requirements: *70241047935660
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &70193935524160 !ruby/object:Gem::Requirement
38
+ requirement: &70241047934620 !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: *70193935524160
46
+ version_requirements: *70241047934620
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: webmock
49
- requirement: &70193935543080 !ruby/object:Gem::Requirement
49
+ requirement: &70241047934180 !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: *70193935543080
57
+ version_requirements: *70241047934180
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rest-client
60
- requirement: &70193935561520 !ruby/object:Gem::Requirement
60
+ requirement: &70241047933600 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,21 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70193935561520
68
+ version_requirements: *70241047933600
69
+ - !ruby/object:Gem::Dependency
70
+ name: scrolls
71
+ requirement: &70241047932740 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: *70241047932740
69
80
  - !ruby/object:Gem::Dependency
70
81
  name: sinatra
71
- requirement: &70193935557720 !ruby/object:Gem::Requirement
82
+ requirement: &70241047931620 !ruby/object:Gem::Requirement
72
83
  none: false
73
84
  requirements:
74
85
  - - ! '>='
@@ -76,7 +87,7 @@ dependencies:
76
87
  version: '0'
77
88
  type: :runtime
78
89
  prerelease: false
79
- version_requirements: *70193935557720
90
+ version_requirements: *70241047931620
80
91
  description: An extension to backstop to allow submission to Librato Metrics
81
92
  email:
82
93
  - michael.gorsuch@gmail.com