scss_lint 0.51.0 → 0.52.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/lib/scss_lint/plugins/linter_dir.rb +24 -1
- data/lib/scss_lint/version.rb +1 -1
- data/spec/scss_lint/plugins/linter_dir_spec.rb +29 -5
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19af5419180f80bdaad53ecffaa33992432af5e0
|
4
|
+
data.tar.gz: ad403dc48c33f6658ff318dabcd8f4fb3b2f5ba0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c4f46183c914ad9f99cd41fc63583413e08465ccc76ea60387d12c11bfae897fe91e5cbdb354795d6bc65f813f59fea7aa4024385acbe372206ab0ed7a629ea
|
7
|
+
data.tar.gz: 45baee65c2f6a3d0268c3ff442e5ab93db4dcab3cafc3f73d29f0c756c9db6b76a21e6bd19d444ecba6e337e9741411eb6a5723b76ec3a689db743fb480ffb44
|
@@ -6,11 +6,11 @@ module SCSSLint
|
|
6
6
|
|
7
7
|
def initialize(dir)
|
8
8
|
@dir = dir
|
9
|
-
@config = SCSSLint::Config.new({}) # Will always be empty
|
10
9
|
end
|
11
10
|
|
12
11
|
def load
|
13
12
|
ruby_files.each { |file| require file }
|
13
|
+
@config = plugin_config
|
14
14
|
self
|
15
15
|
end
|
16
16
|
|
@@ -19,6 +19,29 @@ module SCSSLint
|
|
19
19
|
def ruby_files
|
20
20
|
Dir.glob(File.expand_path(File.join(@dir, '**', '*.rb')))
|
21
21
|
end
|
22
|
+
|
23
|
+
# Returns the {SCSSLint::Config} for this directory.
|
24
|
+
#
|
25
|
+
# This is intended to be merged with the configuration that loaded this
|
26
|
+
# plugin.
|
27
|
+
#
|
28
|
+
# @return [SCSSLint::Config]
|
29
|
+
def plugin_config
|
30
|
+
file = plugin_config_file
|
31
|
+
|
32
|
+
if File.exist?(file)
|
33
|
+
Config.load(file, merge_with_default: false)
|
34
|
+
else
|
35
|
+
Config.new({})
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Path of the configuration file to attempt to load for this directory.
|
40
|
+
#
|
41
|
+
# @return [String]
|
42
|
+
def plugin_config_file
|
43
|
+
File.join(@dir, Config::FILE_NAME)
|
44
|
+
end
|
22
45
|
end
|
23
46
|
end
|
24
47
|
end
|
data/lib/scss_lint/version.rb
CHANGED
@@ -4,18 +4,42 @@ describe SCSSLint::Plugins::LinterDir do
|
|
4
4
|
let(:plugin_directory) { File.expand_path('../../fixtures/plugins', __FILE__) }
|
5
5
|
let(:subject) { described_class.new(plugin_directory) }
|
6
6
|
|
7
|
-
describe '#
|
8
|
-
|
9
|
-
|
7
|
+
describe '#load' do
|
8
|
+
let(:config_file) { File.join(plugin_directory, '.scss-lint.yml') }
|
9
|
+
let(:config_file_exists) { false }
|
10
|
+
|
11
|
+
before do
|
12
|
+
File.stub(:exist?).with(config_file).and_return(config_file_exists)
|
10
13
|
end
|
11
|
-
end
|
12
14
|
|
13
|
-
describe '#load' do
|
14
15
|
it 'requires each file in the plugin directory' do
|
15
16
|
subject.should_receive(:require)
|
16
17
|
.with(File.join(plugin_directory, 'linter_plugin.rb')).once
|
17
18
|
|
18
19
|
subject.load
|
19
20
|
end
|
21
|
+
|
22
|
+
context 'when the dir does not include a configuration file' do
|
23
|
+
it 'loads an empty configuration' do
|
24
|
+
subject.load
|
25
|
+
subject.config.should == SCSSLint::Config.new({})
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'when a config file exists in the dir' do
|
30
|
+
let(:config_file_exists) { true }
|
31
|
+
let(:fake_config) { SCSSLint::Config.new('linters' => { 'FakeLinter' => {} }) }
|
32
|
+
|
33
|
+
before do
|
34
|
+
SCSSLint::Config.should_receive(:load)
|
35
|
+
.with(config_file, merge_with_default: false)
|
36
|
+
.and_return(fake_config)
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'loads the configuration' do
|
40
|
+
subject.load
|
41
|
+
subject.config.should == fake_config
|
42
|
+
end
|
43
|
+
end
|
20
44
|
end
|
21
45
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scss_lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.52.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brigade Engineering
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-01-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -272,7 +272,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
272
272
|
version: '0'
|
273
273
|
requirements: []
|
274
274
|
rubyforge_project:
|
275
|
-
rubygems_version: 2.5.
|
275
|
+
rubygems_version: 2.4.5.1
|
276
276
|
signing_key:
|
277
277
|
specification_version: 4
|
278
278
|
summary: SCSS lint tool
|
@@ -369,3 +369,4 @@ test_files:
|
|
369
369
|
- spec/spec_helper.rb
|
370
370
|
- spec/support/isolated_environment.rb
|
371
371
|
- spec/support/matchers/report_lint.rb
|
372
|
+
has_rdoc:
|