jshint 1.0.1 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0264a9f933ca44265fe32cd75a3bff312a95ad53
4
- data.tar.gz: 557e4174675e8b63a3454e0b56393fb6075c136c
3
+ metadata.gz: eb33d17c8ae2ee25b5a20763ffe9d10380d89de4
4
+ data.tar.gz: caa6f24f81d5e86a88de551a131196de1547b762
5
5
  SHA512:
6
- metadata.gz: e165c47b12d80d25fc0d3d1c7a64c82ae4669e3afa1aec3248986ba582d250adb246e705f79b48d7c32074a6d625f2ac5766d5e8ffc1446d76634306001bfed7
7
- data.tar.gz: a838f1c2f4583f05a17f7825b0856479413b4299d66c05662d2d1507c671b046855da52c8e59a3e4c92d0065a5412499ba22fa679e8cb8707a96b38ea1c5ae57
6
+ metadata.gz: cf8025f93a454251e03d141f8487b842065addd1310ecf9eb95aec1c7b3ba29b69ffec00a7c4960a74dbb78ae98fbb151430aa77ae50e9f081dbdc6d095bbed2
7
+ data.tar.gz: 65e3068d5789c6c3aa432738785ec45c02aae33de54aed96c08e16825ae1d4da99ce5f075f2b992e809ddbe8fc2e70a9f64ca7e1065a79aa7572ac95f9424407
@@ -1,4 +1,5 @@
1
1
  files: ["**/*.js"] # No need to put app/assets/ or vendor/assets here
2
+ exclude_paths: []
2
3
  options:
3
4
  boss: true
4
5
  browser: true
@@ -64,6 +64,22 @@ module Jshint
64
64
  options["files"]
65
65
  end
66
66
 
67
+ def excluded_search_paths
68
+ options.fetch("exclude_paths", [])
69
+ end
70
+
71
+ def search_paths
72
+ default_search_paths - excluded_search_paths
73
+ end
74
+
75
+ def default_search_paths
76
+ [
77
+ 'app/assets/javascripts',
78
+ 'vendor/assets/javascripts',
79
+ 'lib/assets/javascripts'
80
+ ]
81
+ end
82
+
67
83
  private
68
84
 
69
85
  def read_config_file
@@ -12,13 +12,6 @@ module Jshint
12
12
  # @return [Jshint::Configuration] The configuration object
13
13
  attr_reader :config
14
14
 
15
- # @return [Array] The standard location for JavaScript assets in a Rails project
16
- RAILS_JS_ASSET_PATHS = [
17
- 'app/assets/javascripts',
18
- 'vendor/assets/javascripts',
19
- 'lib/assets/javascripts'
20
- ]
21
-
22
15
  # Sets up our Linting behaviour
23
16
  #
24
17
  # @param config_path [String] The absolute path to a configuration YAML file
@@ -61,14 +54,15 @@ module Jshint
61
54
  get_json(content)
62
55
  end
63
56
 
64
- def search_paths
65
- paths = RAILS_JS_ASSET_PATHS.dup
57
+ def file_paths
58
+ paths = []
59
+
66
60
  if files.is_a? Array
67
61
  files.each do |file|
68
- paths = paths.map { |path| File.join(path, file) }
62
+ config.search_paths.each { |path| paths << File.join(path, file) }
69
63
  end
70
64
  else
71
- paths = paths.map { |path| File.join(path, files) }
65
+ config.search_paths.each { |path| paths << File.join(path, files) }
72
66
  end
73
67
 
74
68
  paths
@@ -100,7 +94,7 @@ module Jshint
100
94
 
101
95
  def javascript_files
102
96
  js_asset_files = []
103
- search_paths.each do |path|
97
+ file_paths.each do |path|
104
98
  Dir.glob(path) do |file|
105
99
  js_asset_files << file
106
100
  end
@@ -1,4 +1,4 @@
1
1
  module Jshint
2
2
  # Our gem version
3
- VERSION = "1.0.1"
3
+ VERSION = "1.1.1"
4
4
  end
@@ -1,4 +1,5 @@
1
1
  files: ["**/*.js"] # No need to put app/assets/ or vendor/assets here
2
+ exclude_paths: []
2
3
  options:
3
4
  boss: true
4
5
  browser: true
@@ -30,5 +30,24 @@ describe Jshint::Configuration do
30
30
  config = described_class.new
31
31
  config.files.should == ["**/*.js"]
32
32
  end
33
+
34
+ context "search paths" do
35
+ subject { described_class.new }
36
+
37
+ it "should default the exclusion paths to an empty array" do
38
+ subject.excluded_search_paths.should == []
39
+ end
40
+
41
+ it "should set the exclusion paths to those in the config" do
42
+ subject.options["exclude_paths"] << 'vendor/assets/javascripts'
43
+ subject.excluded_search_paths.should == ["vendor/assets/javascripts"]
44
+ end
45
+
46
+ it "should be the default search paths minus the exclude paths" do
47
+ subject.search_paths.should == subject.default_search_paths
48
+ subject.options["exclude_paths"] << 'vendor/assets/javascripts'
49
+ subject.search_paths.should == ['app/assets/javascripts', 'lib/assets/javascripts']
50
+ end
51
+ end
33
52
  end
34
53
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jshint
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damian Nicholson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-16 00:00:00.000000000 Z
11
+ date: 2014-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: therubyracer