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 +4 -4
- data/lib/asset_compiler.rb +2 -1
- data/lib/version.rb +1 -1
- data/lib/vitrine.rb +1 -0
- data/test/test_vitrine_asset_compiler.rb +6 -2
- data/test/test_vitrine_in_rack_stack.rb +11 -0
- data/vitrine.gemspec +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba03e630b806374d517a9071c6daf71ce227ce45
|
4
|
+
data.tar.gz: bd1bc8688272d5ecbd9987da739d34aeea36e182
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9279bc814cea9619f26f0dc5546502282f486bd92fdffbfe7100fde7c37f63037ad037e72f679451963efe37f49b64c042dd7eab3030b54295556ffb855d46b
|
7
|
+
data.tar.gz: 88a612c8538fecf944c7851656a858e64c6dec687b38aa4354d7e176f362c0c0ef87bd83abe358a8862de5a89372a85deb0d17a3ebc1881c5619ea9aa2789657
|
data/lib/asset_compiler.rb
CHANGED
@@ -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
|
-
|
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
|
data/lib/version.rb
CHANGED
data/lib/vitrine.rb
CHANGED
@@ -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
|
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"'
|
data/vitrine.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "vitrine"
|
8
|
-
s.version = "0.0.
|
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-
|
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.
|
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-
|
11
|
+
date: 2014-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|