Class: Zine::UploaderAWS
- Inherits:
-
Object
- Object
- Zine::UploaderAWS
- Defined in:
- lib/zine/uploader_aws.rb
Overview
Deploy changes to an AWS S3 bucket and invalidate the Cloudfront cache
Instance Method Summary collapse
-
#initialize(build_dir, options, credentials, delete_file_array, upload_file_array) ⇒ UploaderAWS
constructor
A new instance of UploaderAWS.
- #upload ⇒ Object
Constructor Details
#initialize(build_dir, options, credentials, delete_file_array, upload_file_array) ⇒ UploaderAWS
Returns a new instance of UploaderAWS.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/zine/uploader_aws.rb', line 12 def initialize(build_dir, , credentials, delete_file_array, upload_file_array) return unless ['method'] == 'aws' @build_dir = build_dir ENV['AWS_REGION'], @bucket_name = ['host'].split(':') @path = ['path_or_repo'] @cf_distribution_id = ['cloudfront_distrib'] @verbose = ['verbose'] store_credentials credentials @delete_file_array = Set.new(delete_file_array).to_a @upload_file_array = Set.new(upload_file_array).to_a @s3 = Aws::S3::Client.new @cf = Aws::CloudFront::Client.new end |
Instance Method Details
#upload ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/zine/uploader_aws.rb', line 30 def upload delete deploy invalidate rescue Aws::S3::Errors::ServiceError => e puts Rainbow("S3 error: #{e}").red end |