Class: Lono::AppFile::Upload
Instance Method Summary collapse
-
#initialize(blueprint, options = {}) ⇒ Upload
constructor
A new instance of Upload.
- #s3_bucket ⇒ Object
-
#s3_upload(item) ⇒ Object
TODO: check md5sum and only upload if it changes.
- #upload ⇒ Object
Methods included from Lono::AwsServices
#cfn, #ec2, #iam, #s3, #s3_presigner, #s3_resource, #sts
Methods included from Lono::AwsServices::Util
#find_stack, #rollback_complete?, #stack_exists?, #testing_update?
Methods inherited from Base
Methods included from Blueprint::Root
#bundler_groups, #find_blueprint_root, #require_bundle_gems, #set_blueprint_root
Constructor Details
#initialize(blueprint, options = {}) ⇒ Upload
Returns a new instance of Upload.
6 7 8 |
# File 'lib/lono/app_file/upload.rb', line 6 def initialize(blueprint, ={}) @blueprint, @options = blueprint, end |
Instance Method Details
#s3_bucket ⇒ Object
35 36 37 |
# File 'lib/lono/app_file/upload.rb', line 35 def s3_bucket Lono::S3::Bucket.name end |
#s3_upload(item) ⇒ Object
TODO: check md5sum and only upload if it changes
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/lono/app_file/upload.rb', line 19 def s3_upload(item) filepath = item.zip_file_path s3_key = item.s3_path s3_path = "s3://#{s3_bucket}/#{s3_key}" = "Uploading: #{filepath} to #{s3_path}".color(:green) = "NOOP: #{}" if @options[:noop] puts return if @options[:noop] s3.put_object( body: IO.read(filepath), bucket: s3_bucket, key: s3_key, ) end |