jshintrb 0.1.6 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -0
- data/README.md +2 -2
- data/Rakefile +3 -4
- data/jshintrb.gemspec +1 -1
- data/lib/js/jshint.js +1358 -1127
- data/lib/jshintrb.rb +2 -2
- data/lib/jshintrb/lint.rb +8 -3
- data/lib/jshintrb/version.rb +2 -2
- data/spec/jshintrb_spec.rb +6 -0
- metadata +58 -88
data/lib/jshintrb.rb
CHANGED
@@ -6,8 +6,8 @@ require "jshintrb/reporter/default"
|
|
6
6
|
|
7
7
|
module Jshintrb
|
8
8
|
|
9
|
-
def self.lint(source, options = nil)
|
10
|
-
Lint.new(options).lint(source)
|
9
|
+
def self.lint(source, options = nil, globals = nil)
|
10
|
+
Lint.new(options, globals).lint(source)
|
11
11
|
end
|
12
12
|
|
13
13
|
def self.report(source, options = nil, out = nil)
|
data/lib/jshintrb/lint.rb
CHANGED
@@ -30,7 +30,7 @@ module Jshintrb
|
|
30
30
|
|
31
31
|
SourcePath = File.expand_path("../../js/jshint.js", __FILE__)
|
32
32
|
|
33
|
-
def initialize(options = nil)
|
33
|
+
def initialize(options = nil, globals = nil)
|
34
34
|
|
35
35
|
if options == :defaults then
|
36
36
|
@options = DEFAULTS.dup
|
@@ -43,6 +43,8 @@ module Jshintrb
|
|
43
43
|
raise 'Unsupported option for Jshintrb: ' + options.to_s
|
44
44
|
end
|
45
45
|
|
46
|
+
@globals = globals
|
47
|
+
|
46
48
|
@context = ExecJS.compile(File.open(SourcePath, "r:UTF-8").read)
|
47
49
|
end
|
48
50
|
|
@@ -50,10 +52,13 @@ module Jshintrb
|
|
50
52
|
source = source.respond_to?(:read) ? source.read : source.to_s
|
51
53
|
|
52
54
|
js = []
|
53
|
-
if @options.nil? then
|
55
|
+
if @options.nil? and @globals.nil? then
|
54
56
|
js << "JSHINT(#{MultiJson.dump(source)});"
|
55
|
-
|
57
|
+
elsif @globals.nil? then
|
56
58
|
js << "JSHINT(#{MultiJson.dump(source)}, #{MultiJson.dump(@options)});"
|
59
|
+
else
|
60
|
+
globals_hash = Hash[*@globals.product([false]).flatten]
|
61
|
+
js << "JSHINT(#{MultiJson.dump(source)}, #{MultiJson.dump(@options)}, #{MultiJson.dump(globals_hash)});"
|
57
62
|
end
|
58
63
|
js << "return JSHINT.errors;"
|
59
64
|
|
data/lib/jshintrb/version.rb
CHANGED
data/spec/jshintrb_spec.rb
CHANGED
metadata
CHANGED
@@ -1,98 +1,79 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: jshintrb
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
- 6
|
9
|
-
version: 0.1.6
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- stereobooster
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-08-29 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: rspec
|
22
|
-
requirement: &
|
16
|
+
requirement: &81377020 !ruby/object:Gem::Requirement
|
23
17
|
none: false
|
24
|
-
requirements:
|
25
|
-
- -
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
|
28
|
-
- 0
|
29
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
30
22
|
type: :development
|
31
23
|
prerelease: false
|
32
|
-
version_requirements: *
|
33
|
-
- !ruby/object:Gem::Dependency
|
24
|
+
version_requirements: *81377020
|
25
|
+
- !ruby/object:Gem::Dependency
|
34
26
|
name: submodule
|
35
|
-
requirement: &
|
27
|
+
requirement: &81376550 !ruby/object:Gem::Requirement
|
36
28
|
none: false
|
37
|
-
requirements:
|
38
|
-
- -
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
|
41
|
-
- 0
|
42
|
-
version: "0"
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.0.3
|
43
33
|
type: :development
|
44
34
|
prerelease: false
|
45
|
-
version_requirements: *
|
46
|
-
- !ruby/object:Gem::Dependency
|
35
|
+
version_requirements: *81376550
|
36
|
+
- !ruby/object:Gem::Dependency
|
47
37
|
name: rake
|
48
|
-
requirement: &
|
38
|
+
requirement: &81376250 !ruby/object:Gem::Requirement
|
49
39
|
none: false
|
50
|
-
requirements:
|
51
|
-
- -
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
|
54
|
-
- 0
|
55
|
-
version: "0"
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
56
44
|
type: :runtime
|
57
45
|
prerelease: false
|
58
|
-
version_requirements: *
|
59
|
-
- !ruby/object:Gem::Dependency
|
46
|
+
version_requirements: *81376250
|
47
|
+
- !ruby/object:Gem::Dependency
|
60
48
|
name: multi_json
|
61
|
-
requirement: &
|
49
|
+
requirement: &81375280 !ruby/object:Gem::Requirement
|
62
50
|
none: false
|
63
|
-
requirements:
|
64
|
-
- -
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
|
67
|
-
- 1
|
68
|
-
- 3
|
69
|
-
version: "1.3"
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
70
55
|
type: :runtime
|
71
56
|
prerelease: false
|
72
|
-
version_requirements: *
|
73
|
-
- !ruby/object:Gem::Dependency
|
57
|
+
version_requirements: *81375280
|
58
|
+
- !ruby/object:Gem::Dependency
|
74
59
|
name: execjs
|
75
|
-
requirement: &
|
60
|
+
requirement: &81374370 !ruby/object:Gem::Requirement
|
76
61
|
none: false
|
77
|
-
requirements:
|
78
|
-
- -
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
|
81
|
-
- 0
|
82
|
-
version: "0"
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
83
66
|
type: :runtime
|
84
67
|
prerelease: false
|
85
|
-
version_requirements: *
|
86
|
-
description: Ruby wrapper for JSHint. The main difference from jshint gem it does
|
87
|
-
|
68
|
+
version_requirements: *81374370
|
69
|
+
description: Ruby wrapper for JSHint. The main difference from jshint gem it does
|
70
|
+
not depend on Java. Instead, it uses ExecJS
|
71
|
+
email:
|
88
72
|
- stereobooster@gmail.com
|
89
73
|
executables: []
|
90
|
-
|
91
74
|
extensions: []
|
92
|
-
|
93
75
|
extra_rdoc_files: []
|
94
|
-
|
95
|
-
files:
|
76
|
+
files:
|
96
77
|
- .gitignore
|
97
78
|
- .gitmodules
|
98
79
|
- .travis.yml
|
@@ -107,39 +88,28 @@ files:
|
|
107
88
|
- lib/jshintrb/reporter/default.rb
|
108
89
|
- lib/jshintrb/version.rb
|
109
90
|
- spec/jshintrb_spec.rb
|
110
|
-
has_rdoc: true
|
111
91
|
homepage: https://github.com/stereobooster/jshintrb
|
112
92
|
licenses: []
|
113
|
-
|
114
93
|
post_install_message:
|
115
94
|
rdoc_options: []
|
116
|
-
|
117
|
-
require_paths:
|
95
|
+
require_paths:
|
118
96
|
- lib
|
119
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
120
98
|
none: false
|
121
|
-
requirements:
|
122
|
-
- -
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
|
125
|
-
|
126
|
-
- 0
|
127
|
-
version: "0"
|
128
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ! '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
104
|
none: false
|
130
|
-
requirements:
|
131
|
-
- -
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
|
134
|
-
segments:
|
135
|
-
- 0
|
136
|
-
version: "0"
|
105
|
+
requirements:
|
106
|
+
- - ! '>='
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
137
109
|
requirements: []
|
138
|
-
|
139
110
|
rubyforge_project:
|
140
|
-
rubygems_version: 1.
|
111
|
+
rubygems_version: 1.8.11
|
141
112
|
signing_key:
|
142
113
|
specification_version: 3
|
143
114
|
summary: Ruby wrapper for JSHint
|
144
115
|
test_files: []
|
145
|
-
|