moco 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/lib/moco.rb +1 -1
- data/lib/moco/compilers/coffee_compiler.rb +21 -3
- data/lib/moco/support/error/error.js +2 -36
- data/moco.gemspec +1 -1
- data/test/compilers/coffee_compiler_test.rb +22 -2
- metadata +30 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db7b33be8fc73b02fa62d288c7095878405eb674
|
4
|
+
data.tar.gz: 97ec96a3693bc8c0ceae63476d134b0acb2a5378
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdcfce218c9639c2704721fa80d12742d074abe904a705404603c05c88a144451eeed1213b9c8077e8de680943cfd3564d4912e6bfb58ff4165322ee67f37fbc
|
7
|
+
data.tar.gz: 003ca1a042bf3233a5c86cf6949b2fece6d2dbfa73b5b4518682ee853514cc600d7f268a538624feb2fa790d6110c96aa270cf317faa525c0eceb9509a9e5dab
|
data/Rakefile
CHANGED
data/lib/moco.rb
CHANGED
@@ -53,9 +53,27 @@ module MoCo
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def pretty_error_message(error)
|
56
|
-
|
57
|
-
|
58
|
-
|
56
|
+
location = error['location']
|
57
|
+
return error.message unless location
|
58
|
+
|
59
|
+
line = location['first_line']
|
60
|
+
column = location['first_column']
|
61
|
+
code = source_text.split(/\n/)[line]
|
62
|
+
|
63
|
+
start = column
|
64
|
+
if line == (location['last_line'] || line)
|
65
|
+
stop = location['last_column'] || column
|
66
|
+
stop += 1
|
67
|
+
else
|
68
|
+
stop = code.length
|
69
|
+
end
|
70
|
+
|
71
|
+
message = error['message']
|
72
|
+
message = "#{source_file}:#{line + 1}:#{column + 1}: #{message}"
|
73
|
+
code[start...stop] = AnsiEscape.bold_red(code[start...stop])
|
74
|
+
mark = (' ' * start) + AnsiEscape.bold_red('^' * (stop - start))
|
75
|
+
|
76
|
+
[message, code, mark].join("\n")
|
59
77
|
end
|
60
78
|
|
61
79
|
def source_map_options(options)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// Generated by CoffeeScript 1.
|
1
|
+
// Generated by CoffeeScript 1.7.0
|
2
2
|
(function() {
|
3
3
|
var MoCo;
|
4
4
|
|
@@ -6,44 +6,10 @@
|
|
6
6
|
|
7
7
|
MoCo.errorMessage = "%s";
|
8
8
|
|
9
|
-
MoCo.css = '
|
10
|
-
.moco-compile-error {\
|
11
|
-
white-space: pre-wrap;\
|
12
|
-
font-family: Menlo, Monaco, monospace;\
|
13
|
-
font-size: 14px;\
|
14
|
-
line-height: 1.5;\
|
15
|
-
color: black;\
|
16
|
-
background: white;\
|
17
|
-
border: 3px solid red;\
|
18
|
-
border-radius: 5px;\
|
19
|
-
box-shadow: 5px 5px 15px #CCC;\
|
20
|
-
display: block;\
|
21
|
-
position: fixed;\
|
22
|
-
top: 0;\
|
23
|
-
left: 0;\
|
24
|
-
padding: 20px;\
|
25
|
-
margin: 20px;\
|
26
|
-
z-index: 10000;\
|
27
|
-
}\
|
28
|
-
.moco-compile-error:hover {\
|
29
|
-
z-index: 10001;\
|
30
|
-
}\
|
31
|
-
.moco-compile-error span {\
|
32
|
-
color: red;\
|
33
|
-
}\
|
34
|
-
.moco-compile-error a, .moco-compile-error a:visited {\
|
35
|
-
color: black;\
|
36
|
-
text-decoration: none;\
|
37
|
-
}\
|
38
|
-
.moco-compile-error a:hover, .moco-compile-error a:active {\
|
39
|
-
color: red;\
|
40
|
-
text-decoration: none;\
|
41
|
-
}\
|
42
|
-
';
|
9
|
+
MoCo.css = '.moco-compile-error { white-space: pre-wrap; font-family: Menlo, Monaco, monospace; font-size: 14px; line-height: 1.5; color: black; background: white; border: 3px solid red; border-radius: 5px; box-shadow: 5px 5px 15px #CCC; display: block; position: fixed; top: 0; left: 0; padding: 20px; margin: 20px; z-index: 10000; } .moco-compile-error:hover { z-index: 10001; } .moco-compile-error span { color: red; } .moco-compile-error a, .moco-compile-error a:visited { color: black; text-decoration: none; } .moco-compile-error a:hover, .moco-compile-error a:active { color: red; text-decoration: none; }';
|
43
10
|
|
44
11
|
MoCo.appendErrorElement = function() {
|
45
12
|
var pre, style;
|
46
|
-
|
47
13
|
style = document.createElement('style');
|
48
14
|
style.innerHTML = MoCo.css;
|
49
15
|
pre = document.createElement('pre');
|
data/moco.gemspec
CHANGED
@@ -96,7 +96,7 @@ module MoCo
|
|
96
96
|
|
97
97
|
it 'removes the filename and location from the original message' do
|
98
98
|
message = error.error.message
|
99
|
-
assert message.start_with?('mock.coffee:1:9:
|
99
|
+
assert message.start_with?('mock.coffee:1:9: parameter name')
|
100
100
|
|
101
101
|
message = error.message
|
102
102
|
assert message.start_with?('Parameter name')
|
@@ -105,13 +105,33 @@ module MoCo
|
|
105
105
|
it 'marks the erroneous code with red (using ANSI escape codes)' do
|
106
106
|
message = error.message.split("\n")
|
107
107
|
assert_equal "evil = (\e[1;31meval\e[0m) ->", message[-2]
|
108
|
-
assert_equal "\e[1;31m
|
108
|
+
assert_equal " \e[1;31m^^^^\e[0m" , message[-1]
|
109
109
|
end
|
110
110
|
|
111
111
|
end
|
112
112
|
|
113
113
|
end
|
114
114
|
|
115
|
+
describe 'compile error with minimal location' do
|
116
|
+
|
117
|
+
let(:error) do
|
118
|
+
mock_compiler(CoffeeCompiler, '[').compile rescue $!
|
119
|
+
end
|
120
|
+
|
121
|
+
it 'captures the error location' do
|
122
|
+
assert_equal 1, error.line
|
123
|
+
assert_equal 2, error.column
|
124
|
+
end
|
125
|
+
|
126
|
+
specify 'the error message' do
|
127
|
+
message = error.message.split("\n")
|
128
|
+
assert_equal 'Missing ]', message[0]
|
129
|
+
assert_equal "[\e[1;31m\e[0m", message[1]
|
130
|
+
assert_equal " \e[1;31m^\e[0m", message[2]
|
131
|
+
end
|
132
|
+
|
133
|
+
end
|
134
|
+
|
115
135
|
end if run_compiler_tests?(CoffeeCompiler)
|
116
136
|
|
117
137
|
end
|
metadata
CHANGED
@@ -1,153 +1,153 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moco
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AS Harbitz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rb-fsevent
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0.9'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0.9'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '4.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '4.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: coffee-script-source
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 1.6.2
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 1.6.2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: runjs
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: haml
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: less
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: therubyracer
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: redcarpet
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: pygments.rb
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: sass
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
description: MoCo monitors web templates. On updates the templates are compiled and
|
@@ -160,10 +160,10 @@ extensions: []
|
|
160
160
|
extra_rdoc_files: []
|
161
161
|
files:
|
162
162
|
- LICENSE
|
163
|
-
- moco.gemspec
|
164
|
-
- moco.rb
|
165
|
-
- Rakefile
|
166
163
|
- README.txt
|
164
|
+
- Rakefile
|
165
|
+
- bin/moco
|
166
|
+
- lib/moco.rb
|
167
167
|
- lib/moco/ansi_escape.rb
|
168
168
|
- lib/moco/application.rb
|
169
169
|
- lib/moco/browser.rb
|
@@ -186,7 +186,8 @@ files:
|
|
186
186
|
- lib/moco/support/error/error.html
|
187
187
|
- lib/moco/support/error/error.js
|
188
188
|
- lib/moco/support/reload.scpt
|
189
|
-
-
|
189
|
+
- moco.gemspec
|
190
|
+
- moco.rb
|
190
191
|
- src/error/error.coffee
|
191
192
|
- src/reload.applescript
|
192
193
|
- test/ansi_escape_test.rb
|
@@ -215,7 +216,6 @@ files:
|
|
215
216
|
- test/monitor_test.rb
|
216
217
|
- test/options_test.rb
|
217
218
|
- test/test_helper.rb
|
218
|
-
- bin/moco
|
219
219
|
homepage: https://github.com/asharbitz/moco
|
220
220
|
licenses:
|
221
221
|
- MIT
|
@@ -226,18 +226,18 @@ require_paths:
|
|
226
226
|
- lib
|
227
227
|
required_ruby_version: !ruby/object:Gem::Requirement
|
228
228
|
requirements:
|
229
|
-
- -
|
229
|
+
- - ">="
|
230
230
|
- !ruby/object:Gem::Version
|
231
231
|
version: 1.8.7
|
232
232
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
233
233
|
requirements:
|
234
|
-
- -
|
234
|
+
- - ">="
|
235
235
|
- !ruby/object:Gem::Version
|
236
236
|
version: '0'
|
237
237
|
requirements:
|
238
238
|
- Mac OS X
|
239
239
|
rubyforge_project:
|
240
|
-
rubygems_version: 2.0
|
240
|
+
rubygems_version: 2.2.0
|
241
241
|
signing_key:
|
242
242
|
specification_version: 4
|
243
243
|
summary: Monitors and compiles web templates. Reloads the browser.
|