Created
August 18, 2014 18:36
-
-
Save stuartlynn/675cf0dc10e085bff177 to your computer and use it in GitHub Desktop.
Scribe upload
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
require 'json' | |
require 'pry' | |
require 'aws-sdk' | |
require 'bson' | |
AWS.config access_key_id: ENV['S3_ACCESS_ID'], secret_access_key: ENV['S3_SECRET_KEY'] | |
s3 = AWS::S3.new | |
bucket = s3.buckets['zooniverse-static'] | |
files.each_with_index do |file, index| | |
puts "done #{index} of #{cal.count}" | |
id = BSON::ObjectId.new | |
upload_path = "bucket_name/#{id}.jpg" | |
options = { file: file, acl: :public_read } | |
bucket.objects[upload_path].write options | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment