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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f43d48a50f634873d3fc8ac0d3e871aa7ace6ce
4
- data.tar.gz: a3773daf43afe32bf7760e674f76f793dad56445
3
+ metadata.gz: 971d547f108ab4d65cf6b0e0f153b9a63ccffca0
4
+ data.tar.gz: 2c6090f3fc8fab542d0dda3484f4e7cd00fff967
5
5
  SHA512:
6
- metadata.gz: 1dc1afd55e950806ca858a8c797b1f75b326758433ba395bb5a2a02847ec377d0682b582f616169d6544069f58aaae3575706ae03f044fb8aeaf7c7fbcc0f5e1
7
- data.tar.gz: ee31d50efa5d357d672e3e24f8f8664312602cfa21107f7b10beadd78f0eade7f6ffbd376bfc4f2395c9266de0336c03a745ac676a80b7b6fb8a20acef5d91a7
6
+ metadata.gz: 06ec844ce2805eaa367f19d232e1557f22ab678f350cfa13c88d0328b74295bb6bba221006365015ef97fcf8c1253f9fbef50ec8ea054fdab4d43d668a314fe7
7
+ data.tar.gz: b7bd4521a17dd013a5dfecea5109806ddc1955db6002093dd052d72eb28714c7d73737b869ae6d59bb21f0fa480caa5ec4ae7c138798a9e538b6179519ad2fb8
@@ -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
- built = Vitrine.compile_coffeescript(source_body)
90
- response.headers['X-SourceMap'] = "#{basename}.js.map"
91
- response.headers['SourceMap'] = "#{basename}.js.map"
92
- built
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
@@ -1,3 +1,3 @@
1
1
  module Vitrine
2
- VERSION = '0.0.27'
2
+ VERSION = '0.0.28'
3
3
  end
@@ -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,GAAA,KAAA;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
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "vitrine"
8
- s.version = "0.0.27"
8
+ s.version = "0.0.28"
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"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vitrine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.27
4
+ version: 0.0.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julik Tarkhanov