middleman-s3_sync 4.0.2 → 4.0.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 +4 -4
- data/.travis.yml +1 -2
- data/README.md +14 -1
- data/lib/middleman-s3_sync/extension.rb +1 -0
- data/lib/middleman/s3_sync/version.rb +1 -1
- data/spec/caching_policy_spec.rb +26 -26
- data/spec/resource_spec.rb +22 -22
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3827f761cc837c4b40aab6fd29a7737fc7039b1
|
4
|
+
data.tar.gz: 3c42ac240f148cb08d7daa3e72dacb29c11c59c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: edbf4fb9046f29261590403220112597f01221350ac223b815856d7a89f833969fbf2a9eb9cb430a9241ffc37603e8baa049baa6ddc64ac1f5b62c6205773453
|
7
|
+
data.tar.gz: 370d1524220e776febbce93868341fc2d381163768dbfb7b698c64e802625f495aefa0ff833735c270362d9c16f0d812523c517ac0ea05c71c7551e3c8b93efe
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -39,7 +39,7 @@ You need to add the following code to your ```config.rb``` file:
|
|
39
39
|
|
40
40
|
```ruby
|
41
41
|
activate :s3_sync do |s3_sync|
|
42
|
-
s3_sync.bucket = 'my.bucket.com' # The name of the S3 bucket you are
|
42
|
+
s3_sync.bucket = 'my.bucket.com' # The name of the S3 bucket you are targeting. This is globally unique.
|
43
43
|
s3_sync.region = 'us-west-1' # The AWS region for your bucket.
|
44
44
|
s3_sync.aws_access_key_id = 'AWS KEY ID'
|
45
45
|
s3_sync.aws_secret_access_key = 'AWS SECRET KEY'
|
@@ -182,6 +182,19 @@ You can specify which environment to run Middleman under using the
|
|
182
182
|
|
183
183
|
$ middleman s3_sync --environment=production
|
184
184
|
|
185
|
+
You can set up separate sync environments in config.rb like this:
|
186
|
+
|
187
|
+
```ruby
|
188
|
+
configure :staging do
|
189
|
+
activate :s3_sync do |s3_sync|
|
190
|
+
s3_sync.bucket = '<bucket'
|
191
|
+
...
|
192
|
+
end
|
193
|
+
end
|
194
|
+
```
|
195
|
+
|
196
|
+
See the Usage section above for all the s3_sync. options to include. Currently, the .s3_sync file does not allow separate environments.
|
197
|
+
|
185
198
|
#### Dry Run
|
186
199
|
|
187
200
|
You can perform a dry run to see what would be the result of a sync
|
@@ -25,6 +25,7 @@ module Middleman
|
|
25
25
|
option :dry_run, false, 'Whether to perform a dry-run'
|
26
26
|
option :index_document, nil, 'S3 custom index document path'
|
27
27
|
option :error_document, nil, 'S3 custom error document path'
|
28
|
+
option :content_types, {}, 'Custom content types'
|
28
29
|
|
29
30
|
expose_to_config :s3_sync_options, :default_caching_policy, :caching_policy
|
30
31
|
|
data/spec/caching_policy_spec.rb
CHANGED
@@ -7,59 +7,59 @@ describe Middleman::S3Sync::BrowserCachePolicy do
|
|
7
7
|
subject(:policy) { Middleman::S3Sync::BrowserCachePolicy.new(options) }
|
8
8
|
|
9
9
|
it "should be blank" do
|
10
|
-
policy.
|
11
|
-
|
12
|
-
policy.to_s.
|
13
|
-
policy.to_s.
|
14
|
-
policy.to_s.
|
15
|
-
policy.to_s.
|
16
|
-
policy.to_s.
|
17
|
-
policy.to_s.
|
18
|
-
policy.to_s.
|
19
|
-
policy.to_s.
|
20
|
-
policy.expires.
|
10
|
+
expect(policy).to_not eq nil
|
11
|
+
|
12
|
+
expect(policy.to_s).to_not match /max-age=/
|
13
|
+
expect(policy.to_s).to_not match /s-maxage=/
|
14
|
+
expect(policy.to_s).to_not match /public/
|
15
|
+
expect(policy.to_s).to_not match /private/
|
16
|
+
expect(policy.to_s).to_not match /no-cache/
|
17
|
+
expect(policy.to_s).to_not match /no-store/
|
18
|
+
expect(policy.to_s).to_not match /must-revalidate/
|
19
|
+
expect(policy.to_s).to_not match /proxy-revalidate/
|
20
|
+
expect(policy.expires).to eq nil
|
21
21
|
end
|
22
22
|
|
23
23
|
context "setting max-age" do
|
24
24
|
let(:options) { { max_age: 300 } }
|
25
25
|
|
26
|
-
its(:to_s) {
|
26
|
+
its(:to_s) { is_expected.to match /max-age=300/ }
|
27
27
|
end
|
28
28
|
|
29
29
|
context "setting s-maxage" do
|
30
30
|
let(:options) { { s_maxage: 300 } }
|
31
31
|
|
32
|
-
its(:to_s) {
|
32
|
+
its(:to_s) { is_expected.to match /s-maxage=300/ }
|
33
33
|
end
|
34
34
|
|
35
35
|
context "set public flag" do
|
36
36
|
let(:options) { { public: true } }
|
37
|
-
its(:to_s) {
|
37
|
+
its(:to_s) { is_expected.to match /public/ }
|
38
38
|
end
|
39
39
|
|
40
40
|
context "it should set the private flag if it is set to true" do
|
41
41
|
let(:options) { { private: true } }
|
42
|
-
its(:to_s) {
|
42
|
+
its(:to_s) { is_expected.to match /private/ }
|
43
43
|
end
|
44
44
|
|
45
45
|
context "it should set the no-cache flag when set property" do
|
46
46
|
let(:options) { { no_cache: true }}
|
47
|
-
its(:to_s) {
|
47
|
+
its(:to_s) { is_expected.to match /no-cache/ }
|
48
48
|
end
|
49
49
|
|
50
50
|
context "setting the no-store flag" do
|
51
51
|
let(:options) { { no_store: true } }
|
52
|
-
its(:to_s) {
|
52
|
+
its(:to_s) { is_expected.to match /no-store/ }
|
53
53
|
end
|
54
54
|
|
55
55
|
context "setting the must-revalidate policy" do
|
56
56
|
let(:options) { { must_revalidate: true } }
|
57
|
-
its(:to_s) {
|
57
|
+
its(:to_s) { is_expected.to match /must-revalidate/ }
|
58
58
|
end
|
59
59
|
|
60
60
|
context "setting the proxy-revalidate policy" do
|
61
61
|
let(:options) { { proxy_revalidate: true } }
|
62
|
-
its(:to_s) {
|
62
|
+
its(:to_s) { is_expected.to match /proxy-revalidate/ }
|
63
63
|
end
|
64
64
|
|
65
65
|
context "divide caching policiies with a comma and a space" do
|
@@ -67,16 +67,16 @@ describe Middleman::S3Sync::BrowserCachePolicy do
|
|
67
67
|
|
68
68
|
it "splits policies eith commans and spaces" do
|
69
69
|
policies = policy.to_s.split(/, /)
|
70
|
-
policies.length.
|
71
|
-
policies.first.
|
72
|
-
policies.last.
|
70
|
+
expect(policies.length).to eq 2
|
71
|
+
expect(policies.first).to eq 'max-age=300'
|
72
|
+
expect(policies.last).to eq 'public'
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
76
|
context "set the expiration date" do
|
77
77
|
let(:options) { { expires: 1.years.from_now } }
|
78
78
|
|
79
|
-
its(:expires) {
|
79
|
+
its(:expires) { is_expected.to eq CGI.rfc1123_date(1.year.from_now )}
|
80
80
|
end
|
81
81
|
end
|
82
82
|
end
|
@@ -92,7 +92,7 @@ describe "Storing and retrieving policies" do
|
|
92
92
|
it "finds the policies by the mime-type excluding the parameters" do
|
93
93
|
caching_policy.add_caching_policy("text/html", max_age: 300)
|
94
94
|
|
95
|
-
expect(policy).to_not
|
95
|
+
expect(policy).to_not eq nil
|
96
96
|
expect(policy.policies.max_age).to eq(300)
|
97
97
|
end
|
98
98
|
end
|
@@ -107,14 +107,14 @@ describe "Handling situations where the content type is nil" do
|
|
107
107
|
it "returns the default caching policy when the content type is nil" do
|
108
108
|
caching_policy.add_caching_policy(:default, max_age:(60 * 60 * 24 * 365))
|
109
109
|
|
110
|
-
expect(caching_policy.caching_policy_for(nil)).to_not
|
110
|
+
expect(caching_policy.caching_policy_for(nil)).to_not eq nil
|
111
111
|
expect(caching_policy.caching_policy_for(nil).policies[:max_age]).to eq(60 * 60 * 24 * 365)
|
112
112
|
end
|
113
113
|
|
114
114
|
it "returns the default caching policy when the content type is blank" do
|
115
115
|
caching_policy.add_caching_policy(:default, max_age:(60 * 60 * 24 * 365))
|
116
116
|
|
117
|
-
expect(caching_policy.caching_policy_for("")).to_not
|
117
|
+
expect(caching_policy.caching_policy_for("")).to_not eq nil
|
118
118
|
expect(caching_policy.caching_policy_for("").policies[:max_age]).to eq(60 * 60 * 24 * 365)
|
119
119
|
end
|
120
120
|
end
|
data/spec/resource_spec.rb
CHANGED
@@ -25,7 +25,7 @@ describe Middleman::S3Sync::Resource do
|
|
25
25
|
allow(File).to receive(:exist?).with('build/path/to/resource.html').and_return(true)
|
26
26
|
end
|
27
27
|
|
28
|
-
its(:status) {
|
28
|
+
its(:status) { is_expected.to eq :new }
|
29
29
|
|
30
30
|
it "does not have a remote equivalent" do
|
31
31
|
expect(resource).not_to be_remote
|
@@ -35,9 +35,9 @@ describe Middleman::S3Sync::Resource do
|
|
35
35
|
expect(resource).to be_local
|
36
36
|
end
|
37
37
|
|
38
|
-
its(:path) {
|
39
|
-
its(:local_path) {
|
40
|
-
its(:remote_path) {
|
38
|
+
its(:path) { is_expected.to eq 'path/to/resource.html'}
|
39
|
+
its(:local_path) { is_expected.to eq 'build/path/to/resource.html' }
|
40
|
+
its(:remote_path) { is_expected.to eq 'path/to/resource.html' }
|
41
41
|
end
|
42
42
|
|
43
43
|
context "with a prefix set" do
|
@@ -54,9 +54,9 @@ describe Middleman::S3Sync::Resource do
|
|
54
54
|
expect(resource).to be_local
|
55
55
|
end
|
56
56
|
|
57
|
-
its(:path) {
|
58
|
-
its(:local_path) {
|
59
|
-
its(:remote_path) {
|
57
|
+
its(:path) { is_expected.to eq 'path/to/resource.html' }
|
58
|
+
its(:local_path) { is_expected.to eq 'build/path/to/resource.html' }
|
59
|
+
its(:remote_path) { is_expected.to eq 'bob/path/to/resource.html' }
|
60
60
|
end
|
61
61
|
|
62
62
|
context "gzipped" do
|
@@ -73,9 +73,9 @@ describe Middleman::S3Sync::Resource do
|
|
73
73
|
expect(resource).to be_local
|
74
74
|
end
|
75
75
|
|
76
|
-
its(:path) {
|
77
|
-
its(:local_path) {
|
78
|
-
its(:remote_path) {
|
76
|
+
its(:path) { is_expected.to eq 'path/to/resource.html' }
|
77
|
+
its(:local_path) { is_expected.to eq 'build/path/to/resource.html.gz' }
|
78
|
+
its(:remote_path) { is_expected.to eq 'path/to/resource.html' }
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
@@ -98,7 +98,7 @@ describe Middleman::S3Sync::Resource do
|
|
98
98
|
allow(File).to receive(:exist?).with('build/path/to/resource.html').and_return(false)
|
99
99
|
end
|
100
100
|
|
101
|
-
its(:status) {
|
101
|
+
its(:status) { is_expected.to eq :deleted }
|
102
102
|
it "does not have a remote equivalent" do
|
103
103
|
expect(resource).to be_remote
|
104
104
|
end
|
@@ -107,9 +107,9 @@ describe Middleman::S3Sync::Resource do
|
|
107
107
|
expect(resource).not_to be_local
|
108
108
|
end
|
109
109
|
|
110
|
-
its(:path) {
|
111
|
-
its(:local_path) {
|
112
|
-
its(:remote_path) {
|
110
|
+
its(:path) { is_expected.to eq 'path/to/resource.html'}
|
111
|
+
its(:local_path) { is_expected.to eq 'build/path/to/resource.html' }
|
112
|
+
its(:remote_path) { is_expected.to eq 'path/to/resource.html' }
|
113
113
|
end
|
114
114
|
|
115
115
|
context "with a prefix set" do
|
@@ -119,7 +119,7 @@ describe Middleman::S3Sync::Resource do
|
|
119
119
|
options.prefix = "bob"
|
120
120
|
end
|
121
121
|
|
122
|
-
its(:status) {
|
122
|
+
its(:status) { is_expected.to eq :deleted }
|
123
123
|
it "does not have a remote equivalent" do
|
124
124
|
expect(resource).to be_remote
|
125
125
|
end
|
@@ -128,9 +128,9 @@ describe Middleman::S3Sync::Resource do
|
|
128
128
|
expect(resource).not_to be_local
|
129
129
|
end
|
130
130
|
|
131
|
-
its(:path) {
|
132
|
-
its(:local_path) {
|
133
|
-
its(:remote_path) {
|
131
|
+
its(:path) { is_expected.to eq 'path/to/resource.html' }
|
132
|
+
its(:local_path) { is_expected.to eq 'build/path/to/resource.html' }
|
133
|
+
its(:remote_path) { is_expected.to eq 'bob/path/to/resource.html' }
|
134
134
|
end
|
135
135
|
|
136
136
|
context "gzipped" do
|
@@ -140,7 +140,7 @@ describe Middleman::S3Sync::Resource do
|
|
140
140
|
options.prefer_gzip = true
|
141
141
|
end
|
142
142
|
|
143
|
-
its(:status) {
|
143
|
+
its(:status) { is_expected.to eq :deleted }
|
144
144
|
it "does not have a remote equivalent" do
|
145
145
|
expect(resource).to be_remote
|
146
146
|
end
|
@@ -149,9 +149,9 @@ describe Middleman::S3Sync::Resource do
|
|
149
149
|
expect(resource).not_to be_local
|
150
150
|
end
|
151
151
|
|
152
|
-
its(:path) {
|
153
|
-
its(:local_path) {
|
154
|
-
its(:remote_path) {
|
152
|
+
its(:path) { is_expected.to eq 'path/to/resource.html' }
|
153
|
+
its(:local_path) { is_expected.to eq 'build/path/to/resource.html' }
|
154
|
+
its(:remote_path) { is_expected.to eq 'path/to/resource.html' }
|
155
155
|
end
|
156
156
|
end
|
157
157
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-s3_sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frederic Jean
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-05-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: middleman-core
|
@@ -299,7 +299,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
299
299
|
version: '0'
|
300
300
|
requirements: []
|
301
301
|
rubyforge_project:
|
302
|
-
rubygems_version: 2.
|
302
|
+
rubygems_version: 2.5.1
|
303
303
|
signing_key:
|
304
304
|
specification_version: 4
|
305
305
|
summary: Tries really, really hard not to push files to S3.
|