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 CHANGED
@@ -1,2 +1,3 @@
1
1
  tmp
2
2
  pkg
3
+ Gemfile.lock
data/README.md CHANGED
@@ -79,6 +79,10 @@ API with the following JSON:
79
79
  }
80
80
  ```
81
81
 
82
+ ## Development
83
+
84
+ * This project uses [Semantic Versioning](http://semver.org)
85
+
82
86
  ## License
83
87
 
84
88
  See the file LICENSE.
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ This project uses [Semantic Versioning](http://semver.org).
4
+
5
+ ## 1.1.2
6
+
7
+ * Use UTC time when signing requests
8
+
3
9
  ## 1.1.1
4
10
 
5
11
  * Do not send the location constraint XML when using the standard region
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module ConfigureS3Website
2
- VERSION = '1.1.1'
2
+ VERSION = '1.1.2'
3
3
  end
@@ -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
- it 'throws an error if the config contains an invalid S3 location constraint' do
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
@@ -0,0 +1,3 @@
1
+ s3_id: <%= 'hello world' %>
2
+ s3_secret: <%= 'secret world' %>
3
+ s3_bucket: my-bucket
@@ -0,0 +1,4 @@
1
+ s3_id: <%= 'hello world' %>
2
+ s3_secret: <%= 'secret world' %>
3
+ s3_bucket: my-bucket
4
+ s3_endpoint: us-west-2
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.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-01-12 00:00:00.000000000 Z
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.24
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