capistrano-s3 1.0.0 → 1.1.0
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.travis.yml +7 -6
- data/CHANGELOG.md +4 -0
- data/README.md +9 -0
- data/lib/capistrano/s3/defaults.rb +2 -1
- data/lib/capistrano/s3/publisher.rb +22 -1
- data/lib/capistrano/s3/version.rb +1 -1
- data/lib/capistrano/tasks/capistrano_2.rb +1 -1
- data/lib/capistrano/tasks/capistrano_3.rb +1 -1
- data/spec/publisher_spec.rb +3 -2
- metadata +3 -3
- metadata.gz.sig +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7181c1cd58ffcacd370bc1801a4a1de156b60490
|
|
4
|
+
data.tar.gz: 48c6ab3151aa29bc96df90bcbb50bbb66340f2f7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: df7c91285663a990bef6c758a9119b11fde17c6fc6e82b01b753c62925331f68f757d8132338aae56787d87e22b3377c8a566d4e5db2550228eeaab87986a21f
|
|
7
|
+
data.tar.gz: eb45abf3f729d1f3c92245c2e76bc505651ffd5eb94dc4ab2c6bb591a12511570cb870c9f97a78feb8918a862d40dd55bb507f4ce8fb38eb79a1cf4f12b48b71
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data.tar.gz.sig
CHANGED
|
Binary file
|
data/.travis.yml
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
language: ruby
|
|
2
|
+
dist: trusty
|
|
2
3
|
bundler_args: --without debug release
|
|
3
4
|
before_install:
|
|
4
|
-
- gem install bundler
|
|
5
|
+
- ruby -v | (grep -v "rubinius" && gem install bundler) || echo 0
|
|
5
6
|
rvm:
|
|
6
|
-
- 2.
|
|
7
|
-
- 2.
|
|
8
|
-
- 2.
|
|
9
|
-
- rbx-
|
|
10
|
-
- jruby-9.
|
|
7
|
+
- 2.2.6
|
|
8
|
+
- 2.3.3
|
|
9
|
+
- 2.4.0
|
|
10
|
+
- rbx-3.69
|
|
11
|
+
- jruby-9.1.5.0
|
|
11
12
|
- jruby-head
|
|
12
13
|
- ruby-head
|
|
13
14
|
matrix:
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -130,6 +130,15 @@ Just add to your configuration:
|
|
|
130
130
|
set :only_gzip, true
|
|
131
131
|
```
|
|
132
132
|
|
|
133
|
+
### CloudFront invalidation
|
|
134
|
+
|
|
135
|
+
If you set a CloudFront distribution ID (not the URL!) and an array of paths, capistrano-s3 will post an invalidation request. CloudFront supports wildcard invalidations. For example:
|
|
136
|
+
|
|
137
|
+
```ruby
|
|
138
|
+
set :distribution_id, "CHANGETHIS"
|
|
139
|
+
set :invalidations, [ "/index.html", "/assets/*" ]
|
|
140
|
+
```
|
|
141
|
+
|
|
133
142
|
## Example of usage
|
|
134
143
|
|
|
135
144
|
Our Ruby stack for static websites:
|
|
@@ -7,8 +7,9 @@ module Capistrano
|
|
|
7
7
|
module Publisher
|
|
8
8
|
LAST_PUBLISHED_FILE = '.last_published'
|
|
9
9
|
|
|
10
|
-
def self.publish!(s3_endpoint, key, secret, bucket, source, only_gzip, extra_options)
|
|
10
|
+
def self.publish!(s3_endpoint, key, secret, bucket, source, distribution_id, invalidations, only_gzip, extra_options)
|
|
11
11
|
s3 = self.establish_s3_client_connection!(s3_endpoint, key, secret)
|
|
12
|
+
updated = false
|
|
12
13
|
|
|
13
14
|
self.files(source).each do |file|
|
|
14
15
|
if !File.directory?(file)
|
|
@@ -22,6 +23,22 @@ module Capistrano
|
|
|
22
23
|
end
|
|
23
24
|
end
|
|
24
25
|
|
|
26
|
+
# invalidate CloudFront distribution if needed
|
|
27
|
+
if distribution_id && !invalidations.empty?
|
|
28
|
+
cf = self.establish_cf_client_connection!(key, secret)
|
|
29
|
+
|
|
30
|
+
cf.create_invalidation({
|
|
31
|
+
:distribution_id => distribution_id,
|
|
32
|
+
:invalidation_batch => {
|
|
33
|
+
:paths => {
|
|
34
|
+
:quantity => invalidations.count,
|
|
35
|
+
:items => invalidations
|
|
36
|
+
},
|
|
37
|
+
:caller_reference => SecureRandom.hex
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
end
|
|
41
|
+
|
|
25
42
|
FileUtils.touch(LAST_PUBLISHED_FILE)
|
|
26
43
|
end
|
|
27
44
|
|
|
@@ -45,6 +62,10 @@ module Capistrano
|
|
|
45
62
|
)
|
|
46
63
|
end
|
|
47
64
|
|
|
65
|
+
def self.establish_cf_client_connection!(key, secret)
|
|
66
|
+
self.establish_connection!(AWS::CloudFront::Client, nil, key, secret)
|
|
67
|
+
end
|
|
68
|
+
|
|
48
69
|
def self.establish_s3_client_connection!(s3_endpoint, key, secret)
|
|
49
70
|
self.establish_connection!(AWS::S3::Client, s3_endpoint, key, secret)
|
|
50
71
|
end
|
|
@@ -18,7 +18,7 @@ module Capistrano
|
|
|
18
18
|
task :upload_files do
|
|
19
19
|
extra_options = { :write => bucket_write_options, :redirect => redirect_options }
|
|
20
20
|
S3::Publisher.publish!(s3_endpoint, access_key_id, secret_access_key,
|
|
21
|
-
bucket, deployment_path, only_gzip, extra_options)
|
|
21
|
+
bucket, deployment_path, distribution_id, invalidations, only_gzip, extra_options)
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|
|
@@ -15,7 +15,7 @@ namespace :deploy do
|
|
|
15
15
|
task :upload_files do
|
|
16
16
|
extra_options = { :write => fetch(:bucket_write_options), :redirect => fetch(:redirect_options) }
|
|
17
17
|
Capistrano::S3::Publisher.publish!(fetch(:s3_endpoint), fetch(:access_key_id), fetch(:secret_access_key),
|
|
18
|
-
fetch(:bucket), fetch(:deployment_path), fetch(:only_gzip), extra_options)
|
|
18
|
+
fetch(:bucket), fetch(:deployment_path), fetch(:distribution_id), fetch(:invalidations), fetch(:only_gzip), extra_options)
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
|
data/spec/publisher_spec.rb
CHANGED
|
@@ -10,16 +10,17 @@ describe Capistrano::S3::Publisher do
|
|
|
10
10
|
context "on publish!" do
|
|
11
11
|
it "publish all files" do
|
|
12
12
|
AWS::S3::Client::V20060301.any_instance.expects(:put_object).times(8)
|
|
13
|
+
AWS::CloudFront::Client::V20141106.any_instance.expects(:create_invalidation).once
|
|
13
14
|
|
|
14
15
|
path = File.join(@root, 'sample')
|
|
15
|
-
Capistrano::S3::Publisher.publish!('s3.amazonaws.com', 'abc', '123', 'mybucket.amazonaws.com', path, false, {})
|
|
16
|
+
Capistrano::S3::Publisher.publish!('s3.amazonaws.com', 'abc', '123', 'mybucket.amazonaws.com', path, 'cf123', ['*'], false, {})
|
|
16
17
|
end
|
|
17
18
|
|
|
18
19
|
it "publish only gzip files when option is enabled" do
|
|
19
20
|
AWS::S3::Client::V20060301.any_instance.expects(:put_object).times(4)
|
|
20
21
|
|
|
21
22
|
path = File.join(@root, 'sample')
|
|
22
|
-
Capistrano::S3::Publisher.publish!('s3.amazonaws.com', 'abc', '123', 'mybucket.amazonaws.com', path, true, {})
|
|
23
|
+
Capistrano::S3::Publisher.publish!('s3.amazonaws.com', 'abc', '123', 'mybucket.amazonaws.com', path, 'cf123', [], true, {})
|
|
23
24
|
end
|
|
24
25
|
end
|
|
25
26
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: capistrano-s3
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jean-Philippe Doyle
|
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
|
36
36
|
t/JsZnAlWYkJIees2SFV5X/t34oeMu04yY2u9y2YBqKovR97m5YF7zqgx0JODV0x
|
|
37
37
|
ytwUJvEjznBnJV4OoDE=
|
|
38
38
|
-----END CERTIFICATE-----
|
|
39
|
-
date:
|
|
39
|
+
date: 2017-01-24 00:00:00.000000000 Z
|
|
40
40
|
dependencies:
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: aws-sdk
|
|
@@ -220,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
220
220
|
version: '0'
|
|
221
221
|
requirements: []
|
|
222
222
|
rubyforge_project:
|
|
223
|
-
rubygems_version: 2.5.
|
|
223
|
+
rubygems_version: 2.5.2
|
|
224
224
|
signing_key:
|
|
225
225
|
specification_version: 4
|
|
226
226
|
summary: Build and deploy a static website to Amazon S3
|
metadata.gz.sig
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
d�����$7k,���"y:B
|
|
2
|
+
)Qҧ��V�G>�jE��*�T�*ǽ�#P=�"3��/�L��{���+؆����j�+x�� ]�%6�3|���N��wX�Z/���w
|
|
3
|
+
�D0��T�P������1u%hR 9`����q���j���;`qՄ0�ݠ��V{�� �*:=����Ex5���8������V�W�"��[Kz"I��7���T�ѩ���4cPcB��|k�>�C�OCa�h��ѽsU
|