pronto-scss 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2093f9c9bb99210f9f645db55a378743057cbd5e
4
+ data.tar.gz: d61aa9875fcf2a4f8aa9c6017e0f4133f6c4de9b
5
+ SHA512:
6
+ metadata.gz: 2d8b850b4970fb3adb37a7bf0761cda9e9b34d65b9e1757186a5672feb750d55b2cfa8c671c44d472e1b0ab74057d46d340dea46bc3bd190053e3064379614eb
7
+ data.tar.gz: 27bc07054b5cc5f2c11efba712a21bdf1941ce86e381f82e8d6f49afceb8ec46857256adeb2bd9e04f4e5da0d4095a930200abeb41617b1bfcfd3b3683819b46
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2014 Mindaugas Mozūras
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,12 @@
1
+ # Pronto runner for SCSS-Lint
2
+
3
+ [![Code Climate](https://codeclimate.com/github/mmozuras/pronto-scss.png)](https://codeclimate.com/github/mmozuras/pronto-scss)
4
+ [![Build Status](https://travis-ci.org/mmozuras/pronto-scss.png)](https://travis-ci.org/mmozuras/pronto-scss)
5
+ [![Gem Version](https://badge.fury.io/rb/pronto-scss.png)](http://badge.fury.io/rb/pronto-scss)
6
+ [![Dependency Status](https://gemnasium.com/mmozuras/pronto-scss.png)](https://gemnasium.com/mmozuras/pronto-scss)
7
+
8
+ Pronto runner for [SCSS-Lint](https://github.com/causes/scss-lint), tool to help keep your SCSS clean and readable. [What is Pronto?](https://github.com/mmozuras/pronto)
9
+
10
+ ## Configuration
11
+
12
+ Configuring SCSS-Lint via .scss-lint.yml will work just fine with pronto-scss.
@@ -0,0 +1,5 @@
1
+ module Pronto
2
+ module ScssVersion
3
+ VERSION = '0.3.0'
4
+ end
5
+ end
@@ -0,0 +1,52 @@
1
+ require 'pronto'
2
+ require 'scss_lint'
3
+
4
+ module Pronto
5
+ class Scss < Runner
6
+ def initialize
7
+ @runner = SCSSLint::Runner.new(SCSSLint::Config.default)
8
+ end
9
+
10
+ def run(patches, _)
11
+ return [] unless patches
12
+
13
+ scss_patches = patches.select { |patch| patch.additions > 0 }
14
+ .select { |patch| scss_file?(patch.new_file_full_path) }
15
+
16
+ files = scss_patches.map { |patch| patch.new_file_full_path }
17
+
18
+ if files.any?
19
+ @runner.run(files)
20
+ messages_for(scss_patches)
21
+ else
22
+ []
23
+ end
24
+ end
25
+
26
+ def messages_for(scss_patches)
27
+ @runner.lints.map do |lint|
28
+ patch = patch_for_lint(scss_patches, lint)
29
+
30
+ line = patch.added_lines.find do |added_line|
31
+ added_line.new_lineno == lint.location.line
32
+ end
33
+
34
+ new_message(line, lint) if line
35
+ end.flatten.compact
36
+ end
37
+
38
+ def patch_for_lint(scss_patches, lint)
39
+ scss_patches.find do |patch|
40
+ patch.new_file_full_path.to_s == lint.filename.to_s
41
+ end
42
+ end
43
+
44
+ def new_message(line, lint)
45
+ Message.new(line.patch.delta.new_file[:path], line, lint.severity, lint.description)
46
+ end
47
+
48
+ def scss_file?(path)
49
+ %w(.css .scss).include?(File.extname(path))
50
+ end
51
+ end
52
+ end
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pronto-scss
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ platform: ruby
6
+ authors:
7
+ - Mindaugas Mozūras
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: scss-lint
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.29.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.29.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: pronto
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.3'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec-its
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.0'
83
+ description:
84
+ email: mindaugas.mozuras@gmail.com
85
+ executables: []
86
+ extensions: []
87
+ extra_rdoc_files: []
88
+ files:
89
+ - LICENSE
90
+ - README.md
91
+ - lib/pronto/scss.rb
92
+ - lib/pronto/scss/version.rb
93
+ homepage: http://github.org/mmozuras/pronto-scss
94
+ licenses:
95
+ - MIT
96
+ metadata: {}
97
+ post_install_message:
98
+ rdoc_options: []
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: 1.3.6
111
+ requirements: []
112
+ rubyforge_project:
113
+ rubygems_version: 2.2.2
114
+ signing_key:
115
+ specification_version: 4
116
+ summary: Pronto runner for SCSS-Lint, tool to help keep your SCSS clean and readable
117
+ test_files: []