Class: Opsk::DeployS3
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Opsk::DeployS3
show all
- Includes:
- Thorable, Thor::Actions
- Defined in:
- lib/opskeleton/deploy_s3.rb
Instance Method Summary
collapse
Methods included from Thorable
#artifact, #artifact_path, #check_root, included, #machines, #meta, #name, #type_of
Instance Method Details
#upload ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/opskeleton/deploy_s3.rb', line 21
def upload
require 'aws-sdk'
pkg = Opsk::Package.new
tar = "#{pkg.artifact_path}.tar.gz"
base = File.basename(tar)
if(File.exists?(tar))
begin
conf = Configuration.for 's3'
Aws.config.update({
region: conf.region,
credentials: Aws::Credentials.new(conf.access_key, conf.secret_key),
})
s3 = Aws::S3::Resource.new
s3.bucket(bucket).object("#{path}/#{base}").upload_file(tar)
say("deployed #{base} to #{bucket}/#{path}/#{base}")
rescue Exception => e
say("failed to deploy due to #{e}")
end
else
say('package is missing please run opsk package first')
end
end
|
#validate ⇒ Object
16
17
18
|
# File 'lib/opskeleton/deploy_s3.rb', line 16
def validate
check_root
end
|