Class: Zapnito::Cli::Services::S3

Inherits:
Object
  • Object
show all
Defined in:
lib/zapnito/cli/services/s3.rb

Instance Method Summary collapse

Instance Method Details

#upload_theme(theme, release_config) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/zapnito/cli/services/s3.rb', line 7

def upload_theme(theme, release_config)
  release_config.each do |file_path, upload_url|
    absolute_path = theme.absolute_path_for(file_path)
    content_type = Utils.mime_type_for(file_path)
    file = File.open(absolute_path).read

    if should_gzip?(file_path)
      RestClient.put(upload_url, file, content_type: content_type)
    else
      RestClient.put(upload_url, Utils.gzipped(file), content_type: content_type, content_encoding: "gzip")
    end
  end
end