Class: SnapDeploy::Provider::AWS::S3
- Inherits:
-
Clamp::Command
- Object
- Clamp::Command
- SnapDeploy::Provider::AWS::S3
- Includes:
- CLI::DefaultOptions, Helpers
- Defined in:
- lib/snap_deploy/provider/aws/s3.rb
Instance Method Summary collapse
Methods included from Helpers
#access_key_id, #deploy_comment, #encoding_for, #error, #info, #log, #logger, #manually_triggered_by, #pipeline_counter, #pull_request_number, #secret_access_key, #short_commit, #snap_branch, #snap_commit, #snap_upstream_branch
Methods included from CLI::DefaultOptions
Instance Method Details
#execute ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/snap_deploy/provider/aws/s3.rb', line 62 def execute require 'aws-sdk' require 'mime-types' glob_args = ["**/*"] glob_args << File::FNM_DOTMATCH if include_dot_files? Dir.chdir(local_dir) do Dir.glob(*glob_args) do |filename| content_type = MIME::Types.type_for(filename).first.to_s opts = { :content_type => content_type }.merge(encoding_option_for(filename)) opts[:cache_control] = cache_control if cache_control opts[:acl] = acl if acl opts[:expires] = expires if expires unless File.directory?(filename) client.buckets[bucket].objects.create(upload_path(filename), File.read(filename), opts) end end end if index_document client.buckets[bucket].configure_website do |cfg| cfg.index_document_suffix = index_document end end end |