jslintrb_v8 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.rdoc +1 -2
  2. data/lib/jslintrb-v8.rb +13 -17
  3. metadata +32 -50
data/README.rdoc CHANGED
@@ -4,5 +4,4 @@ Ruby bindings for JSLint using v8.
4
4
 
5
5
  See RDoc, online here:
6
6
 
7
- http://rdoc.info/github/ngauthier/jslintrb-v8/master/JSLint
8
-
7
+ http://rubydoc.info/gems/jslintrb_v8/JSLint
data/lib/jslintrb-v8.rb CHANGED
@@ -128,11 +128,10 @@ class JSLint
128
128
  end
129
129
 
130
130
  def check(input)
131
- errors = []
132
131
  V8::Context.new do |context|
133
132
  context.load(File.join(File.dirname(__FILE__), 'jslintrb-v8', 'jslint.js'))
134
133
 
135
- context['JSLintRBinput'] = lambda{ input }
134
+ context['JSLintRBinput'] = input
136
135
  context['JSLintRBadsafe'] = @adsafe
137
136
  context['JSLintRBbitwise'] = @bitwise
138
137
  context['JSLintRBbrowser'] = @browser
@@ -160,16 +159,8 @@ class JSLint
160
159
  context['JSLintRBsub'] = @sub
161
160
  context['JSLintRBwhite'] = @white
162
161
  context['JSLintRBwidget'] = @widget
163
- context['JSLintRBreportErrors'] = lambda{|js_errors|
164
- js_errors.each do |e|
165
- next if e.nil?
166
- errors << "Error at line #{e['line'].to_i + 1} " +
167
- "character #{e['character'].to_i + 1}: #{e['reason']}"
168
- errors << " #{e['evidence']}"
169
- end
170
- }
171
162
  context.eval %{
172
- JSLINT(JSLintRBinput(), {
163
+ JSLINT(JSLintRBinput, {
173
164
  adsafe : JSLintRBadsafe,
174
165
  bitwise : JSLintRBbitwise,
175
166
  browser : JSLintRBbrowser,
@@ -198,14 +189,19 @@ class JSLint
198
189
  white : JSLintRBwhite,
199
190
  widget : JSLintRBwidget
200
191
  });
201
- JSLintRBreportErrors(JSLINT.errors);
202
192
  }
193
+ errors = context['JSLINT'].errors.inject("") do |output, error|
194
+ output += "Error at line #{error['line'].to_i + 1} " +
195
+ "character #{error['character'].to_i + 1}: #{error['reason']}\n" +
196
+ " #{error['evidence']}"
197
+ output
198
+ end
199
+ if errors.empty?
200
+ return nil
201
+ else
202
+ return errors
203
+ end
203
204
  end
204
205
 
205
- if errors.empty?
206
- return nil
207
- else
208
- return errors.join("\n")
209
- end
210
206
  end
211
207
  end
metadata CHANGED
@@ -1,82 +1,64 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: jslintrb_v8
3
- version: !ruby/object:Gem::Version
4
- hash: 17
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.4
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 0
9
- - 3
10
- version: 1.0.3
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Nick Gauthier
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-11-08 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2013-02-06 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: therubyracer
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
18
+ requirements:
26
19
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 43
29
- segments:
30
- - 0
31
- - 9
32
- - 8
33
- version: 0.9.8
20
+ - !ruby/object:Gem::Version
21
+ version: 0.11.0
34
22
  type: :runtime
35
- version_requirements: *id001
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 0.11.0
36
30
  description:
37
31
  email: ngauthier@gmail.com
38
32
  executables: []
39
-
40
33
  extensions: []
41
-
42
34
  extra_rdoc_files: []
43
-
44
- files:
35
+ files:
45
36
  - lib/jslintrb-v8.rb
46
37
  - lib/jslintrb-v8/jslint.js
47
38
  - README.rdoc
48
39
  homepage: http://www.github.com/ngauthier/jslintrb_v8
49
40
  licenses: []
50
-
51
41
  post_install_message:
52
42
  rdoc_options: []
53
-
54
- require_paths:
43
+ require_paths:
55
44
  - lib
56
- required_ruby_version: !ruby/object:Gem::Requirement
45
+ required_ruby_version: !ruby/object:Gem::Requirement
57
46
  none: false
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- hash: 3
62
- segments:
63
- - 0
64
- version: "0"
65
- required_rubygems_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ! '>='
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
52
  none: false
67
- requirements:
68
- - - ">="
69
- - !ruby/object:Gem::Version
70
- hash: 3
71
- segments:
72
- - 0
73
- version: "0"
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
74
57
  requirements: []
75
-
76
58
  rubyforge_project:
77
- rubygems_version: 1.8.10
59
+ rubygems_version: 1.8.23
78
60
  signing_key:
79
61
  specification_version: 3
80
62
  summary: Run JSLint from Ruby
81
63
  test_files: []
82
-
64
+ has_rdoc: