roger_scsslint 0.0.1

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: 5cee8e1c2464f52afaa7d5e43c8c293cd71dd6ea
4
+ data.tar.gz: c1084d4294217808a9e914f6c692321672bd2e39
5
+ SHA512:
6
+ metadata.gz: 25ab1662ca14f459a7533e00124078cb4b5ebdcbbe07ef5da0a399c00f729df17c74379427bec15bb96690196772233e839a1cca6fbbde321e8b7672c136a3a2
7
+ data.tar.gz: 56c08663a21f4232ecb251b35f3683683a4fccb01b27e35495c83088a4972f177fc889d2bdc89441129210373d2fdf645bf2f1165084254ccfa2e5471e1a5ab8
data/.gitignore ADDED
@@ -0,0 +1,34 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+
12
+ ## Specific to RubyMotion:
13
+ .dat*
14
+ .repl_history
15
+ build/
16
+
17
+ ## Documentation cache and generated files:
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /doc/
21
+ /rdoc/
22
+
23
+ ## Environment normalisation:
24
+ /.bundle/
25
+ /lib/bundler/man/
26
+
27
+ # for a library or gem, you might want to ignore these files since the code is
28
+ # intended to run in multiple environments; otherwise, check them in:
29
+ # Gemfile.lock
30
+ # .ruby-version
31
+ # .ruby-gemset
32
+
33
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
34
+ .rvmrc
data/.rubocop.yml ADDED
@@ -0,0 +1,6 @@
1
+ LineLength:
2
+ Max: 100
3
+
4
+ Style/HashSyntax:
5
+ Enabled:
6
+ False
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ cache: bundler
3
+ rvm:
4
+ - 2.1.5
5
+ - 2.2.0
6
+ before_script:
7
+ - cp ./test/travis-scss-lint.yml .scss-lint.yml
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 hkrutzer
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 all
13
+ 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 THE
21
+ SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,22 @@
1
+ Roger ScssLint
2
+ ============
3
+ Improve the quality of your scss with roger_scsslinter. This plugin for roger lints scss using [scss-lint](https://github.com/causes/scss-lint). If present, ```.scss-lint.yml``` in your project root will be used. You can generate this with ``` $ roger generate scsslint```, this will use the configuration from [our (s)css styleguide](https://github.com/DigitPaint/css). When this file is not present, [scss-lint](https://github.com/causes/scss-lint) will walk the directory tree upwards in search for a ```.scss-lint.yml``` file. As a last resort, [default.yml](https://github.com/causes/scss-lint/blob/master/config/default.yml) is used.
4
+
5
+ ## Installation
6
+ * Add ```gem "roger_scsslint"``` to your Gemfile
7
+
8
+ * Add this to your Mockupfile:
9
+ ```
10
+ mockup.test do |t|
11
+ t.use :scsslint
12
+ end
13
+ ```
14
+
15
+ * (Recommended) put a .scss-linter.yml in your project's root directory. You can use ```$ roger generate scsslint```, to use [ours](https://github.com/DigitPaint/css).
16
+
17
+ ## Running
18
+ Execute ```roger test scsslint```.
19
+
20
+ ## License
21
+
22
+ This project is released under the [MIT license](LICENSE).
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ require 'rake/testtask'
2
+ require 'rubocop/rake_task'
3
+
4
+ task :default => [:test, :rubocop]
5
+
6
+ desc 'Run rubocop'
7
+ task :rubocop do
8
+ RuboCop::RakeTask.new
9
+ end
10
+
11
+ Rake::TestTask.new do |t|
12
+ t.libs << 'test'
13
+ t.test_files = FileList['test/**/*_test.rb']
14
+ t.verbose = true
15
+ end
@@ -0,0 +1,5 @@
1
+ # Roger Scss linting plugin
2
+ module RogerScssLint; end
3
+
4
+ require File.dirname(__FILE__) + '/roger_scsslint/lint'
5
+ require File.dirname(__FILE__) + '/roger_scsslint/generator'
@@ -0,0 +1,44 @@
1
+ require 'open-uri'
2
+
3
+ # <- hekje
4
+ module Roger
5
+ # <- hekje
6
+ module Cli; end
7
+ end
8
+
9
+ require 'roger/cli/generate'
10
+ require 'roger/cli/command'
11
+ require 'roger/generators'
12
+
13
+ module RogerScsslint
14
+ # Lint configuration retriever
15
+ class ScsslintGenerator < Roger::Generators::Base
16
+ include Thor::Actions
17
+ CONFIG_PATH = '.scss-lint.yml'
18
+ DEFAULT_CONFIG_URL = 'https://raw.githubusercontent.com/edwinvd' \
19
+ 'graaf/css/f6cac66cba489ea106a8048d6d86f1830d3090c8/.scss-lint.yml'
20
+
21
+ desc 'Scsslint generator creates an .scss-lint.yml config file'
22
+ class_option(
23
+ :config,
24
+ type: :string,
25
+ aliases: ['-c'],
26
+ desc: "Optional config file to use takes a path or url, by
27
+ default it uses the company' default"
28
+ )
29
+
30
+ # Write config file
31
+ def write_config_file
32
+ if options[:config]
33
+ config = open(options[:config]).read
34
+ else
35
+ config = open(DEFAULT_CONFIG_URL).read
36
+ end
37
+
38
+ # Create file check if we don't have a conflict or something
39
+ create_file "#{@project.path}/#{CONFIG_PATH}", config
40
+ end
41
+ end
42
+ end
43
+
44
+ Roger::Generators.register RogerScsslint::ScsslintGenerator
@@ -0,0 +1,51 @@
1
+ require 'roger/test'
2
+ require 'scss_lint'
3
+ require 'scss_lint/cli'
4
+ require 'scss_lint/runner'
5
+
6
+ module RogerScsslint
7
+ # SCSS linter plugin for Roger
8
+ class Lint
9
+ # Configurability is the root of all evil
10
+ # http://fishshell.com/docs/current/design.html#conf
11
+ def initialize(_options = {})
12
+ end
13
+
14
+ # access scss-lint methods to do printing ourselves
15
+ def modify_scsslint_cli
16
+ def @cli.setup_configuration_public(*args)
17
+ setup_configuration(*args)
18
+ end
19
+ def @cli.scan_for_lints_public(*args)
20
+ scan_for_lints(*args)
21
+ end
22
+ def @cli.files_to_lint_public(*args)
23
+ files_to_lint(*args)
24
+ end
25
+ end
26
+
27
+ def lint_report(test, runner)
28
+ runner.lints.sort_by { |l| [l.filename, l.location] }.map do |lint|
29
+ test.log(self, (lint.error? ? '[E]' : '[W]') +
30
+ " #{lint.filename}:#{lint.location.line} #{lint.linter.name}: #{lint.description}")
31
+ end
32
+ end
33
+
34
+ def call(test, _options)
35
+ test.log(self, 'SCSS linting files')
36
+
37
+ @cli = SCSSLint::CLI.new
38
+ modify_scsslint_cli
39
+ linteroptions = SCSSLint::Options.new.parse([])
40
+ linterconfig = @cli.setup_configuration_public(linteroptions)
41
+
42
+ @cli.files_to_lint_public(linteroptions, linterconfig).each do |file|
43
+ runner = SCSSLint::Runner.new(linterconfig)
44
+ runner.run [file]
45
+ lint_report(test, runner)
46
+ end
47
+ end
48
+ end
49
+ end
50
+
51
+ Roger::Test.register :scsslint, RogerScsslint::Lint
@@ -0,0 +1,28 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.authors = ['Hans Krutzer']
5
+ s.email = ['info@digitpaint.nl', 'hans@digitpaint.nl']
6
+ s.name = 'roger_scsslint'
7
+ s.version = '0.0.1'
8
+ s.homepage = 'https://github.com/hkrutzer/roger_scsslint'
9
+
10
+ s.summary = 'Lint SCSS files within Roger'
11
+ s.description = <<-EOF
12
+ Lint SCSS files within Roger, using scss-lint.
13
+ Will use .scss-lint.yml.
14
+ EOF
15
+ s.licenses = ['MIT']
16
+
17
+ s.date = Time.now.strftime('%Y-%m-%d')
18
+
19
+ s.files = `git ls-files`.split("\n")
20
+ s.require_paths = ['lib']
21
+
22
+ s.add_dependency 'roger', '~> 0.13', '>= 0.13.0'
23
+ s.add_dependency 'scss-lint', '~> 0.31', '>= 0.31.0'
24
+
25
+ s.add_development_dependency 'rubocop', ['~> 0']
26
+ s.add_development_dependency 'rake', ['~> 0']
27
+ s.add_development_dependency 'test-unit', ['~> 0']
28
+ end
data/test/lint_test.rb ADDED
@@ -0,0 +1,32 @@
1
+ require_relative '../lib/roger_scsslint/lint.rb'
2
+ require 'test/unit'
3
+
4
+ # Fake tester to pass into the linter plugin
5
+ class TesterStub
6
+ attr_reader :messages
7
+
8
+ def initialize
9
+ @messages = []
10
+ end
11
+
12
+ def log(_, message)
13
+ @messages.push(message)
14
+ end
15
+ end
16
+
17
+ # Linting plugin unit test
18
+ class LintTest < Test::Unit::TestCase
19
+ def test_lint
20
+ faketester = TesterStub.new
21
+
22
+ linter = RogerScsslint::Lint.new
23
+ linter.call(faketester, {})
24
+
25
+ assert_equal(faketester.messages,
26
+ ['SCSS linting files',
27
+ '[W] test/test.scss:1 SingleLinePerSelector: Each selector '\
28
+ 'in a comma sequence should be on its own line',
29
+ '[W] test/test.scss:2 ZeroUnit: `0px` should be written without units as `0`',
30
+ '[W] test/test.scss:3 FinalNewline: Files should end with a trailing newline'])
31
+ end
32
+ end
data/test/test.scss ADDED
@@ -0,0 +1,3 @@
1
+ .class1, .class2 {
2
+ padding-left: 0px;
3
+ }
@@ -0,0 +1,2 @@
1
+ scss_files: 'test/**/*.css.scss'
2
+ exclude: 'vendor/**'
metadata ADDED
@@ -0,0 +1,143 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: roger_scsslint
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Hans Krutzer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: roger
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.13'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.13.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '0.13'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.13.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: scss-lint
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '0.31'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 0.31.0
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '0.31'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 0.31.0
53
+ - !ruby/object:Gem::Dependency
54
+ name: rubocop
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ type: :development
61
+ prerelease: false
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ - !ruby/object:Gem::Dependency
68
+ name: rake
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - "~>"
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ type: :development
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - "~>"
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ - !ruby/object:Gem::Dependency
82
+ name: test-unit
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - "~>"
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "~>"
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ description: |2
96
+ Lint SCSS files within Roger, using scss-lint.
97
+ Will use .scss-lint.yml.
98
+ email:
99
+ - info@digitpaint.nl
100
+ - hans@digitpaint.nl
101
+ executables: []
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - ".gitignore"
106
+ - ".rubocop.yml"
107
+ - ".travis.yml"
108
+ - Gemfile
109
+ - LICENSE
110
+ - README.md
111
+ - Rakefile
112
+ - lib/roger_scsslint.rb
113
+ - lib/roger_scsslint/generator.rb
114
+ - lib/roger_scsslint/lint.rb
115
+ - roger_scsslint.gemspec
116
+ - test/lint_test.rb
117
+ - test/test.scss
118
+ - test/travis-scss-lint.yml
119
+ homepage: https://github.com/hkrutzer/roger_scsslint
120
+ licenses:
121
+ - MIT
122
+ metadata: {}
123
+ post_install_message:
124
+ rdoc_options: []
125
+ require_paths:
126
+ - lib
127
+ required_ruby_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ required_rubygems_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ requirements: []
138
+ rubyforge_project:
139
+ rubygems_version: 2.2.2
140
+ signing_key:
141
+ specification_version: 4
142
+ summary: Lint SCSS files within Roger
143
+ test_files: []