titanic 0.0.4 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/titanic.rb +29 -15
- data/lib/titanic/version.rb +1 -1
- data/titanic.gemspec +1 -1
- metadata +4 -4
data/lib/titanic.rb
CHANGED
@@ -3,6 +3,7 @@ require 'logger'
|
|
3
3
|
require 'aws-sdk'
|
4
4
|
require 'fileutils'
|
5
5
|
require 'net/http'
|
6
|
+
require 'json'
|
6
7
|
|
7
8
|
module Titanic
|
8
9
|
class Titanic
|
@@ -11,17 +12,19 @@ module Titanic
|
|
11
12
|
@paranoid = true
|
12
13
|
log.debug "opts are #{opts}"
|
13
14
|
require_and_set(opts,[
|
14
|
-
|
15
|
+
'project',
|
16
|
+
'prefix',
|
15
17
|
])
|
16
18
|
set(opts,[
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
'access_key',
|
20
|
+
'secret_key',
|
21
|
+
'bucket',
|
22
|
+
'url',
|
23
|
+
'environment',
|
24
|
+
'role',
|
25
|
+
'paranoid',
|
26
|
+
'uuid',
|
27
|
+
'deploy_id',
|
25
28
|
])
|
26
29
|
log.debug "paranoid is set to #{@paranoid}"
|
27
30
|
end
|
@@ -40,10 +43,14 @@ module Titanic
|
|
40
43
|
end
|
41
44
|
end
|
42
45
|
|
43
|
-
def put_deploy
|
44
|
-
verify(['environment','role'])
|
45
|
-
log.info "releasing new deploy #{uuid} at #{deploy_path}"
|
46
|
-
|
46
|
+
def put_deploy
|
47
|
+
verify(['environment','role','uuid','deploy_id'])
|
48
|
+
log.info "releasing new deploy #{@uuid} at #{deploy_path}"
|
49
|
+
deploy_contents = {
|
50
|
+
'uuid' => @uuid,
|
51
|
+
'deploy_id' => @deploy_id
|
52
|
+
}
|
53
|
+
s3.objects[deploy_path].write(deploy_contents.to_json)
|
47
54
|
log.debug "done"
|
48
55
|
end
|
49
56
|
|
@@ -53,7 +60,7 @@ module Titanic
|
|
53
60
|
log.error "exiting"
|
54
61
|
exit 8
|
55
62
|
end
|
56
|
-
return s3.objects[deploy_path].read
|
63
|
+
return JSON.parse(s3.objects[deploy_path].read)
|
57
64
|
end
|
58
65
|
|
59
66
|
def get_deploy_from_http()
|
@@ -67,7 +74,7 @@ module Titanic
|
|
67
74
|
response = http.request(request)
|
68
75
|
log.debug "response code is #{response.code}"
|
69
76
|
raise "file does not exist" unless (response.code.to_i >= 200 && response.code.to_i < 300)
|
70
|
-
return response.body
|
77
|
+
return JSON.parse(response.body)
|
71
78
|
rescue
|
72
79
|
log.error "could not get deploy #{proper_path} from #{@url}. raising error"
|
73
80
|
raise "could not get deploy #{proper_path} from #{@url}"
|
@@ -156,6 +163,13 @@ module Titanic
|
|
156
163
|
end
|
157
164
|
|
158
165
|
def deploy_path
|
166
|
+
log.debug "in deploy_path"
|
167
|
+
%w{prefix project environment role}.each do |var|
|
168
|
+
log.debug "var #{var} is:"
|
169
|
+
value = instance_variable_get "@#{var}"
|
170
|
+
log.debug " #{value}"
|
171
|
+
end
|
172
|
+
|
159
173
|
File.join @prefix, @project, 'deploys', @environment, @role
|
160
174
|
end
|
161
175
|
|
data/lib/titanic/version.rb
CHANGED
data/titanic.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_development_dependency "bundler", "~> 1.
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.1"
|
22
22
|
spec.add_development_dependency "rake"
|
23
23
|
|
24
24
|
spec.add_dependency "trollop"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: titanic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '1.
|
21
|
+
version: '1.1'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '1.
|
29
|
+
version: '1.1'
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: rake
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|