bbc-cosmos-tools 0.6.1 → 0.7.0

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: 33f0ae16de67d0b0f168224dcd626d309b267f41
4
- data.tar.gz: 4abd19d8284fe959724fefea4e595d5eb5bd0bb4
3
+ metadata.gz: 65cd0367e530b4c48f9c1cbec21d0832fb249849
4
+ data.tar.gz: 5255edaba086f47db45c227ff3ed2868cd7c51f0
5
5
  SHA512:
6
- metadata.gz: b87ca39df5f43f6dbfb3975ccf0e7158ccef62943658f14f4c6f26c9f7414e9e27d6000c75855788dc24c0f8a9366bcc7cd730fa1688dead1e3c9ace42806591
7
- data.tar.gz: 70670e8e77bac0d593c2f42d4c3cce2a715ef3943b36c5e274727b24410cc675dd91d245043ddfdc6268103ded5dee268638a259f3d515d014075c9e4aa26102
6
+ metadata.gz: 05faaf59a12f88c2a52774c1e9faf36795acc2da85138ebfe9cc79889ff93d2491304edf76acdac0808be2fc0c291c7585b53f5ff28408cc0dd3324605602e1d
7
+ data.tar.gz: 6fe251bf659206f15e033529729d0021854c90e21cb1a62392c1175de44c4af1b9da6831a3f85634a793054f2ad0a4aa93f896c3c04fe356bb7f5caac5eb75db
@@ -147,8 +147,42 @@ module BBC
147
147
  error e.message
148
148
  end
149
149
 
150
+ desc "redeploy [COMPONENT]", "Redeploy a component from an existing release"
151
+ def redeploy(component)
152
+ build_id = make_request("deployments/component/#{component}/env/#{options[:env]}")
153
+ start_redeploy(component, build_id[0]["id"])
154
+ end
155
+
150
156
  private
151
157
 
158
+ def start_redeploy(component, id)
159
+ post_data = { "deployment_id" => id }
160
+ endpoint = "/cosmos/env/#{options[:env]}/component/#{component}/redeploy"
161
+ response = post_json(endpoint, post_data)
162
+ redeploy_status(component, response)
163
+ end
164
+
165
+ def redeploy_status(component, response)
166
+ base_url = "https://admin.live.bbc.co.uk/cosmos"
167
+ if response.success?
168
+ success = JSON.parse(response.body)
169
+ say "#{component} successfully redeployed", :green
170
+ say "View deployment of #{component} here #{base_url}#{success['url']}", :green
171
+ else
172
+ api_error(response)
173
+ end
174
+ end
175
+
176
+ def post_json(endpoint, post_data)
177
+ api.post(endpoint, (post_data.to_json))
178
+ end
179
+
180
+ def make_request(path)
181
+ JSON.parse(api.get("/cosmos/#{path}").tap do |request|
182
+ fail Exception, say(request.body, :red) if request.status != 200
183
+ end.body)
184
+ end
185
+
152
186
  def deploy_status(status)
153
187
  case status
154
188
  when "pending_bake"
@@ -1,7 +1,7 @@
1
1
  module BBC
2
2
  module Cosmos
3
3
  module Tools
4
- VERSION = "0.6.1"
4
+ VERSION = "0.7.0"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,111 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bbc-cosmos-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Jack
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-11 00:00:00.000000000 Z
11
+ date: 2015-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
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: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: thor
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: faraday
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: cfndsl
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: aws-sdk
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: 1.63.0
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 1.63.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: highline
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  description: Tool for interacting with BBC Cosmos platform
@@ -116,7 +116,7 @@ executables:
116
116
  extensions: []
117
117
  extra_rdoc_files: []
118
118
  files:
119
- - .gitignore
119
+ - ".gitignore"
120
120
  - Gemfile
121
121
  - LICENSE.txt
122
122
  - README.md
@@ -150,12 +150,12 @@ require_paths:
150
150
  - lib
151
151
  required_ruby_version: !ruby/object:Gem::Requirement
152
152
  requirements:
153
- - - '>='
153
+ - - ">="
154
154
  - !ruby/object:Gem::Version
155
155
  version: '0'
156
156
  required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  requirements:
158
- - - '>='
158
+ - - ">="
159
159
  - !ruby/object:Gem::Version
160
160
  version: '0'
161
161
  requirements: []