roger_jshint 0.1.0 → 1.0.0
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +12 -0
- data/.ruby-version +0 -0
- data/.travis.yml +0 -1
- data/README.md +4 -2
- data/lib/roger_jshint/lint.rb +7 -6
- data/roger_jshint.gemspec +5 -5
- data/test/{jshintrc → data/jshintrc} +0 -0
- data/test/{test.js → data/test.js} +0 -0
- data/test/lint_test.rb +15 -5
- metadata +26 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 837f852c6ef0278395df76946e093ee4c52cea1f
|
4
|
+
data.tar.gz: 9c97f2e5133a029712a8c26fca0c21a96447d632
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb42fd286eb3eeef32bbe615d53483847b2a30afbf7766b3d97833a60fa3753731bda7cf2b122b10fe2e824d3593b880853fb267f2ef915f47bb49bf9eb7cf2b
|
7
|
+
data.tar.gz: 714fabeb549664e72c04c40516acf1c233275e7302236b7a8323fb4bd3949ba9c83d447d1059a7ddc3d6dde257576e55b1649453171a2e991bcc1170d01b2064
|
data/.rubocop.yml
CHANGED
data/.ruby-version
ADDED
File without changes
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
|
1
|
+
Roger JSHint
|
2
2
|
============
|
3
|
-
|
3
|
+
|
4
|
+
[](https://travis-ci.org/DigitPaint/roger_jshint)
|
5
|
+
|
4
6
|
|
5
7
|
Lint JavaScript files from within Roger. This plugin uses [jshint](https://github.com/jshint/jshint). If present, .jshintrc in your project will be used. If not, jshint will walk the directory tree upwards until a .jshintrc file is found. As a last resort, [jshint's default configuration](https://raw.githubusercontent.com/jshint/jshint/master/examples/.jshintrc) is used.
|
6
8
|
|
data/lib/roger_jshint/lint.rb
CHANGED
@@ -16,13 +16,11 @@ module RogerJsHint
|
|
16
16
|
:jshint => 'jshint'
|
17
17
|
}
|
18
18
|
@options.update(options) if options
|
19
|
-
|
20
|
-
@jshint_command = "#{@options[:jshint]} --reporter=" +
|
21
|
-
File.expand_path('jsonreporter.js', File.dirname(__FILE__)) + ' '
|
22
19
|
end
|
23
20
|
|
24
21
|
def detect_jshint
|
25
|
-
|
22
|
+
command = [@options[:jshint], "-v", "2>/dev/null"]
|
23
|
+
detect = system(Shellwords.join(command))
|
26
24
|
fail 'Could not find jshint. Install jshint using npm.' unless detect
|
27
25
|
end
|
28
26
|
|
@@ -44,13 +42,16 @@ module RogerJsHint
|
|
44
42
|
# @option options [Array[Regexp]] :skip Array of regular expressions to skip files
|
45
43
|
def call(test, options)
|
46
44
|
options = {}.update(@options).update(options)
|
45
|
+
command = [
|
46
|
+
@options[:jshint],
|
47
|
+
"--reporter=" + File.expand_path('jsonreporter.js', File.dirname(__FILE__))
|
48
|
+
]
|
47
49
|
|
48
50
|
detect_jshint
|
49
51
|
test.log(self, 'JS-linting files')
|
50
52
|
|
51
53
|
test.get_files(options[:match], options[:skip]).each do |file_path|
|
52
|
-
|
53
|
-
output = `#{execute}`
|
54
|
+
output = `#{Shellwords.join(command + [Shellwords.escape(file_path)])}`
|
54
55
|
lint = JSON.parse output
|
55
56
|
report(test, file_path, lint)
|
56
57
|
end
|
data/roger_jshint.gemspec
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
|
-
s.authors = ['Hans Krutzer']
|
5
|
-
s.email = ['info@digitpaint.nl', 'hans@digitpaint.nl']
|
4
|
+
s.authors = ['Hans Krutzer', 'Flurin Egger']
|
5
|
+
s.email = ['info@digitpaint.nl', 'hans@digitpaint.nl', 'flurin@digitpaint.nl']
|
6
6
|
s.name = 'roger_jshint'
|
7
|
-
s.version = '
|
8
|
-
s.homepage = 'https://github.com/
|
7
|
+
s.version = '1.0.0'
|
8
|
+
s.homepage = 'https://github.com/digitpaint/roger_jshint'
|
9
9
|
|
10
10
|
s.summary = 'Lint JavaScript files within Roger'
|
11
11
|
s.description = <<-EOF
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.files = `git ls-files`.split("\n")
|
20
20
|
s.require_paths = ['lib']
|
21
21
|
|
22
|
-
s.add_dependency 'roger', '~>
|
22
|
+
s.add_dependency 'roger', '~> 1.1', '>= 0.13.0'
|
23
23
|
|
24
24
|
s.add_development_dependency 'rubocop', ['>= 0']
|
25
25
|
s.add_development_dependency 'rake', ['>= 0']
|
File without changes
|
File without changes
|
data/test/lint_test.rb
CHANGED
@@ -14,12 +14,18 @@ class TesterStub
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def get_files(_, _)
|
17
|
-
['test/test.js']
|
17
|
+
['test/data/test.js']
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
# Linting plugin unit test
|
22
22
|
class LintTest < Test::Unit::TestCase
|
23
|
+
def setup
|
24
|
+
@file_name = ".jshintrc"
|
25
|
+
assert !File.exist?(@file_name), ".jshintrc file already exists."
|
26
|
+
FileUtils.cp("./test/data/jshintrc", "./.jshintrc")
|
27
|
+
end
|
28
|
+
|
23
29
|
def test_lint
|
24
30
|
faketester = TesterStub.new
|
25
31
|
|
@@ -30,9 +36,13 @@ class LintTest < Test::Unit::TestCase
|
|
30
36
|
messages.shift
|
31
37
|
|
32
38
|
assert_equal(messages,
|
33
|
-
["test/test.js:0 0: Bad option: 'subsub'.",
|
34
|
-
"test/test.js:1 1: 'x' is not defined.",
|
35
|
-
"test/test.js:2 1: 'alert' is not defined.",
|
36
|
-
"test/test.js:2 7: 'x' is not defined."])
|
39
|
+
["test/data/test.js:0 0: Bad option: 'subsub'.",
|
40
|
+
"test/data/test.js:1 1: 'x' is not defined.",
|
41
|
+
"test/data/test.js:2 1: 'alert' is not defined.",
|
42
|
+
"test/data/test.js:2 7: 'x' is not defined."])
|
43
|
+
end
|
44
|
+
|
45
|
+
def teardown
|
46
|
+
File.unlink @file_name
|
37
47
|
end
|
38
48
|
end
|
metadata
CHANGED
@@ -1,75 +1,76 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roger_jshint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hans Krutzer
|
8
|
+
- Flurin Egger
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2015-
|
12
|
+
date: 2015-05-26 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: roger
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
16
17
|
requirements:
|
17
|
-
- -
|
18
|
+
- - ~>
|
18
19
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
-
- -
|
20
|
+
version: '1.1'
|
21
|
+
- - '>='
|
21
22
|
- !ruby/object:Gem::Version
|
22
23
|
version: 0.13.0
|
23
24
|
type: :runtime
|
24
25
|
prerelease: false
|
25
26
|
version_requirements: !ruby/object:Gem::Requirement
|
26
27
|
requirements:
|
27
|
-
- -
|
28
|
+
- - ~>
|
28
29
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
30
|
-
- -
|
30
|
+
version: '1.1'
|
31
|
+
- - '>='
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: 0.13.0
|
33
34
|
- !ruby/object:Gem::Dependency
|
34
35
|
name: rubocop
|
35
36
|
requirement: !ruby/object:Gem::Requirement
|
36
37
|
requirements:
|
37
|
-
- -
|
38
|
+
- - '>='
|
38
39
|
- !ruby/object:Gem::Version
|
39
40
|
version: '0'
|
40
41
|
type: :development
|
41
42
|
prerelease: false
|
42
43
|
version_requirements: !ruby/object:Gem::Requirement
|
43
44
|
requirements:
|
44
|
-
- -
|
45
|
+
- - '>='
|
45
46
|
- !ruby/object:Gem::Version
|
46
47
|
version: '0'
|
47
48
|
- !ruby/object:Gem::Dependency
|
48
49
|
name: rake
|
49
50
|
requirement: !ruby/object:Gem::Requirement
|
50
51
|
requirements:
|
51
|
-
- -
|
52
|
+
- - '>='
|
52
53
|
- !ruby/object:Gem::Version
|
53
54
|
version: '0'
|
54
55
|
type: :development
|
55
56
|
prerelease: false
|
56
57
|
version_requirements: !ruby/object:Gem::Requirement
|
57
58
|
requirements:
|
58
|
-
- -
|
59
|
+
- - '>='
|
59
60
|
- !ruby/object:Gem::Version
|
60
61
|
version: '0'
|
61
62
|
- !ruby/object:Gem::Dependency
|
62
63
|
name: test-unit
|
63
64
|
requirement: !ruby/object:Gem::Requirement
|
64
65
|
requirements:
|
65
|
-
- -
|
66
|
+
- - '>='
|
66
67
|
- !ruby/object:Gem::Version
|
67
68
|
version: '0'
|
68
69
|
type: :development
|
69
70
|
prerelease: false
|
70
71
|
version_requirements: !ruby/object:Gem::Requirement
|
71
72
|
requirements:
|
72
|
-
- -
|
73
|
+
- - '>='
|
73
74
|
- !ruby/object:Gem::Version
|
74
75
|
version: '0'
|
75
76
|
description: |2
|
@@ -78,13 +79,15 @@ description: |2
|
|
78
79
|
email:
|
79
80
|
- info@digitpaint.nl
|
80
81
|
- hans@digitpaint.nl
|
82
|
+
- flurin@digitpaint.nl
|
81
83
|
executables: []
|
82
84
|
extensions: []
|
83
85
|
extra_rdoc_files: []
|
84
86
|
files:
|
85
|
-
-
|
86
|
-
-
|
87
|
-
-
|
87
|
+
- .gitignore
|
88
|
+
- .rubocop.yml
|
89
|
+
- .ruby-version
|
90
|
+
- .travis.yml
|
88
91
|
- Gemfile
|
89
92
|
- LICENSE
|
90
93
|
- README.md
|
@@ -93,10 +96,10 @@ files:
|
|
93
96
|
- lib/roger_jshint/jsonreporter.js
|
94
97
|
- lib/roger_jshint/lint.rb
|
95
98
|
- roger_jshint.gemspec
|
96
|
-
- test/jshintrc
|
99
|
+
- test/data/jshintrc
|
100
|
+
- test/data/test.js
|
97
101
|
- test/lint_test.rb
|
98
|
-
|
99
|
-
homepage: https://github.com/hkrutzer/roger_scsslinter
|
102
|
+
homepage: https://github.com/digitpaint/roger_jshint
|
100
103
|
licenses:
|
101
104
|
- MIT
|
102
105
|
metadata: {}
|
@@ -106,17 +109,17 @@ require_paths:
|
|
106
109
|
- lib
|
107
110
|
required_ruby_version: !ruby/object:Gem::Requirement
|
108
111
|
requirements:
|
109
|
-
- -
|
112
|
+
- - '>='
|
110
113
|
- !ruby/object:Gem::Version
|
111
114
|
version: '0'
|
112
115
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
116
|
requirements:
|
114
|
-
- -
|
117
|
+
- - '>='
|
115
118
|
- !ruby/object:Gem::Version
|
116
119
|
version: '0'
|
117
120
|
requirements: []
|
118
121
|
rubyforge_project:
|
119
|
-
rubygems_version: 2.
|
122
|
+
rubygems_version: 2.4.5
|
120
123
|
signing_key:
|
121
124
|
specification_version: 4
|
122
125
|
summary: Lint JavaScript files within Roger
|