configure-s3-website 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/changelog.md +4 -0
- data/lib/configure-s3-website/config_source/file_config_source.rb +0 -5
- data/lib/configure-s3-website/s3_client.rb +5 -1
- data/lib/configure-s3-website/version.rb +1 -1
- data/spec/config_source/file_config_source_spec.rb +8 -0
- data/spec/s3_client_spec.rb +15 -0
- data/spec/sample_files/_config_file_no_credentials.yml +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e24e80677d4bf2df5bb592886165792ace426fe0
|
4
|
+
data.tar.gz: 7301fa4fd9f3fd6d3c0fbdebc1c72d87015703d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd9c294392739927e55a655a6c6cde97404aa6f62f020895d76cec341abae8e345a8622f7860bae3b905da7c9c8ec331b062cf4f3aebc3ab921148fb9f6ab371
|
7
|
+
data.tar.gz: fcf99bf599d895177d639e42d57b98daff56eb34b1724212443938957505e2a13fcf3632f37c9127e23a63322a421d638a0c2354a261f2496c3a973fd586a0ce
|
data/README.md
CHANGED
@@ -31,6 +31,12 @@ s3_secret: your-aws-secret-key
|
|
31
31
|
s3_bucket: name-of-your-bucket
|
32
32
|
```
|
33
33
|
|
34
|
+
**or** you may omit the `profile` and `s3_id` keys to use the system's default credentials.
|
35
|
+
This requires [configuring AWS credentials](http://docs.aws.amazon.com/sdk-for-ruby/v2/developer-guide/setup-config.html#aws-ruby-sdk-setting-credentials).
|
36
|
+
Options include [setting environment variables](http://docs.aws.amazon.com/sdk-for-ruby/v2/developer-guide/setup-config.html#aws-ruby-sdk-credentials-environment),
|
37
|
+
using a [shared credentials file](http://docs.aws.amazon.com/sdk-for-ruby/v2/developer-guide/setup-config.html#aws-ruby-sdk-credentials-shared),
|
38
|
+
or running an [EC2 instance with IAM roles](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UsingIAM.html#UsingIAMrolesWithAmazonEC2Instances).
|
39
|
+
|
34
40
|
Save the file (as *config.yml*, for example). Now you are ready to go. Run the
|
35
41
|
following command:
|
36
42
|
|
data/changelog.md
CHANGED
@@ -82,11 +82,6 @@ module ConfigureS3Website
|
|
82
82
|
if not config.keys.include?'s3_bucket'
|
83
83
|
raise "File #{yaml_file_path} does not contain the required key 's3_bucket'"
|
84
84
|
end
|
85
|
-
|
86
|
-
# check that either s3_id or profile is configured
|
87
|
-
if not (config.keys.include?'s3_id' or config.keys.include?'profile')
|
88
|
-
raise "File #{yaml_file_path} does not contain either 's3_id' or 'profile'"
|
89
|
-
end
|
90
85
|
end
|
91
86
|
end
|
92
87
|
end
|
@@ -27,11 +27,15 @@ module ConfigureS3Website
|
|
27
27
|
access_key_id: config_source.s3_access_key_id,
|
28
28
|
secret_access_key: config_source.s3_secret_access_key
|
29
29
|
)
|
30
|
-
|
30
|
+
elsif config_source.profile
|
31
31
|
Aws::S3::Client.new(
|
32
32
|
region: config_source.s3_endpoint,
|
33
33
|
profile: config_source.profile,
|
34
34
|
)
|
35
|
+
else
|
36
|
+
Aws::S3::Client.new(
|
37
|
+
region: config_source.s3_endpoint,
|
38
|
+
)
|
35
39
|
end
|
36
40
|
end
|
37
41
|
|
@@ -21,6 +21,14 @@ describe ConfigureS3Website::FileConfigSource do
|
|
21
21
|
expect(config_source.description).to eq(yaml_file_path)
|
22
22
|
end
|
23
23
|
|
24
|
+
it 'does not require s3_id, s3_secret or profile ' do
|
25
|
+
config_no_credentials = ConfigureS3Website::FileConfigSource.new('spec/sample_files/_config_file_no_credentials.yml')
|
26
|
+
expect(config_no_credentials.s3_access_key_id).to be_nil
|
27
|
+
expect(config_no_credentials.s3_secret_access_key).to be_nil
|
28
|
+
expect(config_no_credentials.profile).to be_nil
|
29
|
+
expect(config_no_credentials.s3_bucket_name).to eq('my-bucket')
|
30
|
+
end
|
31
|
+
|
24
32
|
describe 'setter for cloudfront_distribution_id' do
|
25
33
|
let(:original_yaml_contents) {
|
26
34
|
%Q{
|
data/spec/s3_client_spec.rb
CHANGED
@@ -144,4 +144,19 @@ describe ConfigureS3Website::S3Client do
|
|
144
144
|
ConfigureS3Website::S3Client.configure_website({config_source: config_source})
|
145
145
|
end
|
146
146
|
end
|
147
|
+
|
148
|
+
context 's3_id, s3_secret and profile not required' do
|
149
|
+
let(:config_source) {
|
150
|
+
ConfigureS3Website::FileConfigSource.new('spec/sample_files/_config_file_no_credentials.yml')
|
151
|
+
}
|
152
|
+
|
153
|
+
it 'calls the S3 API successfully' do
|
154
|
+
allow_any_instance_of(Aws::S3::Client).to receive(:put_bucket_website).with(
|
155
|
+
hash_including(
|
156
|
+
:bucket => "my-bucket"
|
157
|
+
)
|
158
|
+
)
|
159
|
+
ConfigureS3Website::S3Client.configure_website({config_source: config_source})
|
160
|
+
end
|
161
|
+
end
|
147
162
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
s3_bucket: my-bucket
|
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: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lauri Lehmijoki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deep_merge
|
@@ -112,6 +112,7 @@ files:
|
|
112
112
|
- spec/s3_client_spec.rb
|
113
113
|
- spec/sample_files/_config_file.yml
|
114
114
|
- spec/sample_files/_config_file_EU.yml
|
115
|
+
- spec/sample_files/_config_file_no_credentials.yml
|
115
116
|
- spec/sample_files/_config_file_oregon.yml
|
116
117
|
- spec/sample_files/_config_file_with_eruby.yml
|
117
118
|
- spec/sample_files/_custom_index_and_error_docs.yml
|