jshintrb 0.1.1 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -6,7 +6,6 @@ rvm:
6
6
  before_script: "git submodule update --init --recursive"
7
7
  env:
8
8
  - EXECJS_RUNTIME=RubyRacer
9
- - EXECJS_RUNTIME=Mustang
10
9
  - EXECJS_RUNTIME=RubyRhino
11
10
  matrix:
12
11
  exclude:
@@ -18,5 +17,3 @@ matrix:
18
17
  env: EXECJS_RUNTIME=RubyRhino
19
18
  - rvm: jruby
20
19
  env: EXECJS_RUNTIME=RubyRacer
21
- - rvm: jruby
22
- env: EXECJS_RUNTIME=Mustang
data/jshintrb.gemspec CHANGED
@@ -1,27 +1,27 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "jshintrb/version"
4
-
5
- Gem::Specification.new do |s|
6
- s.name = "jshintrb"
7
- s.version = Jshintrb::VERSION
8
- s.authors = ["stereobooster"]
9
- s.email = ["stereobooster@gmail.com"]
10
- s.homepage = "https://github.com/stereobooster/jshintrb"
11
- s.summary = %q{Ruby wrapper for JSHint}
12
- s.description = %q{Ruby wrapper for JSHint. The main difference from jshint gem it does not depend on Java. Instead, it uses ExecJS}
13
-
14
- s.rubyforge_project = "jshintrb"
15
-
16
- s.files = `git ls-files`.split("\n")
17
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
- s.require_paths = ["lib"]
20
-
21
- # specify any dependencies here; for example:
22
- s.add_development_dependency "rspec"
23
- s.add_runtime_dependency "rake"
24
-
25
- s.add_dependency "multi_json"
26
- s.add_dependency "execjs"
27
- end
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "jshintrb/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "jshintrb"
7
+ s.version = Jshintrb::VERSION
8
+ s.authors = ["stereobooster"]
9
+ s.email = ["stereobooster@gmail.com"]
10
+ s.homepage = "https://github.com/stereobooster/jshintrb"
11
+ s.summary = %q{Ruby wrapper for JSHint}
12
+ s.description = %q{Ruby wrapper for JSHint. The main difference from jshint gem it does not depend on Java. Instead, it uses ExecJS}
13
+
14
+ s.rubyforge_project = "jshintrb"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ s.add_development_dependency "rspec"
23
+ s.add_runtime_dependency "rake"
24
+
25
+ s.add_dependency "multi_json", ">= 1.3"
26
+ s.add_dependency "execjs"
27
+ end
@@ -1,84 +1,84 @@
1
- # Define a task library for running JSHint contexts.
2
-
3
- require 'rake'
4
- require 'rake/tasklib'
5
-
6
- require 'jshintrb'
7
-
8
- module Jshintrb
9
-
10
- class JshintTask < ::Rake::TaskLib
11
- # Name of JSHint task. (default is :jshint)
12
- attr_accessor :name
13
-
14
- # Glob pattern to match JavaScript files. (default is './**/*.js')
15
- attr_accessor :pattern
16
-
17
- # options
18
- attr_accessor :options
19
-
20
- # Whether or not to fail Rake when an error occurs (typically when Jshint check fail).
21
- # Defaults to true.
22
- attr_accessor :fail_on_error
23
-
24
- # Explicitly define the list of JavaScript files to be linted.
25
- # +js_files+ is expected to be an array of file names (a
26
- # FileList is acceptable). If both +pattern+ and +js_files+ are
27
- # used, then the list of JavaScritp files is the union of the two.
28
- attr_accessor :js_files
29
-
30
- attr_accessor :exclude_pattern
31
-
32
- attr_accessor :exclude_js_files
33
-
34
- # Defines a new task, using the name +name+.
35
- def initialize(name=:jshint)
36
- @name = name
37
- @pattern = nil
38
- @js_files = nil
39
- @exclude_pattern = nil
40
- @exclude_js_files = nil
41
- @options = nil
42
- @fail_on_error = true
43
-
44
- yield self if block_given?
45
- @pattern = './**/*.js' if pattern.nil? && js_files.nil?
46
- define
47
- end
48
-
49
- def define # :nodoc:
50
-
51
- actual_name = Hash === name ? name.keys.first : name
52
- unless ::Rake.application.last_comment
53
- desc "Run JShint"
54
- end
55
- task name do
56
- unless js_file_list.empty?
57
- result = Jshintrb::report(js_file_list, @options, STDERR)
58
- if result.size > 0
59
- abort("JSHint check failed") if fail_on_error
60
- end
61
- end
62
- end
63
-
64
- self
65
- end
66
-
67
- def evaluate(o) # :nodoc:
68
- case o
69
- when Proc then o.call
70
- else o
71
- end
72
- end
73
-
74
- def js_file_list # :nodoc:
75
- result = []
76
- result += js_files.to_a if js_files
77
- result += FileList[ pattern ].to_a if pattern
78
- result -= exclude_js_files.to_a if js_files
79
- result -= FileList[ exclude_pattern ].to_a if exclude_pattern
80
- FileList[result]
81
- end
82
- end
83
-
84
- end
1
+ # Define a task library for running JSHint contexts.
2
+
3
+ require 'rake'
4
+ require 'rake/tasklib'
5
+
6
+ require 'jshintrb'
7
+
8
+ module Jshintrb
9
+
10
+ class JshintTask < ::Rake::TaskLib
11
+ # Name of JSHint task. (default is :jshint)
12
+ attr_accessor :name
13
+
14
+ # Glob pattern to match JavaScript files. (default is './**/*.js')
15
+ attr_accessor :pattern
16
+
17
+ # options
18
+ attr_accessor :options
19
+
20
+ # Whether or not to fail Rake when an error occurs (typically when Jshint check fail).
21
+ # Defaults to true.
22
+ attr_accessor :fail_on_error
23
+
24
+ # Explicitly define the list of JavaScript files to be linted.
25
+ # +js_files+ is expected to be an array of file names (a
26
+ # FileList is acceptable). If both +pattern+ and +js_files+ are
27
+ # used, then the list of JavaScritp files is the union of the two.
28
+ attr_accessor :js_files
29
+
30
+ attr_accessor :exclude_pattern
31
+
32
+ attr_accessor :exclude_js_files
33
+
34
+ # Defines a new task, using the name +name+.
35
+ def initialize(name=:jshint)
36
+ @name = name
37
+ @pattern = nil
38
+ @js_files = nil
39
+ @exclude_pattern = nil
40
+ @exclude_js_files = nil
41
+ @options = nil
42
+ @fail_on_error = true
43
+
44
+ yield self if block_given?
45
+ @pattern = './**/*.js' if pattern.nil? && js_files.nil?
46
+ define
47
+ end
48
+
49
+ def define # :nodoc:
50
+
51
+ actual_name = Hash === name ? name.keys.first : name
52
+ unless ::Rake.application.last_comment
53
+ desc "Run JShint"
54
+ end
55
+ task name do
56
+ unless js_file_list.empty?
57
+ result = Jshintrb::report(js_file_list, @options, STDERR)
58
+ if result.size > 0
59
+ abort("JSHint check failed") if fail_on_error
60
+ end
61
+ end
62
+ end
63
+
64
+ self
65
+ end
66
+
67
+ def evaluate(o) # :nodoc:
68
+ case o
69
+ when Proc then o.call
70
+ else o
71
+ end
72
+ end
73
+
74
+ def js_file_list # :nodoc:
75
+ result = []
76
+ result += js_files.to_a if js_files
77
+ result += FileList[ pattern ].to_a if pattern
78
+ result -= exclude_js_files.to_a if exclude_js_files
79
+ result -= FileList[ exclude_pattern ].to_a if exclude_pattern
80
+ FileList[result]
81
+ end
82
+ end
83
+
84
+ end
data/lib/jshintrb/lint.rb CHANGED
@@ -32,15 +32,15 @@ module Jshintrb
32
32
 
33
33
  def initialize(options = nil)
34
34
 
35
- if options == :defaults then
36
- @options = DEFAULTS.dup
37
- elsif options.instance_of? Hash then
35
+ if options == :defaults then
36
+ @options = DEFAULTS.dup
37
+ elsif options.instance_of? Hash then
38
38
  @options = options.dup
39
- # @options = DEFAULTS.merge(options)
39
+ # @options = DEFAULTS.merge(options)
40
40
  elsif options.nil?
41
41
  @options = nil
42
- else
43
- raise 'Unsupported option for Jshintrb: ' + options.to_s
42
+ else
43
+ raise 'Unsupported option for Jshintrb: ' + options.to_s
44
44
  end
45
45
 
46
46
  @context = ExecJS.compile(File.open(SourcePath, "r:UTF-8").read)
@@ -51,9 +51,9 @@ module Jshintrb
51
51
 
52
52
  js = []
53
53
  if @options.nil? then
54
- js << "JSHINT(#{MultiJson.encode(source)});"
54
+ js << "JSHINT(#{MultiJson.dump(source)});"
55
55
  else
56
- js << "JSHINT(#{MultiJson.encode(source)}, #{MultiJson.encode(@options)});"
56
+ js << "JSHINT(#{MultiJson.dump(source)}, #{MultiJson.dump(@options)});"
57
57
  end
58
58
  js << "return JSHINT.errors;"
59
59
 
@@ -61,4 +61,4 @@ module Jshintrb
61
61
  end
62
62
 
63
63
  end
64
- end
64
+ end
@@ -1,3 +1,3 @@
1
1
  module Jshintrb
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jshintrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-26 00:00:00.000000000Z
12
+ date: 2012-04-27 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &27109212 !ruby/object:Gem::Requirement
16
+ requirement: &29479944 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *27109212
24
+ version_requirements: *29479944
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &27108804 !ruby/object:Gem::Requirement
27
+ requirement: &29479500 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,21 +32,21 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *27108804
35
+ version_requirements: *29479500
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: multi_json
38
- requirement: &27108420 !ruby/object:Gem::Requirement
38
+ requirement: &29478960 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
42
42
  - !ruby/object:Gem::Version
43
- version: '0'
43
+ version: '1.3'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *27108420
46
+ version_requirements: *29478960
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: execjs
49
- requirement: &27108048 !ruby/object:Gem::Requirement
49
+ requirement: &29478636 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *27108048
57
+ version_requirements: *29478636
58
58
  description: Ruby wrapper for JSHint. The main difference from jshint gem it does
59
59
  not depend on Java. Instead, it uses ExecJS
60
60
  email:
@@ -89,12 +89,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
89
89
  - - ! '>='
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
+ segments:
93
+ - 0
94
+ hash: 266408271
92
95
  required_rubygems_version: !ruby/object:Gem::Requirement
93
96
  none: false
94
97
  requirements:
95
98
  - - ! '>='
96
99
  - !ruby/object:Gem::Version
97
100
  version: '0'
101
+ segments:
102
+ - 0
103
+ hash: 266408271
98
104
  requirements: []
99
105
  rubyforge_project: jshintrb
100
106
  rubygems_version: 1.8.15