Skip to content

Commit

Permalink
uses latest aws sdk for release upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Busbey committed Jun 29, 2016
1 parent f8eaf78 commit 868e010
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions scripts/s3_upload.rb
@@ -1,5 +1,5 @@
require 'rubygems'
require 'aws/s3'
require 'aws-sdk'

if ARGV[0].nil? or ARGV[1].nil? or ARGV[2].nil?
puts "Usage: ruby upload_to_s3.rb <ZIPFILE> <ACCESS_KEY> <SECRET_KEY>"
Expand All @@ -11,13 +11,16 @@
bucket = "quickfixn"
file = File.join(Dir.pwd, ARGV.first)

AWS::S3::Base.establish_connection!(
:access_key_id => access_key,
:secret_access_key => secret_key)

AWS::S3::S3Object.store(File.basename(file),
open(file),
bucket,
:access => :public_read)

Aws.use_bundled_cert!
s3 = Aws::S3::Resource.new(
access_key_id: access_key,
secret_access_key: secret_key,
region: 'us-east-1'
)

obj = s3.bucket(bucket).object(File.basename(file))
if obj.upload_file(file)
puts "Uploaded #{file} to bucket #{bucket}"
else
puts "Could not upload #{file} to bucket #{bucket}!"
end

0 comments on commit 868e010

Please sign in to comment.