csslint_ruby 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/csslint_ruby.gemspec +0 -1
- data/lib/csslint_ruby.rb +17 -1
- data/lib/csslint_ruby/version.rb +1 -1
- data/spec/fixtures/custom_ignore_tag.css +5 -0
- data/spec/fixtures/ignored_errors.css +5 -0
- data/spec/lib/csslint_ruby_spec.rb +22 -0
- data/spec/spec_helper.rb +0 -1
- metadata +7 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff8b2d1638f7c00a5002bea4bf28fa9aed81c4b8
|
4
|
+
data.tar.gz: 9bab9f2ab53e05425125d6b94f684c2a7c873594
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e84031306481c5fdec63641ce31f66771d78e6b11cea518ef45d9621787a586850f46d576b4344784a976f49d541fbfeed91d989458fed4e9dda721c1e79a63
|
7
|
+
data.tar.gz: f4a7ee618be76a06166bc64210ae0c6ff2db09a75cf4d46fecab3a09f253726ef0cd9ad15dc95a7f77c66825b8a9bd37945c1d8fef594700c5241d144d8c6f97
|
data/README.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/csslint_ruby.svg)](http://badge.fury.io/rb/csslint_ruby)
|
2
|
+
[![Dependency Status](https://gemnasium.com/StupidCodeFactory/csslint_ruby.png)](https://gemnasium.com/StupidCodeFactory/csslint_ruby)
|
3
|
+
|
1
4
|
# CsslintRuby
|
2
5
|
|
3
6
|
API to lint your css source code from ruby.
|
data/csslint_ruby.gemspec
CHANGED
@@ -19,7 +19,6 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
21
|
spec.add_dependency 'execjs'
|
22
|
-
spec.add_development_dependency 'byebug'
|
23
22
|
spec.add_development_dependency 'rspec'
|
24
23
|
spec.add_development_dependency 'bundler', '~> 1.5'
|
25
24
|
spec.add_development_dependency 'rake'
|
data/lib/csslint_ruby.rb
CHANGED
@@ -48,7 +48,8 @@ EOJS
|
|
48
48
|
|
49
49
|
def self.run(source, options = {})
|
50
50
|
source = source.respond_to?(:read) ? source.read : source
|
51
|
-
|
51
|
+
processor = SourceProcessor.new(source, options.fetch(:ignore_tag, false))
|
52
|
+
Result.new(*context.call('CSSLINTER', processor.data_without_ignores, options))
|
52
53
|
end
|
53
54
|
|
54
55
|
class Result
|
@@ -65,4 +66,19 @@ EOJS
|
|
65
66
|
errors.empty?
|
66
67
|
end
|
67
68
|
end
|
69
|
+
|
70
|
+
class SourceProcessor
|
71
|
+
DEFAULT_IGNORE_TAG = 'lintingIgnore'
|
72
|
+
|
73
|
+
attr_reader :ignore_tag, :data
|
74
|
+
|
75
|
+
def initialize(data, ignore_tag)
|
76
|
+
@data = data
|
77
|
+
@ignore_tag = ignore_tag || DEFAULT_IGNORE_TAG
|
78
|
+
end
|
79
|
+
|
80
|
+
def data_without_ignores
|
81
|
+
data.gsub(/\/\* @#{ignore_tag}Begin \*\/.+?\/\* @#{ignore_tag}End \*\//m, '')
|
82
|
+
end
|
83
|
+
end
|
68
84
|
end
|
data/lib/csslint_ruby/version.rb
CHANGED
@@ -50,4 +50,26 @@ describe CsslintRuby do
|
|
50
50
|
})
|
51
51
|
end
|
52
52
|
end
|
53
|
+
|
54
|
+
describe "When source has ignore comments" do
|
55
|
+
let(:options) { {errors: ['known-properties']} }
|
56
|
+
let(:source) { File.open('spec/fixtures/ignored_errors.css') }
|
57
|
+
|
58
|
+
subject(:result) { CsslintRuby.run(source, options) }
|
59
|
+
|
60
|
+
it 'ignores the errors between the comments' do
|
61
|
+
expect(result).to be_valid
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe 'When changes ignore tag value' do
|
66
|
+
let(:options) { {errors: ['known-properties'], ignore_tag: 'ignoreTest'} }
|
67
|
+
let(:source) { File.open('spec/fixtures/custom_ignore_tag.css') }
|
68
|
+
|
69
|
+
subject(:result) { CsslintRuby.run(source, options) }
|
70
|
+
|
71
|
+
it 'ignores the errors between the comments' do
|
72
|
+
expect(result).to be_valid
|
73
|
+
end
|
74
|
+
end
|
53
75
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csslint_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- StupidCodefactory
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: execjs
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: byebug
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: rspec
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -97,8 +83,10 @@ files:
|
|
97
83
|
- lib/csslint_ruby.rb
|
98
84
|
- lib/csslint_ruby/source.rb
|
99
85
|
- lib/csslint_ruby/version.rb
|
86
|
+
- spec/fixtures/custom_ignore_tag.css
|
100
87
|
- spec/fixtures/errors.css
|
101
88
|
- spec/fixtures/errors_with_options.css
|
89
|
+
- spec/fixtures/ignored_errors.css
|
102
90
|
- spec/fixtures/source.css
|
103
91
|
- spec/lib/csslint_ruby_spec.rb
|
104
92
|
- spec/spec_helper.rb
|
@@ -123,13 +111,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
111
|
version: '0'
|
124
112
|
requirements: []
|
125
113
|
rubyforge_project:
|
126
|
-
rubygems_version: 2.2.
|
114
|
+
rubygems_version: 2.2.2
|
127
115
|
signing_key:
|
128
116
|
specification_version: 4
|
129
117
|
summary: Provide an interface to lint css with CSSLint from ruby
|
130
118
|
test_files:
|
119
|
+
- spec/fixtures/custom_ignore_tag.css
|
131
120
|
- spec/fixtures/errors.css
|
132
121
|
- spec/fixtures/errors_with_options.css
|
122
|
+
- spec/fixtures/ignored_errors.css
|
133
123
|
- spec/fixtures/source.css
|
134
124
|
- spec/lib/csslint_ruby_spec.rb
|
135
125
|
- spec/spec_helper.rb
|