Plop this on S3 already

This commit is contained in:
Dan Buch 2015-09-13 22:56:29 -04:00
parent 6bad4fb41f
commit 808cd318ee
4 changed files with 34 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.*env
*.csv

View File

@ -2,5 +2,7 @@ source 'https://rubygems.org'
ruby '2.2.2' if ENV.key?('DYNO') ruby '2.2.2' if ENV.key?('DYNO')
gem 'aws-sdk', '~> 2'
gem 'puma' gem 'puma'
gem 'pry', group: [:development, :test]
gem 'sinatra' gem 'sinatra'

View File

@ -1,6 +1,21 @@
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
aws-sdk (2.1.20)
aws-sdk-resources (= 2.1.20)
aws-sdk-core (2.1.20)
jmespath (~> 1.0)
aws-sdk-resources (2.1.20)
aws-sdk-core (= 2.1.20)
coderay (1.1.0)
jmespath (1.0.2)
multi_json (~> 1.0)
method_source (0.8.2)
multi_json (1.11.2)
pry (0.10.1)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
puma (2.13.4) puma (2.13.4)
rack (1.6.4) rack (1.6.4)
rack-protection (1.5.3) rack-protection (1.5.3)
@ -9,12 +24,15 @@ GEM
rack (~> 1.4) rack (~> 1.4)
rack-protection (~> 1.4) rack-protection (~> 1.4)
tilt (>= 1.3, < 3) tilt (>= 1.3, < 3)
slop (3.6.0)
tilt (2.0.1) tilt (2.0.1)
PLATFORMS PLATFORMS
ruby ruby
DEPENDENCIES DEPENDENCIES
aws-sdk (~> 2)
pry
puma puma
sinatra sinatra

12
mini_s3put.rb Normal file
View File

@ -0,0 +1,12 @@
require 'aws-sdk'
bucket = ENV.fetch('CPI_FEED_AWS_BUCKET')
key = ARGV.first || ENV.fetch('CPI_FEED_AWS_KEY')
puts Aws::S3::Resource.new.bucket(bucket).object(key).put(
body: $stdin.read
)
puts Aws::S3::Client.new.put_object_acl(
bucket: bucket, key: key, acl: 'public-read'
)