vitrine 0.0.15 → 0.0.16
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 +1 -1
- data/lib/sourcemaps.rb +33 -0
- data/lib/version.rb +1 -1
- data/test/test_vitrine_asset_compiler.rb +1 -1
- 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: 6c4afcd269b9abc86ecb39b02b1a54c969ef98a2
|
4
|
+
data.tar.gz: 6487d2ed130c0ac7859ec8c7307a720054192396
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74a076f0a0c24bbe1e09d03fea87bf85747515104a2e83f6477b43b4950d244970a4c74e3cf465f9fc71e9a61aac2d791f5c733c5aa055b7260052950130dd44
|
7
|
+
data.tar.gz: c1cb7930928de1182867c03b3c8a073d364a847e521c9ad737c75a951d2c7b602781d579e389f25ce9be6f900a630881b1f7cec754e370e4ba5a67a0df1d89f4
|
data/lib/asset_compiler.rb
CHANGED
@@ -79,7 +79,7 @@ class Vitrine::AssetCompiler < Sinatra::Base
|
|
79
79
|
# whereas otherwise it would have been discarded
|
80
80
|
[
|
81
81
|
"//# sourceMappingURL=#{basename}.js.map",
|
82
|
-
|
82
|
+
Vitrine.compile_coffeescript(source_body)
|
83
83
|
].join("\n")
|
84
84
|
end
|
85
85
|
rescue Errno::ENOENT # Missing CoffeeScript
|
data/lib/sourcemaps.rb
CHANGED
@@ -2,6 +2,39 @@ require 'pathname'
|
|
2
2
|
require 'json'
|
3
3
|
|
4
4
|
module Vitrine
|
5
|
+
|
6
|
+
# Compile a script (String or IO) to JavaScript.
|
7
|
+
# This is a version lifted from here
|
8
|
+
# https://github.com/josh/ruby-coffee-script/blob/114b65b638f66ba04b60bf9c24b54360260f9898/lib/coffee_script.rb
|
9
|
+
# which propagates error line
|
10
|
+
def self.compile_coffeescript(script, options = {})
|
11
|
+
script = script.read if script.respond_to?(:read)
|
12
|
+
|
13
|
+
if options.key?(:bare)
|
14
|
+
elsif options.key?(:no_wrap)
|
15
|
+
options[:bare] = options[:no_wrap]
|
16
|
+
else
|
17
|
+
options[:bare] = false
|
18
|
+
end
|
19
|
+
|
20
|
+
wrapper = <<-WRAPPER
|
21
|
+
(function(script, options) {
|
22
|
+
try {
|
23
|
+
return CoffeeScript.compile(script, options);
|
24
|
+
} catch (err) {
|
25
|
+
if (err instanceof SyntaxError && err.location) {
|
26
|
+
throw new SyntaxError([options.filename, err.location.first_line + 1, err.location.first_column + 1].join(":") + ": " + err.message)
|
27
|
+
} else {
|
28
|
+
throw err;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
})
|
32
|
+
WRAPPER
|
33
|
+
CoffeeScript::Source.context.call(wrapper, script, options)
|
34
|
+
end
|
35
|
+
|
36
|
+
# Compile a CS source map.
|
37
|
+
# TODO: this method should be married to the method that compiles the source code itself
|
5
38
|
def self.build_coffeescript_source_map_body(full_coffeescript_file_path, public_folder_path)
|
6
39
|
|
7
40
|
script = File.read(full_coffeescript_file_path)
|
data/lib/version.rb
CHANGED
@@ -50,7 +50,7 @@ class TestVitrineAssetCompiler < Test::Unit::TestCase
|
|
50
50
|
|
51
51
|
assert_equal 200, last_response.status
|
52
52
|
assert_equal 'text/javascript;charset=utf-8', last_response.content_type
|
53
|
-
err = 'console.error("ExecJS::RuntimeError\n--> SyntaxError: reserved word \"function\"")'
|
53
|
+
err = 'console.error("ExecJS::RuntimeError\n--> SyntaxError: :1:1: reserved word \"function\"")'
|
54
54
|
assert_equal err, last_response.body
|
55
55
|
end
|
56
56
|
|
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.16"
|
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-01-
|
12
|
+
s.date = "2014-01-06"
|
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.16
|
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-01-
|
11
|
+
date: 2014-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|