-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathjsclint.rb
66 lines (54 loc) · 1.29 KB
/
jsclint.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env ruby
FILENAME = ENV['TM_FILENAME']
FILEPATH = ENV['TM_FILEPATH']
SUPPORT = ENV['TM_BUNDLE_SUPPORT']
JSC = "#{SUPPORT}/bin/JavaScriptCore.framework/Resources/jsc"
JSLINT = "#{SUPPORT}/bin/jslint.js"
PREFS = "#{SUPPORT}/bin/prefs.js"
LAUNCHER = "#{SUPPORT}/bin/jsclinter.js"
# BINARY = `uname -a` =~ /i386/ ? "#{SUPPORT}/bin/intel/jsl" : "#{SUPPORT}/bin/ppc/jsl"
output = `"#{JSC}" "#{JSLINT}" "#{PREFS}" "#{LAUNCHER}" -- "#{FILEPATH}"`
html = <<WTF
<html>
<head>
<title>JavaScript Lint Results</title>
<style type="text/css">
body {
font-size: 13px;
}
pre, code {
background-color: #eee;
color: #400;
margin: 3px 0;
}
h1, h2 { margin: 0 0 5px; }
h1 { font-size: 20px; }
h2 { font-size: 16px;}
span.warning {
color: #c90;
text-transform: uppercase;
font-weight: bold;
}
span.error {
color: #900;
text-transform: uppercase;
font-weight: bold;
}
ul {
margin: 10px 0 0 20px;
padding: 0;
}
li {
margin: 0 0 10px;
}
</style>
</head>
<body>
<h1>JavaScript Lint</h1>
<ul>
#{output}
</ul>
</body>
</html>
WTF
puts html