guard-jslint-on-rails 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,4 +20,5 @@ Gem::Specification.new do |s|
20
20
  s.require_paths = ["lib"]
21
21
 
22
22
  s.add_dependency 'guard', '>= 0.4.0'
23
+ s.add_dependency 'jslint_on_rails', '>= 1.0.6'
23
24
  end
@@ -1,12 +1,32 @@
1
1
  require 'guard'
2
2
  require 'guard/guard'
3
+ require 'jslint'
3
4
 
4
5
  module Guard
5
6
  class JslintOnRails < Guard
6
- VERSION = '0.0.3'
7
+ VERSION = '0.0.4'
7
8
 
8
9
  def run_on_change(paths)
9
- system "rake jslint paths=#{paths.join(',')}"
10
+ capture_output do
11
+ lint = JSLint::Lint.new(
12
+ :paths => paths,
13
+ :config_path => File.join(Dir.pwd, 'config', 'jslint.yml')
14
+ )
15
+ lint.run #raises LintCheckFailure if failure
16
+ end
17
+ true
18
+ end
19
+
20
+ private
21
+ def capture_output
22
+ out = StringIO.new
23
+ $stdout = out
24
+ $stderr = out
25
+ yield
26
+ return out
27
+ ensure
28
+ $stderr = STDERR
29
+ $stdout = STDOUT
10
30
  end
11
31
  end
12
32
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-jslint-on-rails
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Sonnek
@@ -33,6 +33,22 @@ dependencies:
33
33
  version: 0.4.0
34
34
  type: :runtime
35
35
  version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: jslint_on_rails
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 27
45
+ segments:
46
+ - 1
47
+ - 0
48
+ - 6
49
+ version: 1.0.6
50
+ type: :runtime
51
+ version_requirements: *id002
36
52
  description: Guard Javascript changes to ensure JSLint complience
37
53
  email:
38
54
  - ryan@codecrate.com