eb_deployer 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
data/lib/eb_deployer.rb
CHANGED
@@ -14,6 +14,17 @@ require 'timeout'
|
|
14
14
|
require 'aws-sdk'
|
15
15
|
|
16
16
|
module EbDeployer
|
17
|
+
def self.query_resource_output(key, opts)
|
18
|
+
# AWS.config(:logger => Logger.new($stdout))
|
19
|
+
if region = opts[:region]
|
20
|
+
AWS.config(:region => region)
|
21
|
+
end
|
22
|
+
app = opts[:application]
|
23
|
+
env_name = opts[:environment]
|
24
|
+
cf = CloudFormationProvisioner.new("#{app}-#{env_name}")
|
25
|
+
cf.output(key)
|
26
|
+
end
|
27
|
+
|
17
28
|
def self.deploy(opts)
|
18
29
|
# AWS.config(:logger => Logger.new($stdout))
|
19
30
|
if region = opts[:region]
|
@@ -17,6 +17,10 @@ module EbDeployer
|
|
17
17
|
transform_output_to_settings(transforms)
|
18
18
|
end
|
19
19
|
|
20
|
+
def output(key)
|
21
|
+
stack.outputs.find { |o| o.key == key }.try(:value)
|
22
|
+
end
|
23
|
+
|
20
24
|
private
|
21
25
|
|
22
26
|
def update_stack(template, params)
|
@@ -55,10 +59,6 @@ module EbDeployer
|
|
55
59
|
end while !SUCCESS_STATS.include?(stats)
|
56
60
|
end
|
57
61
|
|
58
|
-
def output(key)
|
59
|
-
stack.outputs.find { |o| o.key == key }.try(:value)
|
60
|
-
end
|
61
|
-
|
62
62
|
def extract_params
|
63
63
|
Hash[ENV.map {|k, v| k =~ /^AWSRESOURCES_(.*)/ ? [$1, v] : nil }.compact]
|
64
64
|
end
|
data/lib/eb_deployer/package.rb
CHANGED
@@ -26,8 +26,14 @@ module EbDeployer
|
|
26
26
|
|
27
27
|
def upload_if_not_exists(file, bucket_name)
|
28
28
|
if @s3.object_length(@bucket_name, s3_path) != File.size(file)
|
29
|
+
log("start uploading to s3 bucket #{@bucket_name}...")
|
29
30
|
@s3.upload_file(@bucket_name, s3_path, file)
|
31
|
+
log("uploading finished")
|
30
32
|
end
|
31
33
|
end
|
34
|
+
|
35
|
+
def log(message)
|
36
|
+
puts "[#{Time.now.utc}][package:#{File.basename(@file)}] #{message}"
|
37
|
+
end
|
32
38
|
end
|
33
39
|
end
|
data/lib/eb_deployer/version.rb
CHANGED