configure-s3-website 1.5.2 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NDNhYmY2NGJlNDViMDU4NjFhYzdkY2ZkZGVhMmM1MmZlOGRiZmY4ZA==
5
- data.tar.gz: !binary |-
6
- ODhmMzJiNGUxMjk5NTcyM2Y5MzBhMDMxNTEyYTM1MzFiNGUwYmM3MA==
2
+ SHA1:
3
+ metadata.gz: 9009f525df4e262e682b12eb2aff7f0a0ee05495
4
+ data.tar.gz: 7c36f88fdc7866a2bdaa57ed49ea43b49fd4c429
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- YTljYzYwZjQ2OTU1MTFkZjQ5ZWJkYmE5MGQxZTdiZTQ3MzU0MWRhMzhlNGU3
10
- MjFjYjVmNTM5ZTUzNjBkM2NmZTU1NDMxNzdmODhlOGU5OTQ3YzBhZGM0YzVk
11
- MzQ1YjM5YWJhN2UyNDI2YjE1MDg3YmI5ZGE0MzJkMzA0NDc4MWY=
12
- data.tar.gz: !binary |-
13
- MGFiMWRhMGVkNGJkMWRlNzcxMGVhZGMzNjdlMjZjNWVlODg4ZDUyNGE2YjRh
14
- ZmRkZDg2NTQwODg1ZmE3NTIyMWZiOWFmZDBmOWMxNGFlOTU3ZmVkNGIyMTJi
15
- ZTQzOWI4NmE4NzgwZGJlMzQzMDlkMGM0OTk1ODNkZDMxN2YxMjk=
6
+ metadata.gz: a4b2354911916484cf7ece5bb24f2a287693cbd025f2272e8b7e6119510792efcb88c386f6dc0e30746266e24465ac1a90f3b7935870773ecfe74b77a5bc528a
7
+ data.tar.gz: 7395f0885c5791fc7ef6c5e080dd739262fc1527d69c981f4e69d285a447fd323d53d3404a99cffdc12f4ba4b53f048d74bc273e482d5e8836444b1a49159bee
@@ -2,6 +2,10 @@
2
2
 
3
3
  This project uses [Semantic Versioning](http://semver.org).
4
4
 
5
+ ## 1.5.3
6
+
7
+ * Do not override ERB code when adding CloudFront dist
8
+
5
9
  ## 1.5.2
6
10
 
7
11
  * Support location constraint eu-west-1
@@ -50,8 +50,13 @@ module ConfigureS3Website
50
50
 
51
51
  def cloudfront_distribution_id=(dist_id)
52
52
  @config['cloudfront_distribution_id'] = dist_id
53
- File.open(@yaml_file_path, 'w') do |yaml_file|
54
- yaml_file.puts @config.to_yaml
53
+ file_contents = File.open(@yaml_file_path).read
54
+ File.open(@yaml_file_path, 'w') do |file|
55
+ result = file_contents.gsub(
56
+ /(s3_bucket:.*$)/,
57
+ "\\1\ncloudfront_distribution_id: #{dist_id}"
58
+ )
59
+ file.write result
55
60
  end
56
61
  end
57
62
 
@@ -1,3 +1,3 @@
1
1
  module ConfigureS3Website
2
- VERSION = '1.5.2'
2
+ VERSION = '1.5.3'
3
3
  end
@@ -1,5 +1,6 @@
1
1
  require 'rspec'
2
2
  require 'configure-s3-website'
3
+ require 'tempfile'
3
4
 
4
5
  describe ConfigureS3Website::FileConfigSource do
5
6
  let(:yaml_file_path) {
@@ -19,4 +20,41 @@ describe ConfigureS3Website::FileConfigSource do
19
20
  it 'returns the yaml file path as description' do
20
21
  config_source.description.should eq(yaml_file_path)
21
22
  end
23
+
24
+ describe 'setter for cloudfront_distribution_id' do
25
+ let(:original_yaml_contents) {
26
+ %Q{
27
+ s3_id: foo
28
+ s3_secret: <%= ENV['my-s3-secret'] %>
29
+ s3_bucket: helloworld.com
30
+
31
+ # This is a comment
32
+ }
33
+ }
34
+
35
+ let(:result) {
36
+ config_file = Tempfile.new 'testfile'
37
+ config_file.write original_yaml_contents
38
+ config_file.close
39
+ config_source = ConfigureS3Website::FileConfigSource.new(config_file.path)
40
+ config_source.cloudfront_distribution_id = 'xxyyzz'
41
+ File.open(config_file.path).read
42
+ }
43
+
44
+ it 'retains the ERB code' do
45
+ result.should include "<%= ENV['my-s3-secret'] %>"
46
+ end
47
+
48
+ it 'appends the CloudFront id as the last enabled value in the YAML file' do
49
+ expected = %Q{
50
+ s3_id: foo
51
+ s3_secret: <%= ENV['my-s3-secret'] %>
52
+ s3_bucket: helloworld.com
53
+ cloudfront_distribution_id: xxyyzz
54
+
55
+ # This is a comment
56
+ }
57
+ result.should == expected
58
+ end
59
+ end
22
60
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: configure-s3-website
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: 1.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lauri Lehmijoki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-23 00:00:00.000000000 Z
11
+ date: 2014-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deep_merge
@@ -202,17 +202,17 @@ require_paths:
202
202
  - lib
203
203
  required_ruby_version: !ruby/object:Gem::Requirement
204
204
  requirements:
205
- - - ! '>='
205
+ - - '>='
206
206
  - !ruby/object:Gem::Version
207
207
  version: '0'
208
208
  required_rubygems_version: !ruby/object:Gem::Requirement
209
209
  requirements:
210
- - - ! '>='
210
+ - - '>='
211
211
  - !ruby/object:Gem::Version
212
212
  version: '0'
213
213
  requirements: []
214
214
  rubyforge_project:
215
- rubygems_version: 2.1.9
215
+ rubygems_version: 2.2.1
216
216
  signing_key:
217
217
  specification_version: 4
218
218
  summary: Configure your AWS S3 bucket to function as a web site