s3-publisher 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -7
- data/lib/s3-publisher.rb +6 -1
- data/s3-publisher.gemspec +1 -1
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48d664ea2ce6509b24e5c8fb90dc077f881947a7
|
4
|
+
data.tar.gz: d13d5df38e7fe20163209d1dca2717150b903daf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 274c5b0f3a847defb9853312c604045972d90a01f5e331f5f94fe2c50d6ab5249a47c53645895447f4eb7c44e63191ff8f06188f18e85e7f97272624b03e7435
|
7
|
+
data.tar.gz: 0999f2a021ed6164a8ce82bb6d1921831f43b4b109ffa434abef6f6334b9cb433d564b9697aa08f3ec7c649b7f1aeedd18919f833ae9360d21d3c5726ae9f865
|
data/README.md
CHANGED
@@ -26,7 +26,7 @@ This will:
|
|
26
26
|
* set a Cache-Control: max-age=5 header
|
27
27
|
|
28
28
|
|
29
|
-
You can also pass file paths, rather than string data. Files aren't read until publish
|
29
|
+
You can also pass file paths, rather than string data. Files aren't read until publish time, saving memory.
|
30
30
|
|
31
31
|
```
|
32
32
|
require 's3-publisher'
|
@@ -38,8 +38,8 @@ end
|
|
38
38
|
### Slightly more advanced example:
|
39
39
|
|
40
40
|
```
|
41
|
-
S3Publisher.publish('my-bucket', :base_path => 'world_cup') do |p|
|
42
|
-
p.push('events.xml', '<xml>...', :
|
41
|
+
S3Publisher.publish('my-bucket', :base_path => 'world_cup', :region => 'us-west-1') do |p|
|
42
|
+
p.push('events.xml', data: '<xml>...', ttl: 15)
|
43
43
|
end
|
44
44
|
```
|
45
45
|
|
@@ -47,9 +47,15 @@ In this example:
|
|
47
47
|
|
48
48
|
* file will be written to my-bucket.s3.amazonaws.com/world_cup/events.xml
|
49
49
|
* Cache-Control: max-age=15 will be set
|
50
|
-
|
51
|
-
A few miscellaneous notes:
|
52
|
-
|
53
|
-
* gzip compress is skipped on .jpg/gif/png/tif files
|
50
|
+
* files will be published into the us-west-1 AWS region (If not specified, this takes the AWS client default. Normally this is not necessary unless you are publishing to two regions from the same session.)
|
54
51
|
|
55
52
|
See class docs for more options.
|
53
|
+
|
54
|
+
### AWS Credentials
|
55
|
+
|
56
|
+
Since S3Publisher uses [aws-sdk](https://github.com/aws/aws-sdk-ruby) any of the usual credential stores will work, including:
|
57
|
+
|
58
|
+
* `AWS.config(access_key_id: '...', secret_access_key: '...', region: 'us-west-2')`
|
59
|
+
* `config/aws.yml` in a RAILS project
|
60
|
+
* ENV vars
|
61
|
+
|
data/lib/s3-publisher.rb
CHANGED
@@ -27,6 +27,10 @@ class S3Publisher
|
|
27
27
|
# @option opts [String] :base_path Path prepended to supplied file_name on upload
|
28
28
|
# @option opts [Integer] :workers Number of threads to use when pushing to S3. Defaults to 3.
|
29
29
|
# @option opts [Object] :logger A logger object to recieve 'uploaded' messages. Defaults to STDOUT.
|
30
|
+
# @option opts [String] :access_key_id AWS access key to use, if different than global AWS config
|
31
|
+
# @option opts [String] :secret_access_key AWS secret access key to use, if different than global AWS config
|
32
|
+
# @option opts [String] :region AWS region to use, if different than global AWS config
|
33
|
+
|
30
34
|
def initialize bucket_name, opts={}
|
31
35
|
@publish_queue = Queue.new
|
32
36
|
@workers_to_use = opts[:workers] || 3
|
@@ -35,7 +39,8 @@ class S3Publisher
|
|
35
39
|
s3_opts = {}
|
36
40
|
s3_opts[:access_key_id] = opts[:access_key_id] if opts.key?(:access_key_id)
|
37
41
|
s3_opts[:secret_access_key] = opts[:secret_access_key] if opts.key?(:secret_access_key)
|
38
|
-
|
42
|
+
s3_opts[:region] = opts[:region] if opts.key?(:region)
|
43
|
+
|
39
44
|
@s3 = AWS::S3.new(s3_opts)
|
40
45
|
|
41
46
|
@bucket_name, @base_path = bucket_name, opts[:base_path]
|
data/s3-publisher.gemspec
CHANGED
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: s3-publisher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Koski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: aws-sdk
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: mime-types
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: Publish data to S3 for the world to see
|
@@ -58,8 +58,8 @@ executables: []
|
|
58
58
|
extensions: []
|
59
59
|
extra_rdoc_files: []
|
60
60
|
files:
|
61
|
-
- .gitignore
|
62
|
-
- .rspec
|
61
|
+
- ".gitignore"
|
62
|
+
- ".rspec"
|
63
63
|
- Gemfile
|
64
64
|
- Gemfile.lock
|
65
65
|
- LICENSE
|
@@ -79,12 +79,12 @@ require_paths:
|
|
79
79
|
- lib
|
80
80
|
required_ruby_version: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
|
-
- -
|
82
|
+
- - ">="
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '0'
|
85
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
requirements: []
|