s3-publisher 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +3 -2
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/s3-publisher.rb +3 -6
- data/s3-publisher.gemspec +24 -30
- data/test/s3-publisher_test.rb +5 -5
- metadata +49 -27
- data/.gitignore +0 -5
data/README.rdoc
CHANGED
@@ -12,7 +12,6 @@ Basic usage:
|
|
12
12
|
|
13
13
|
This will:
|
14
14
|
* push test.txt to my-bucket.s3.amazonaws.com
|
15
|
-
* use reduced redundancy storage
|
16
15
|
* set security to public-read
|
17
16
|
* gzip contents ('abc1234') and set a Content-Encoding: gzip header so clients know to decompress
|
18
17
|
* set a Cache-Control: max-age=5 header
|
@@ -30,9 +29,11 @@ In this example:
|
|
30
29
|
A few miscellaneous notes:
|
31
30
|
* gzip compress is skipped on .jpg/gif/png/tif files
|
32
31
|
* uploads are multi-threaded. You can control worker thread count on instantiation.
|
32
|
+
* pass :redundancy => :reduced when instantiating the publisher to write to reduced
|
33
|
+
redundancy storage (this used to be the default, but now requires the option to be set.)
|
33
34
|
|
34
35
|
See class docs for further options.
|
35
36
|
|
36
37
|
== Copyright
|
37
38
|
|
38
|
-
Copyright (c)
|
39
|
+
Copyright (c) 2011 Ben Koski. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -12,7 +12,7 @@ begin
|
|
12
12
|
gem.authors = ["Ben Koski"]
|
13
13
|
gem.add_development_dependency "thoughtbot-shoulda"
|
14
14
|
gem.add_dependency 'aws_credentials'
|
15
|
-
gem.add_dependency 'right_aws', '
|
15
|
+
gem.add_dependency 'right_aws', '>=3.0.0'
|
16
16
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
17
17
|
end
|
18
18
|
rescue LoadError
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.2
|
data/lib/s3-publisher.rb
CHANGED
@@ -1,11 +1,8 @@
|
|
1
|
-
require '
|
1
|
+
require 'zlib'
|
2
|
+
require 'thread'
|
2
3
|
|
3
|
-
gem 'right_aws', '=2.0.0'
|
4
4
|
require 'right_aws'
|
5
|
-
|
6
5
|
require 'aws_credentials'
|
7
|
-
require 'zlib'
|
8
|
-
require 'thread'
|
9
6
|
|
10
7
|
Thread.abort_on_exception = true
|
11
8
|
|
@@ -64,7 +61,7 @@ class S3Publisher
|
|
64
61
|
headers['Content-Encoding'] = 'gzip'
|
65
62
|
end
|
66
63
|
|
67
|
-
headers['x-amz-storage-class'] = opts[:redundancy] == :
|
64
|
+
headers['x-amz-storage-class'] = opts[:redundancy] == :reduced ? 'REDUCED_REDUNDANCY' : 'STANDARD'
|
68
65
|
headers['Content-Type'] = parse_content_type(opts[:content_type]) if opts[:content_type]
|
69
66
|
|
70
67
|
if opts.has_key?(:cache_control)
|
data/s3-publisher.gemspec
CHANGED
@@ -1,59 +1,53 @@
|
|
1
1
|
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.4.
|
7
|
+
s.name = "s3-publisher"
|
8
|
+
s.version = "0.4.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ben Koski"]
|
12
|
-
s.date =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
12
|
+
s.date = "2011-12-12"
|
13
|
+
s.description = "Publish data to S3 for the world to see"
|
14
|
+
s.email = "gems@benkoski.com"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
|
17
|
+
"README.rdoc"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
"s3-publisher.gemspec",
|
28
|
-
"test/s3-publisher_test.rb",
|
29
|
-
"test/test_helper.rb"
|
30
|
-
]
|
31
|
-
s.homepage = %q{http://github.com/bkoski/s3-publisher}
|
32
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
33
|
-
s.require_paths = ["lib"]
|
34
|
-
s.rubygems_version = %q{1.3.5}
|
35
|
-
s.summary = %q{Publish data to S3 for the world to see}
|
36
|
-
s.test_files = [
|
21
|
+
"LICENSE",
|
22
|
+
"README.rdoc",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"lib/s3-publisher.rb",
|
26
|
+
"s3-publisher.gemspec",
|
37
27
|
"test/s3-publisher_test.rb",
|
38
|
-
|
28
|
+
"test/test_helper.rb"
|
39
29
|
]
|
30
|
+
s.homepage = "http://github.com/bkoski/s3-publisher"
|
31
|
+
s.require_paths = ["lib"]
|
32
|
+
s.rubygems_version = "1.8.10"
|
33
|
+
s.summary = "Publish data to S3 for the world to see"
|
40
34
|
|
41
35
|
if s.respond_to? :specification_version then
|
42
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
43
36
|
s.specification_version = 3
|
44
37
|
|
45
|
-
if Gem::Version.new(Gem::
|
38
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
46
39
|
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
47
40
|
s.add_runtime_dependency(%q<aws_credentials>, [">= 0"])
|
48
|
-
s.add_runtime_dependency(%q<right_aws>, ["
|
41
|
+
s.add_runtime_dependency(%q<right_aws>, [">= 3.0.0"])
|
49
42
|
else
|
50
43
|
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
51
44
|
s.add_dependency(%q<aws_credentials>, [">= 0"])
|
52
|
-
s.add_dependency(%q<right_aws>, ["
|
45
|
+
s.add_dependency(%q<right_aws>, [">= 3.0.0"])
|
53
46
|
end
|
54
47
|
else
|
55
48
|
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
56
49
|
s.add_dependency(%q<aws_credentials>, [">= 0"])
|
57
|
-
s.add_dependency(%q<right_aws>, ["
|
50
|
+
s.add_dependency(%q<right_aws>, [">= 3.0.0"])
|
58
51
|
end
|
59
52
|
end
|
53
|
+
|
data/test/s3-publisher_test.rb
CHANGED
@@ -43,15 +43,15 @@ class S3PublisherTest < Test::Unit::TestCase
|
|
43
43
|
end
|
44
44
|
|
45
45
|
context "redundancy" do
|
46
|
-
should "set
|
47
|
-
set_put_expectation(:headers => { 'x-amz-storage-class' => '
|
46
|
+
should "set STANDARD by default" do
|
47
|
+
set_put_expectation(:headers => { 'x-amz-storage-class' => 'STANDARD' })
|
48
48
|
push_test_data('myfile.txt', '1234', {})
|
49
49
|
|
50
50
|
end
|
51
51
|
|
52
|
-
should "set
|
53
|
-
set_put_expectation(:headers => { 'x-amz-storage-class' => '
|
54
|
-
push_test_data('myfile.txt', '1234', :redundancy => :
|
52
|
+
should "set REDUCED_REDUNDANCY if :redundancy => :reduced is passed" do
|
53
|
+
set_put_expectation(:headers => { 'x-amz-storage-class' => 'REDUCED_REDUNDANCY' })
|
54
|
+
push_test_data('myfile.txt', '1234', :redundancy => :reduced)
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: s3-publisher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 11
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 4
|
9
|
+
- 2
|
10
|
+
version: 0.4.2
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Ben Koski
|
@@ -9,39 +15,52 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
13
|
-
default_executable:
|
18
|
+
date: 2011-12-12 00:00:00 Z
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: thoughtbot-shoulda
|
17
|
-
|
18
|
-
|
19
|
-
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
20
25
|
requirements:
|
21
26
|
- - ">="
|
22
27
|
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
23
31
|
version: "0"
|
24
|
-
|
32
|
+
type: :development
|
33
|
+
version_requirements: *id001
|
25
34
|
- !ruby/object:Gem::Dependency
|
26
35
|
name: aws_credentials
|
27
|
-
|
28
|
-
|
29
|
-
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
30
39
|
requirements:
|
31
40
|
- - ">="
|
32
41
|
- !ruby/object:Gem::Version
|
42
|
+
hash: 3
|
43
|
+
segments:
|
44
|
+
- 0
|
33
45
|
version: "0"
|
34
|
-
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id002
|
35
48
|
- !ruby/object:Gem::Dependency
|
36
49
|
name: right_aws
|
37
|
-
|
38
|
-
|
39
|
-
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
40
53
|
requirements:
|
41
|
-
- - "
|
54
|
+
- - ">="
|
42
55
|
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
|
56
|
+
hash: 7
|
57
|
+
segments:
|
58
|
+
- 3
|
59
|
+
- 0
|
60
|
+
- 0
|
61
|
+
version: 3.0.0
|
62
|
+
type: :runtime
|
63
|
+
version_requirements: *id003
|
45
64
|
description: Publish data to S3 for the world to see
|
46
65
|
email: gems@benkoski.com
|
47
66
|
executables: []
|
@@ -53,7 +72,6 @@ extra_rdoc_files:
|
|
53
72
|
- README.rdoc
|
54
73
|
files:
|
55
74
|
- .document
|
56
|
-
- .gitignore
|
57
75
|
- LICENSE
|
58
76
|
- README.rdoc
|
59
77
|
- Rakefile
|
@@ -62,34 +80,38 @@ files:
|
|
62
80
|
- s3-publisher.gemspec
|
63
81
|
- test/s3-publisher_test.rb
|
64
82
|
- test/test_helper.rb
|
65
|
-
has_rdoc: true
|
66
83
|
homepage: http://github.com/bkoski/s3-publisher
|
67
84
|
licenses: []
|
68
85
|
|
69
86
|
post_install_message:
|
70
|
-
rdoc_options:
|
71
|
-
|
87
|
+
rdoc_options: []
|
88
|
+
|
72
89
|
require_paths:
|
73
90
|
- lib
|
74
91
|
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
75
93
|
requirements:
|
76
94
|
- - ">="
|
77
95
|
- !ruby/object:Gem::Version
|
96
|
+
hash: 3
|
97
|
+
segments:
|
98
|
+
- 0
|
78
99
|
version: "0"
|
79
|
-
version:
|
80
100
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
none: false
|
81
102
|
requirements:
|
82
103
|
- - ">="
|
83
104
|
- !ruby/object:Gem::Version
|
105
|
+
hash: 3
|
106
|
+
segments:
|
107
|
+
- 0
|
84
108
|
version: "0"
|
85
|
-
version:
|
86
109
|
requirements: []
|
87
110
|
|
88
111
|
rubyforge_project:
|
89
|
-
rubygems_version: 1.
|
112
|
+
rubygems_version: 1.8.10
|
90
113
|
signing_key:
|
91
114
|
specification_version: 3
|
92
115
|
summary: Publish data to S3 for the world to see
|
93
|
-
test_files:
|
94
|
-
|
95
|
-
- test/test_helper.rb
|
116
|
+
test_files: []
|
117
|
+
|