middleman-s3_sync 3.3.6 → 3.3.7

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b9f5ece891e9dbddd91b614c8d49ef1e734e39e
4
- data.tar.gz: 2441ef3bf923065c7b13c8b3f44117301d05f559
3
+ metadata.gz: d14f4fb3014e030baf26085c24f89a852c15f264
4
+ data.tar.gz: b8c70ecb06640c69606de373237584b51951d9dd
5
5
  SHA512:
6
- metadata.gz: 31f4b4ee2d16237c81f82979862f77fe10182e61b56393fc6d9a73fdeee6be5791ba73ff2a2259e71aec4963dd015aacc7d270fdc16ad0688c8e3ccb55af81f1
7
- data.tar.gz: 0ecc8e6b6bb67412c680928b9264da7323b80a4719c6f5bbb2ea318c9228a035dd0708f104f0f8d2501abe9367f2b9487183d53d6345f1061478210407543397
6
+ metadata.gz: c203dd97741209ceedf3de39354f2bcb8c1d4e00b65bc09f4db4aba26479a027a4e67e0e8c69ea4b08523011ea3ba4ee8319c59a77362bea836b81682004b2c4
7
+ data.tar.gz: 984fba641f37c53cf8c5da14e0b5a1fa2e0044cdb7fb5da997b010772bb58fc3f3a2061ef76afee11597d7d2117a7884593af271acd399907863dd7e36447398
@@ -8,7 +8,7 @@ module Middleman
8
8
  end
9
9
 
10
10
  def caching_policy_for(content_type)
11
- caching_policies.fetch(content_type.to_s, caching_policies[:default])
11
+ caching_policies.fetch(content_type.to_s.split(';').first.strip, caching_policies[:default])
12
12
  end
13
13
 
14
14
  def default_caching_policy
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module S3Sync
3
- VERSION = "3.3.6"
3
+ VERSION = "3.3.7"
4
4
  end
5
5
  end
@@ -2,79 +2,97 @@ require 'spec_helper'
2
2
  require 'middleman/s3_sync/caching_policy'
3
3
 
4
4
  describe Middleman::S3Sync::BrowserCachePolicy do
5
- let(:options) { Hash.new }
6
- subject(:policy) { Middleman::S3Sync::BrowserCachePolicy.new(options) }
7
-
8
- it "should be blank" do
9
- policy.should_not be_nil
10
-
11
- policy.to_s.should_not =~ /max-age=/
12
- policy.to_s.should_not =~ /s-maxage=/
13
- policy.to_s.should_not =~ /public/
14
- policy.to_s.should_not =~ /private/
15
- policy.to_s.should_not =~ /no-cache/
16
- policy.to_s.should_not =~ /no-store/
17
- policy.to_s.should_not =~ /must-revalidate/
18
- policy.to_s.should_not =~ /proxy-revalidate/
19
- policy.expires.should be_nil
20
- end
5
+ context "building the policy" do
6
+ let(:options) { Hash.new }
7
+ subject(:policy) { Middleman::S3Sync::BrowserCachePolicy.new(options) }
8
+
9
+ it "should be blank" do
10
+ policy.should_not be_nil
11
+
12
+ policy.to_s.should_not =~ /max-age=/
13
+ policy.to_s.should_not =~ /s-maxage=/
14
+ policy.to_s.should_not =~ /public/
15
+ policy.to_s.should_not =~ /private/
16
+ policy.to_s.should_not =~ /no-cache/
17
+ policy.to_s.should_not =~ /no-store/
18
+ policy.to_s.should_not =~ /must-revalidate/
19
+ policy.to_s.should_not =~ /proxy-revalidate/
20
+ policy.expires.should be_nil
21
+ end
21
22
 
22
- context "setting max-age" do
23
- let(:options) { { max_age: 300 } }
23
+ context "setting max-age" do
24
+ let(:options) { { max_age: 300 } }
24
25
 
25
- its(:to_s) { should =~ /max-age=300/ }
26
- end
26
+ its(:to_s) { should =~ /max-age=300/ }
27
+ end
27
28
 
28
- context "setting s-maxage" do
29
- let(:options) { { s_maxage: 300 } }
29
+ context "setting s-maxage" do
30
+ let(:options) { { s_maxage: 300 } }
30
31
 
31
- its(:to_s) { should =~ /s-maxage=300/ }
32
- end
32
+ its(:to_s) { should =~ /s-maxage=300/ }
33
+ end
33
34
 
34
- context "set public flag" do
35
- let(:options) { { public: true } }
36
- its(:to_s) { should =~ /public/ }
37
- end
35
+ context "set public flag" do
36
+ let(:options) { { public: true } }
37
+ its(:to_s) { should =~ /public/ }
38
+ end
38
39
 
39
- context "it should set the private flag if it is set to true" do
40
- let(:options) { { private: true } }
41
- its(:to_s) { should =~ /private/ }
42
- end
40
+ context "it should set the private flag if it is set to true" do
41
+ let(:options) { { private: true } }
42
+ its(:to_s) { should =~ /private/ }
43
+ end
43
44
 
44
- context "it should set the no-cache flag when set property" do
45
- let(:options) { { no_cache: true }}
46
- its(:to_s) { should =~ /no-cache/ }
47
- end
45
+ context "it should set the no-cache flag when set property" do
46
+ let(:options) { { no_cache: true }}
47
+ its(:to_s) { should =~ /no-cache/ }
48
+ end
48
49
 
49
- context "setting the no-store flag" do
50
- let(:options) { { no_store: true } }
51
- its(:to_s) { should =~ /no-store/ }
52
- end
50
+ context "setting the no-store flag" do
51
+ let(:options) { { no_store: true } }
52
+ its(:to_s) { should =~ /no-store/ }
53
+ end
53
54
 
54
- context "setting the must-revalidate policy" do
55
- let(:options) { { must_revalidate: true } }
56
- its(:to_s) { should =~ /must-revalidate/ }
57
- end
55
+ context "setting the must-revalidate policy" do
56
+ let(:options) { { must_revalidate: true } }
57
+ its(:to_s) { should =~ /must-revalidate/ }
58
+ end
58
59
 
59
- context "setting the proxy-revalidate policy" do
60
- let(:options) { { proxy_revalidate: true } }
61
- its(:to_s) { should =~ /proxy-revalidate/ }
62
- end
60
+ context "setting the proxy-revalidate policy" do
61
+ let(:options) { { proxy_revalidate: true } }
62
+ its(:to_s) { should =~ /proxy-revalidate/ }
63
+ end
64
+
65
+ context "divide caching policiies with a comma and a space" do
66
+ let(:options) { { :max_age => 300, :public => true } }
63
67
 
64
- context "divide caching policiies with a comma and a space" do
65
- let(:options) { { :max_age => 300, :public => true } }
68
+ it "splits policies eith commans and spaces" do
69
+ policies = policy.to_s.split(/, /)
70
+ policies.length.should == 2
71
+ policies.first.should == 'max-age=300'
72
+ policies.last.should == 'public'
73
+ end
74
+ end
75
+
76
+ context "set the expiration date" do
77
+ let(:options) { { expires: 1.years.from_now } }
66
78
 
67
- it "splits policies eith commans and spaces" do
68
- policies = policy.to_s.split(/, /)
69
- policies.length.should == 2
70
- policies.first.should == 'max-age=300'
71
- policies.last.should == 'public'
79
+ its(:expires) { should == CGI.rfc1123_date(1.year.from_now )}
72
80
  end
73
81
  end
82
+ end
83
+
84
+ describe "Storing and retrieving policies" do
85
+ class CachingPolicy
86
+ include Middleman::S3Sync::CachingPolicy
87
+ end
88
+
89
+ let(:caching_policy) { CachingPolicy.new }
90
+ let(:policy) { caching_policy.caching_policy_for("text/html; charset=utf-8") }
74
91
 
75
- context "set the expiration date" do
76
- let(:options) { { expires: 1.years.from_now } }
92
+ it "finds the policies by the mime-type excluding the parameters" do
93
+ caching_policy.add_caching_policy("text/html", max_age: 300)
77
94
 
78
- its(:expires) { should == CGI.rfc1123_date(1.year.from_now )}
95
+ expect(policy).to_not be_nil
96
+ expect(policy.policies.max_age).to eq(300)
79
97
  end
80
98
  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: 3.3.6
4
+ version: 3.3.7
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: 2015-12-03 00:00:00.000000000 Z
12
+ date: 2015-12-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: middleman-core