configure-s3-website 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +4 -0
- data/changelog.md +6 -0
- data/lib/configure-s3-website/s3_client.rb +2 -2
- data/lib/configure-s3-website/version.rb +1 -1
- data/spec/s3_client_spec.rb +36 -2
- data/spec/sample_files/_config_file.yml +3 -0
- data/spec/sample_files/_config_file_oregon.yml +4 -0
- metadata +13 -3
data/.gitignore
CHANGED
data/README.md
CHANGED
data/changelog.md
CHANGED
@@ -67,7 +67,7 @@ module ConfigureS3Website
|
|
67
67
|
<CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
68
68
|
<LocationConstraint>#{endpoint.location_constraint}</LocationConstraint>
|
69
69
|
</CreateBucketConfiguration >
|
70
|
-
|
70
|
+
|
|
71
71
|
end
|
72
72
|
|
73
73
|
call_s3_api(
|
@@ -85,7 +85,7 @@ module ConfigureS3Website
|
|
85
85
|
|
86
86
|
def self.call_s3_api(path, method, body, config_source)
|
87
87
|
endpoint = Endpoint.new(config_source.s3_endpoint || '')
|
88
|
-
date = Time.now.strftime("%a, %d %b %Y %H:%M:%S %Z")
|
88
|
+
date = Time.now.utc.strftime("%a, %d %b %Y %H:%M:%S %Z")
|
89
89
|
digest = create_digest(path, method, config_source, date)
|
90
90
|
url = "https://#{endpoint.hostname}#{path}"
|
91
91
|
uri = URI.parse(url)
|
data/spec/s3_client_spec.rb
CHANGED
@@ -2,17 +2,51 @@ require 'rspec'
|
|
2
2
|
require 'configure-s3-website'
|
3
3
|
|
4
4
|
describe ConfigureS3Website::S3Client do
|
5
|
-
context '#create_bucket' do
|
5
|
+
context '#create_bucket with invalid s3_endpoint value' do
|
6
6
|
let(:config_source) {
|
7
7
|
mock = double('config_source')
|
8
8
|
mock.stub(:s3_endpoint).and_return('invalid-location-constraint')
|
9
9
|
mock
|
10
10
|
}
|
11
|
-
|
11
|
+
|
12
|
+
it 'throws an error' do
|
12
13
|
expect {
|
13
14
|
extractor = ConfigureS3Website::S3Client.
|
14
15
|
send(:create_bucket, config_source)
|
15
16
|
}.to raise_error(InvalidS3LocationConstraintError)
|
16
17
|
end
|
17
18
|
end
|
19
|
+
|
20
|
+
context '#create_bucket with no s3_endpoint value' do
|
21
|
+
let(:config_source) {
|
22
|
+
ConfigureS3Website::FileConfigSource.new('spec/sample_files/_config_file.yml')
|
23
|
+
}
|
24
|
+
|
25
|
+
it 'calls the S3 api without request body' do
|
26
|
+
ConfigureS3Website::S3Client.should_receive(:call_s3_api).
|
27
|
+
with(anything(), anything(), '', anything())
|
28
|
+
ConfigureS3Website::S3Client.send(:create_bucket,
|
29
|
+
config_source)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context '#create_bucket with s3_endpoint value' do
|
34
|
+
let(:config_source) {
|
35
|
+
ConfigureS3Website::FileConfigSource.new(
|
36
|
+
'spec/sample_files/_config_file_oregon.yml'
|
37
|
+
)
|
38
|
+
}
|
39
|
+
|
40
|
+
it 'calls the S3 api with location constraint XML' do
|
41
|
+
ConfigureS3Website::S3Client.should_receive(:call_s3_api).
|
42
|
+
with(anything(), anything(),
|
43
|
+
%|
|
44
|
+
<CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
45
|
+
<LocationConstraint>us-west-2</LocationConstraint>
|
46
|
+
</CreateBucketConfiguration >
|
47
|
+
|, anything())
|
48
|
+
ConfigureS3Website::S3Client.send(:create_bucket,
|
49
|
+
config_source)
|
50
|
+
end
|
51
|
+
end
|
18
52
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configure-s3-website
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-05-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -157,6 +157,8 @@ files:
|
|
157
157
|
- lib/configure-s3-website/version.rb
|
158
158
|
- spec/config_extractor/file_config_extractor_spec.rb
|
159
159
|
- spec/s3_client_spec.rb
|
160
|
+
- spec/sample_files/_config_file.yml
|
161
|
+
- spec/sample_files/_config_file_oregon.yml
|
160
162
|
- spec/sample_files/_config_file_with_eruby.yml
|
161
163
|
homepage: https://github.com/laurilehmijoki/configure-s3-website
|
162
164
|
licenses: []
|
@@ -170,15 +172,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
170
172
|
- - ! '>='
|
171
173
|
- !ruby/object:Gem::Version
|
172
174
|
version: '0'
|
175
|
+
segments:
|
176
|
+
- 0
|
177
|
+
hash: 925918613448529982
|
173
178
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
174
179
|
none: false
|
175
180
|
requirements:
|
176
181
|
- - ! '>='
|
177
182
|
- !ruby/object:Gem::Version
|
178
183
|
version: '0'
|
184
|
+
segments:
|
185
|
+
- 0
|
186
|
+
hash: 925918613448529982
|
179
187
|
requirements: []
|
180
188
|
rubyforge_project:
|
181
|
-
rubygems_version: 1.8.
|
189
|
+
rubygems_version: 1.8.25
|
182
190
|
signing_key:
|
183
191
|
specification_version: 3
|
184
192
|
summary: Configure your AWS S3 bucket to function as a web site
|
@@ -196,4 +204,6 @@ test_files:
|
|
196
204
|
- features/support/vcr.rb
|
197
205
|
- spec/config_extractor/file_config_extractor_spec.rb
|
198
206
|
- spec/s3_client_spec.rb
|
207
|
+
- spec/sample_files/_config_file.yml
|
208
|
+
- spec/sample_files/_config_file_oregon.yml
|
199
209
|
- spec/sample_files/_config_file_with_eruby.yml
|