guard-jslint-on-rails 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/guard-jslint-on-rails.gemspec +1 -0
- data/lib/guard/jslint-on-rails.rb +22 -2
- metadata +19 -3
@@ -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.
|
7
|
+
VERSION = '0.0.4'
|
7
8
|
|
8
9
|
def run_on_change(paths)
|
9
|
-
|
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:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
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
|