Another li'l round of touchups
This commit is contained in:
parent
4d33de8154
commit
5e95ecd3f5
@ -1,16 +1,7 @@
|
|||||||
# This configuration was generated by
|
# This configuration was generated by
|
||||||
# `rubocop --auto-gen-config`
|
# `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
|
# The point is for the user to remove these configuration records
|
||||||
# one by one as the offenses are removed from the code base.
|
# one by one as the offenses are removed from the code base.
|
||||||
# Note that changes in the inspected code, or installation of new
|
# Note that changes in the inspected code, or installation of new
|
||||||
# versions of RuboCop, may require this file to be generated again.
|
# 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)
|
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
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,12 +1,19 @@
|
|||||||
require 'aws-sdk'
|
require 'aws-sdk'
|
||||||
|
|
||||||
def main
|
class MiniS3put
|
||||||
bucket = ENV.fetch('CPI_FEED_AWS_BUCKET')
|
def initialize(key: nil, instream: $stdin)
|
||||||
key = ARGV.first || ENV.fetch('CPI_FEED_AWS_KEY')
|
@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(
|
def put
|
||||||
body: $stdin.read
|
Aws::S3::Resource.new.bucket(bucket).object(key).put(
|
||||||
).on_success do |response|
|
body: instream.read
|
||||||
|
).on_success(&method(:on_put_success))
|
||||||
|
end
|
||||||
|
|
||||||
|
def on_put_success(response)
|
||||||
puts response.data
|
puts response.data
|
||||||
|
|
||||||
Aws::S3::Client.new.put_object_acl(
|
Aws::S3::Client.new.put_object_acl(
|
||||||
@ -15,10 +22,12 @@ def main
|
|||||||
puts acl_response.data
|
puts acl_response.data
|
||||||
end
|
end
|
||||||
|
|
||||||
return 0
|
0
|
||||||
end
|
end
|
||||||
|
|
||||||
1
|
private
|
||||||
|
|
||||||
|
attr_reader :bucket, :key, :instream
|
||||||
end
|
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