coffee-processing 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/lib/coffee-processing/version.rb +1 -1
- data/lib/coffee-processing.rb +18 -9
- data/test/test_coffee_processing.rb +5 -2
- metadata +2 -2
data/CHANGELOG.md
CHANGED
data/lib/coffee-processing.rb
CHANGED
@@ -13,15 +13,24 @@ module CoffeeProcessing
|
|
13
13
|
code = code.lines.map { |line| "#{line} " }.join
|
14
14
|
code = code.strip
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
File.
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
16
|
+
begin
|
17
|
+
CoffeeScript.compile(
|
18
|
+
Erubis::Eruby.new(
|
19
|
+
File.read File.join(
|
20
|
+
File.dirname(__FILE__),
|
21
|
+
'coffee-processing',
|
22
|
+
'boilerplate.coffee.erb'
|
23
|
+
)
|
24
|
+
).result(binding)
|
25
|
+
)
|
26
|
+
rescue ExecJS::ProgramError => e
|
27
|
+
message = e.message
|
28
|
+
if match = message.match(/line ([1-9][0-9]*):/)
|
29
|
+
range = Range.new(*match.offset(1), true)
|
30
|
+
message[ range ] = (match[1].to_i - 15).to_s
|
31
|
+
end
|
32
|
+
raise e, message, e.backtrace
|
33
|
+
end
|
25
34
|
end
|
26
35
|
|
27
36
|
def self.generate_template_page javascript_object, code, output_dir
|
@@ -36,8 +36,11 @@ draw = ->
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def test_error
|
39
|
-
|
40
|
-
CoffeeProcessing.compile 'this.sketch',
|
39
|
+
begin
|
40
|
+
CoffeeProcessing.compile 'this.sketch', %w[1 2 3 ? 5].join($/)
|
41
|
+
assert false, 'Exception should have been raised'
|
42
|
+
rescue ExecJS::ProgramError => e
|
43
|
+
assert e.to_s =~ /line 4:/, 'Unadjusted line number'
|
41
44
|
end
|
42
45
|
end
|
43
46
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coffee-processing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: coffee-script
|