Created
August 11, 2014 09:20
-
-
Save thukim/4fd58e06f7e541ca2ded to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :aws do | |
task :set_bucket_objects_permission do | |
AWS.config(access_key_id: ENV['AWS_ACCESS_KEY_ID'], secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'], region: 'ap-southeast-1', :s3 => { :region => 'ap-southeast-1' }) | |
bucket = AWS::S3.new.buckets[ENV['S3_BUCKET_NAME']] | |
if bucket.exists? | |
bucket.objects.each do |object| | |
puts object.key | |
object.acl = :public_read | |
puts object.public_url | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment