vitrine 0.0.27 → 0.0.28
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 +7 -5
- data/lib/version.rb +1 -1
- data/test/test_vitrine_asset_compiler.rb +5 -6
- data/vitrine.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 971d547f108ab4d65cf6b0e0f153b9a63ccffca0
|
4
|
+
data.tar.gz: 2c6090f3fc8fab542d0dda3484f4e7cd00fff967
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06ec844ce2805eaa367f19d232e1557f22ab678f350cfa13c88d0328b74295bb6bba221006365015ef97fcf8c1253f9fbef50ec8ea054fdab4d43d668a314fe7
|
7
|
+
data.tar.gz: b7bd4521a17dd013a5dfecea5109806ddc1955db6002093dd052d72eb28714c7d73737b869ae6d59bb21f0fa480caa5ec4ae7c138798a9e538b6179519ad2fb8
|
data/lib/asset_compiler.rb
CHANGED
@@ -85,11 +85,13 @@ class Vitrine::AssetCompiler < Sinatra::Base
|
|
85
85
|
mtime_cache coffee_source # Avoid CS recompilation if it isn't needed
|
86
86
|
content_type 'text/javascript'
|
87
87
|
source_body = File.read(coffee_source)
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
88
|
+
# We could have sent a header, but it's a nice idea to have the
|
89
|
+
# sourcemap header saved if we write out the compiled JS,
|
90
|
+
# whereas otherwise it would have been discarded
|
91
|
+
[
|
92
|
+
Vitrine.compile_coffeescript(source_body),
|
93
|
+
"//# sourceMappingURL=#{basename}.js.map",
|
94
|
+
].join("\n")
|
93
95
|
rescue Errno::ENOENT # Missing CoffeeScript
|
94
96
|
forward_or_halt "No such JS file and could not find a .coffee replacement"
|
95
97
|
rescue Exception => e # CS syntax error or something alike
|
data/lib/version.rb
CHANGED
@@ -18,12 +18,11 @@ class TestVitrineAssetCompiler < Test::Unit::TestCase
|
|
18
18
|
assert_equal 200, last_response.status
|
19
19
|
assert_equal 'text/javascript;charset=utf-8', last_response.content_type
|
20
20
|
|
21
|
-
assert_equal '/nice.js.map', last_response.headers['X-SourceMap']
|
22
|
-
assert_equal '/nice.js.map', last_response.headers['SourceMap']
|
23
|
-
|
24
|
-
assert_equal "(function() {\n alert(\"rockage!\");\n\n}).call(this);\n", last_response.body
|
25
|
-
|
26
21
|
assert_include last_response.body, 'alert("rockage!")', 'Should include the compiled function'
|
22
|
+
assert_include last_response.body, '//# sourceMappingURL=/nice.js.map', 'Should include the reference to the source map'
|
23
|
+
|
24
|
+
last_line = last_response.body.split("\n").pop
|
25
|
+
assert_include last_line, 'sourceMappingURL'
|
27
26
|
end
|
28
27
|
|
29
28
|
def test_compiles_coffeescript_sourcemap
|
@@ -40,7 +39,7 @@ class TestVitrineAssetCompiler < Test::Unit::TestCase
|
|
40
39
|
|
41
40
|
get '/js/nice.js.map'
|
42
41
|
ref = {"version"=>3, "file"=>"", "sourceRoot"=>"", "sources"=>["/js/nice.coffee"],
|
43
|
-
"names"=>[], "mappings"=>"AAAA;CAAA,CAAA
|
42
|
+
"names"=>[], "mappings"=>"AAAA;AAAA,EAAA,KAAA,CAAM,UAAN,CAAA,CAAA;AAAA"}
|
44
43
|
assert_equal ref, JSON.parse(last_response.body)
|
45
44
|
end
|
46
45
|
|
data/vitrine.gemspec
CHANGED