vitrine 0.0.28 → 0.0.29

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 971d547f108ab4d65cf6b0e0f153b9a63ccffca0
4
- data.tar.gz: 2c6090f3fc8fab542d0dda3484f4e7cd00fff967
3
+ metadata.gz: ba03e630b806374d517a9071c6daf71ce227ce45
4
+ data.tar.gz: bd1bc8688272d5ecbd9987da739d34aeea36e182
5
5
  SHA512:
6
- metadata.gz: 06ec844ce2805eaa367f19d232e1557f22ab678f350cfa13c88d0328b74295bb6bba221006365015ef97fcf8c1253f9fbef50ec8ea054fdab4d43d668a314fe7
7
- data.tar.gz: b7bd4521a17dd013a5dfecea5109806ddc1955db6002093dd052d72eb28714c7d73737b869ae6d59bb21f0fa480caa5ec4ae7c138798a9e538b6179519ad2fb8
6
+ metadata.gz: a9279bc814cea9619f26f0dc5546502282f486bd92fdffbfe7100fde7c37f63037ad037e72f679451963efe37f49b64c042dd7eab3030b54295556ffb855d46b
7
+ data.tar.gz: 88a612c8538fecf944c7851656a858e64c6dec687b38aa4354d7e176f362c0c0ef87bd83abe358a8862de5a89372a85deb0d17a3ebc1881c5619ea9aa2789657
@@ -118,8 +118,9 @@ class Vitrine::AssetCompiler < Sinatra::Base
118
118
  # and mtime
119
119
  key = [File.expand_path(path), File.mtime(path), request.path_info, get_public]
120
120
  cache_sha = Digest::SHA1.hexdigest(Marshal.dump(key))
121
- cache_control :public
121
+
122
122
  etag cache_sha
123
+ cache_control :public, :must_revalidate
123
124
 
124
125
  log "---> Vitrine AC: Recompiling #{path} -> #{request.path_info}"
125
126
  end
@@ -1,3 +1,3 @@
1
1
  module Vitrine
2
- VERSION = '0.0.28'
2
+ VERSION = '0.0.29'
3
3
  end
@@ -23,6 +23,7 @@ class Vitrine::App < Sinatra::Base
23
23
  # Sets whether Vitrine will output messages about dynamic assets
24
24
  set :silent, true
25
25
  set :public_folder, ->{ File.join(settings.root, 'public') }
26
+ set :static_cache_control, [:public, :must_revalidate, :max_age => 60 * 60]
26
27
 
27
28
  use Vitrine::AssetCompiler
28
29
 
@@ -14,9 +14,10 @@ class TestVitrineAssetCompiler < Test::Unit::TestCase
14
14
 
15
15
  get '/nice.js'
16
16
 
17
- assert_not_nil last_response.headers['ETag'], 'Should set ETag for the compiled version'
18
17
  assert_equal 200, last_response.status
19
18
  assert_equal 'text/javascript;charset=utf-8', last_response.content_type
19
+ assert_not_nil last_response.headers['ETag'], 'Should set ETag for the compiled version'
20
+ assert_equal 'public, must-revalidate', last_response['Cache-Control'], 'Should set cache-control'
20
21
 
21
22
  assert_include last_response.body, 'alert("rockage!")', 'Should include the compiled function'
22
23
  assert_include last_response.body, '//# sourceMappingURL=/nice.js.map', 'Should include the reference to the source map'
@@ -68,7 +69,8 @@ class TestVitrineAssetCompiler < Test::Unit::TestCase
68
69
 
69
70
  get '/nice.js'
70
71
  assert_equal 200, last_response.status
71
- assert_not_nil last_response.headers['ETag']
72
+ assert_not_nil last_response['ETag']
73
+ assert_equal 'public, must-revalidate', last_response['Cache-Control']
72
74
 
73
75
  etag = last_response.headers['ETag']
74
76
  get '/nice.js', {}, rack_env = {'HTTP_IF_NONE_MATCH' => etag}
@@ -86,6 +88,8 @@ class TestVitrineAssetCompiler < Test::Unit::TestCase
86
88
 
87
89
  assert last_response.ok?
88
90
  assert_not_nil last_response.headers['ETag'], 'Should set ETag for the compiled version'
91
+ assert_equal 'public, must-revalidate', last_response['Cache-Control'], 'Should set cache-control'
92
+
89
93
  assert_include last_response.body, '.foo .bar {'
90
94
  assert_include last_response.body, '*# sourceMappingURL=/les-styles-rococo/styles.css.map */'
91
95
 
@@ -26,6 +26,17 @@ class TestVitrineInRackStack < Test::Unit::TestCase
26
26
  assert_match /Lobstericious/, last_response.body, "Should have forwarded to downstream Lobster"
27
27
  end
28
28
 
29
+ def test_fetch_static_file_sets_cache_control
30
+ write_public('hello.coffee') do | f |
31
+ f << 'window.alert "Hello Coffee"'
32
+ end
33
+
34
+ get '/hello.coffee'
35
+ assert last_response.ok?
36
+ assert last_response['Last-Modified'], 'Last-Modified should be set'
37
+ assert_equal 'public, must-revalidate, max-age=3600', last_response['Cache-Control']
38
+ end
39
+
29
40
  def test_fetch_js
30
41
  write_public('hello.coffee') do | f |
31
42
  f << 'window.alert "Hello Coffee"'
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "vitrine"
8
- s.version = "0.0.28"
8
+ s.version = "0.0.29"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Julik Tarkhanov"]
12
- s.date = "2014-02-17"
12
+ s.date = "2014-02-21"
13
13
  s.description = " Serves ERB templates with live CoffeeScript and SASS "
14
14
  s.email = "me@julik.nl"
15
15
  s.executables = ["vitrine"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vitrine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.28
4
+ version: 0.0.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julik Tarkhanov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-17 00:00:00.000000000 Z
11
+ date: 2014-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra