26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/reduceds3.rb', line 26
def self.extended base
base.extend(S3)
base.class_eval do
def flush_writes @queued_for_write.each do |style, file|
begin
= @s3_headers ? @s3_headers.dup : {}
if @options[:styles][style][:s3_reduced]
['x-amz-storage-class'] = 'REDUCED_REDUNDANCY'
end
log("saving #{path(style)}")
AWS::S3::S3Object.store(path(style),
file,
bucket_name,
{:content_type => instance_read(:content_type),
:access => @s3_permissions,
}.merge())
rescue AWS::S3::NoSuchBucket => e
create_bucket
retry
rescue AWS::S3::ResponseError => e
raise
end
end
@queued_for_write = {}
end
end
end
|