vitrine 0.0.15 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 955345ceb4a3649556a839783121dd317f7cd2ab
4
- data.tar.gz: 501cc975a85516715fb7dee011f4347b09df9f73
3
+ metadata.gz: 6c4afcd269b9abc86ecb39b02b1a54c969ef98a2
4
+ data.tar.gz: 6487d2ed130c0ac7859ec8c7307a720054192396
5
5
  SHA512:
6
- metadata.gz: 9974b4c8184348f91d2c22723aad8a486e3d5c1a3492cac3de78dd56521e124dec9cd920fac9d705a8cfc76403be3b64d94db9645b4724dfc43126ed9a1bc28f
7
- data.tar.gz: 2a225a39a6ec2ca54e027fd87130116d1af827988838cfcacf52825bd89f1afdf6e0e1a5cced4afd86b46033a350cae0a9e1fe8b9734f5dcf30ea8b88f1fc352
6
+ metadata.gz: 74a076f0a0c24bbe1e09d03fea87bf85747515104a2e83f6477b43b4950d244970a4c74e3cf465f9fc71e9a61aac2d791f5c733c5aa055b7260052950130dd44
7
+ data.tar.gz: c1cb7930928de1182867c03b3c8a073d364a847e521c9ad737c75a951d2c7b602781d579e389f25ce9be6f900a630881b1f7cec754e370e4ba5a67a0df1d89f4
@@ -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
- CoffeeScript.compile(source_body)
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
@@ -1,3 +1,3 @@
1
1
  module Vitrine
2
- VERSION = '0.0.15'
2
+ VERSION = '0.0.16'
3
3
  end
@@ -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.15"
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-05"
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.15
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-05 00:00:00.000000000 Z
11
+ date: 2014-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra