85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
# File 'lib/asset_s3.rb', line 85
def self.upload(options={})
connect_to_s3
assets.each do |asset|
puts "asset_id: Uploading #{asset} as #{fingerprint(asset)}" if options[:debug]
mime_type = MIME::Types.of(asset).first.to_s
= {
:content_type => mime_type,
:access => s3_permissions,
}.merge()
if gzip_types.include?(mime_type)
data = `gzip -c #{asset}`
.merge!()
else
data = File.read(asset)
end
puts "asset_id: headers: #{.inspect}" if options[:debug]
AWS::S3::S3Object.store(
fingerprint(asset),
data,
s3_bucket,
) unless options[:dry_run]
end
end
|