Another li'l round of touchups
This commit is contained in:
parent
4d33de8154
commit
5e95ecd3f5
@ -1,16 +1,7 @@
|
||||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config`
|
||||
# on 2016-08-30 10:56:44 -0400 using RuboCop version 0.42.0.
|
||||
# on 2016-08-30 11:24:51 -0400 using RuboCop version 0.42.0.
|
||||
# The point is for the user to remove these configuration records
|
||||
# one by one as the offenses are removed from the code base.
|
||||
# Note that changes in the inspected code, or installation of new
|
||||
# versions of RuboCop, may require this file to be generated again.
|
||||
|
||||
# Offense count: 1
|
||||
Metrics/AbcSize:
|
||||
Max: 17
|
||||
|
||||
# Offense count: 1
|
||||
# Configuration parameters: CountComments.
|
||||
Metrics/MethodLength:
|
||||
Max: 14
|
||||
|
2
.travis.yml
Normal file
2
.travis.yml
Normal file
@ -0,0 +1,2 @@
|
||||
language: ruby
|
||||
script: bundle exec rubocop
|
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Dan Buch
|
||||
Copyright © 2016 Dan Buch
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -1,12 +1,19 @@
|
||||
require 'aws-sdk'
|
||||
|
||||
def main
|
||||
bucket = ENV.fetch('CPI_FEED_AWS_BUCKET')
|
||||
key = ARGV.first || ENV.fetch('CPI_FEED_AWS_KEY')
|
||||
class MiniS3put
|
||||
def initialize(key: nil, instream: $stdin)
|
||||
@bucket = ENV.fetch('CPI_FEED_AWS_BUCKET')
|
||||
@key = key || ENV.fetch('CPI_FEED_AWS_KEY')
|
||||
@instream = instream
|
||||
end
|
||||
|
||||
Aws::S3::Resource.new.bucket(bucket).object(key).put(
|
||||
body: $stdin.read
|
||||
).on_success do |response|
|
||||
def put
|
||||
Aws::S3::Resource.new.bucket(bucket).object(key).put(
|
||||
body: instream.read
|
||||
).on_success(&method(:on_put_success))
|
||||
end
|
||||
|
||||
def on_put_success(response)
|
||||
puts response.data
|
||||
|
||||
Aws::S3::Client.new.put_object_acl(
|
||||
@ -15,10 +22,12 @@ def main
|
||||
puts acl_response.data
|
||||
end
|
||||
|
||||
return 0
|
||||
0
|
||||
end
|
||||
|
||||
1
|
||||
private
|
||||
|
||||
attr_reader :bucket, :key, :instream
|
||||
end
|
||||
|
||||
exit(main) if $PROGRAM_NAME == __FILE__
|
||||
exit(MiniS3put.new(ARGV.first).put) if $PROGRAM_NAME == __FILE__
|
||||
|
Loading…
Reference in New Issue
Block a user