roger_scsslint 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 5cee8e1c2464f52afaa7d5e43c8c293cd71dd6ea
4
- data.tar.gz: c1084d4294217808a9e914f6c692321672bd2e39
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MzVhMDZlZTEwMTM5NmM3YzVkZGI0MTNlMjg0MmFiODI2MzQyOTRkNw==
5
+ data.tar.gz: !binary |-
6
+ MmMwYTFlZmE1ZjBlY2I2MGNkNGM4ZmQ2NDdkYWExNjc5ZjI5YWYzNA==
5
7
  SHA512:
6
- metadata.gz: 25ab1662ca14f459a7533e00124078cb4b5ebdcbbe07ef5da0a399c00f729df17c74379427bec15bb96690196772233e839a1cca6fbbde321e8b7672c136a3a2
7
- data.tar.gz: 56c08663a21f4232ecb251b35f3683683a4fccb01b27e35495c83088a4972f177fc889d2bdc89441129210373d2fdf645bf2f1165084254ccfa2e5471e1a5ab8
8
+ metadata.gz: !binary |-
9
+ NzY5N2NmNzUyMjkyYjkzMTBkNTdhNDdmMTU1YzA1YWZlYWQwZWQwMTIyODlj
10
+ NDM4OWRmZWExMjNiOTQxMDIyYThlYjE1YTNhNjg0ODFmZGJhMmY3MzdkYjAz
11
+ ZjI4OTYyODA1YTA4YzdlMTA3YzFlMzYzMDJjMTQyODAwODdiOGM=
12
+ data.tar.gz: !binary |-
13
+ YWI2OTI3NzVkMTViNzE2MGEzMGU4Yjg0OTQxMWE2MzNkN2FmNGI4YmVmZWMw
14
+ OGU3YTQyZThlZDA1ODgzMTVmZGI2YTUxNGUzNzk1YWQ4ZWYwOGVkNTcxYzU0
15
+ YWQzMWJiZGNhM2E5ODVmODI4OGMxNWM5NmM1YmQxNTZjOTIwYjQ=
data/.gitignore CHANGED
@@ -27,7 +27,7 @@ build/
27
27
  # for a library or gem, you might want to ignore these files since the code is
28
28
  # intended to run in multiple environments; otherwise, check them in:
29
29
  # Gemfile.lock
30
- # .ruby-version
30
+ .ruby-version
31
31
  # .ruby-gemset
32
32
 
33
33
  # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
data/.travis.yml CHANGED
@@ -3,5 +3,3 @@ cache: bundler
3
3
  rvm:
4
4
  - 2.1.5
5
5
  - 2.2.0
6
- before_script:
7
- - cp ./test/travis-scss-lint.yml .scss-lint.yml
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  Roger ScssLint
2
2
  ============
3
+ [![Build Status](https://travis-ci.org/DigitPaint/roger_scsslint.svg)](https://travis-ci.org/DigitPaint/roger_scsslint)
4
+
5
+
3
6
  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
7
 
5
8
  ## Installation
@@ -19,4 +22,4 @@ Execute ```roger test scsslint```.
19
22
 
20
23
  ## License
21
24
 
22
- This project is released under the [MIT license](LICENSE).
25
+ This project is released under the [MIT license](LICENSE).
@@ -12,11 +12,10 @@ require 'roger/generators'
12
12
 
13
13
  module RogerScsslint
14
14
  # Lint configuration retriever
15
- class ScsslintGenerator < Roger::Generators::Base
15
+ class Generator < Roger::Generators::Base
16
16
  include Thor::Actions
17
17
  CONFIG_PATH = '.scss-lint.yml'
18
- DEFAULT_CONFIG_URL = 'https://raw.githubusercontent.com/edwinvd' \
19
- 'graaf/css/f6cac66cba489ea106a8048d6d86f1830d3090c8/.scss-lint.yml'
18
+ DEFAULT_CONFIG_URL = 'https://raw.githubusercontent.com/DigitPaint/css/master/linters/.scss-lint.yml'
20
19
 
21
20
  desc 'Scsslint generator creates an .scss-lint.yml config file'
22
21
  class_option(
@@ -27,6 +26,13 @@ module RogerScsslint
27
26
  default it uses the company' default"
28
27
  )
29
28
 
29
+ class_option(
30
+ :force,
31
+ type: :boolean,
32
+ aliases: ['-f'],
33
+ desc: 'Always overwrite the config file'
34
+ )
35
+
30
36
  # Write config file
31
37
  def write_config_file
32
38
  if options[:config]
@@ -36,9 +42,9 @@ module RogerScsslint
36
42
  end
37
43
 
38
44
  # Create file check if we don't have a conflict or something
39
- create_file "#{@project.path}/#{CONFIG_PATH}", config
45
+ create_file "#{@project.path}/#{CONFIG_PATH}", config, force: options[:force]
40
46
  end
41
47
  end
42
48
  end
43
49
 
44
- Roger::Generators.register RogerScsslint::ScsslintGenerator
50
+ Roger::Generators.register RogerScsslint::Generator
@@ -1,10 +1,10 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  Gem::Specification.new do |s|
4
- s.authors = ['Hans Krutzer']
5
- s.email = ['info@digitpaint.nl', 'hans@digitpaint.nl']
4
+ s.authors = ['Hans Krutzer', 'Flurin Egger']
5
+ s.email = ['info@digitpaint.nl', 'hans@digitpaint.nl', 'flurin@digitpaint.nl']
6
6
  s.name = 'roger_scsslint'
7
- s.version = '0.0.1'
7
+ s.version = '0.1.0'
8
8
  s.homepage = 'https://github.com/hkrutzer/roger_scsslint'
9
9
 
10
10
  s.summary = 'Lint SCSS files within Roger'
@@ -24,5 +24,7 @@ Gem::Specification.new do |s|
24
24
 
25
25
  s.add_development_dependency 'rubocop', ['~> 0']
26
26
  s.add_development_dependency 'rake', ['~> 0']
27
- s.add_development_dependency 'test-unit', ['~> 0']
27
+ s.add_development_dependency 'test-unit', ['>= 0']
28
+ s.add_development_dependency 'thor', ['~> 0']
29
+ s.add_development_dependency 'mocha', ['~> 1.1.0']
28
30
  end
@@ -0,0 +1,2 @@
1
+ scss_files: 'test/data/**/*.css.scss'
2
+ exclude: 'vendor/**'
File without changes
@@ -0,0 +1,31 @@
1
+ require 'test/unit'
2
+ require 'mocha/test_unit'
3
+
4
+ require 'roger/cli'
5
+ require_relative '../lib/roger_scsslint/generator.rb'
6
+
7
+ # Mock project
8
+ class Project
9
+ def path
10
+ './'
11
+ end
12
+ end
13
+
14
+ # Linting plugin unit test
15
+ class GeneratorTest < Test::Unit::TestCase
16
+ # Check if tasks is added
17
+ def test_default_generator
18
+ assert_includes Roger::Cli::Generate.tasks, 'rogerscsslint::', 'Scsslint task is loaded'
19
+ end
20
+
21
+ def test_create_file
22
+ file_name = './.scss-lint.yml'
23
+ Roger::Cli::Base.expects(:project).once.returns(Project.new)
24
+ cli = Roger::Cli::Generate.new
25
+ cli.invoke 'rogerscsslint::', [], ['-f']
26
+ assert File.exist?(file_name), 'After invoking the file is written'
27
+
28
+ # Unlink file
29
+ File.unlink file_name
30
+ end
31
+ end
data/test/lint_test.rb CHANGED
@@ -16,17 +16,28 @@ end
16
16
 
17
17
  # Linting plugin unit test
18
18
  class LintTest < Test::Unit::TestCase
19
+ def setup
20
+ @file_name = '.scss-lint.yml'
21
+ assert !File.exist?(@file_name), '.scss-lint.yml file already exists.'
22
+ FileUtils.cp('./test/data/sample-scss-lint.yml', './.scss-lint.yml')
23
+ end
24
+
19
25
  def test_lint
20
26
  faketester = TesterStub.new
21
27
 
22
28
  linter = RogerScsslint::Lint.new
23
29
  linter.call(faketester, {})
24
30
 
31
+ testfile = 'test/data/test.scss'
25
32
  assert_equal(faketester.messages,
26
33
  ['SCSS linting files',
27
- '[W] test/test.scss:1 SingleLinePerSelector: Each selector '\
34
+ "[W] #{testfile}:1 SingleLinePerSelector: Each selector "\
28
35
  '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'])
36
+ "[W] #{testfile}:2 ZeroUnit: `0px` should be written without units as `0`",
37
+ "[W] #{testfile}:3 FinalNewline: Files should end with a trailing newline"])
38
+ end
39
+
40
+ def teardown
41
+ File.unlink @file_name
31
42
  end
32
43
  end
metadata CHANGED
@@ -1,110 +1,138 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roger_scsslint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hans Krutzer
8
+ - Flurin Egger
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2015-01-19 00:00:00.000000000 Z
12
+ date: 2015-01-28 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: roger
15
16
  requirement: !ruby/object:Gem::Requirement
16
17
  requirements:
17
- - - "~>"
18
+ - - ~>
18
19
  - !ruby/object:Gem::Version
19
20
  version: '0.13'
20
- - - ">="
21
+ - - ! '>='
21
22
  - !ruby/object:Gem::Version
22
23
  version: 0.13.0
23
24
  type: :runtime
24
25
  prerelease: false
25
26
  version_requirements: !ruby/object:Gem::Requirement
26
27
  requirements:
27
- - - "~>"
28
+ - - ~>
28
29
  - !ruby/object:Gem::Version
29
30
  version: '0.13'
30
- - - ">="
31
+ - - ! '>='
31
32
  - !ruby/object:Gem::Version
32
33
  version: 0.13.0
33
34
  - !ruby/object:Gem::Dependency
34
35
  name: scss-lint
35
36
  requirement: !ruby/object:Gem::Requirement
36
37
  requirements:
37
- - - "~>"
38
+ - - ~>
38
39
  - !ruby/object:Gem::Version
39
40
  version: '0.31'
40
- - - ">="
41
+ - - ! '>='
41
42
  - !ruby/object:Gem::Version
42
43
  version: 0.31.0
43
44
  type: :runtime
44
45
  prerelease: false
45
46
  version_requirements: !ruby/object:Gem::Requirement
46
47
  requirements:
47
- - - "~>"
48
+ - - ~>
48
49
  - !ruby/object:Gem::Version
49
50
  version: '0.31'
50
- - - ">="
51
+ - - ! '>='
51
52
  - !ruby/object:Gem::Version
52
53
  version: 0.31.0
53
54
  - !ruby/object:Gem::Dependency
54
55
  name: rubocop
55
56
  requirement: !ruby/object:Gem::Requirement
56
57
  requirements:
57
- - - "~>"
58
+ - - ~>
58
59
  - !ruby/object:Gem::Version
59
60
  version: '0'
60
61
  type: :development
61
62
  prerelease: false
62
63
  version_requirements: !ruby/object:Gem::Requirement
63
64
  requirements:
64
- - - "~>"
65
+ - - ~>
65
66
  - !ruby/object:Gem::Version
66
67
  version: '0'
67
68
  - !ruby/object:Gem::Dependency
68
69
  name: rake
69
70
  requirement: !ruby/object:Gem::Requirement
70
71
  requirements:
71
- - - "~>"
72
+ - - ~>
72
73
  - !ruby/object:Gem::Version
73
74
  version: '0'
74
75
  type: :development
75
76
  prerelease: false
76
77
  version_requirements: !ruby/object:Gem::Requirement
77
78
  requirements:
78
- - - "~>"
79
+ - - ~>
79
80
  - !ruby/object:Gem::Version
80
81
  version: '0'
81
82
  - !ruby/object:Gem::Dependency
82
83
  name: test-unit
83
84
  requirement: !ruby/object:Gem::Requirement
84
85
  requirements:
85
- - - "~>"
86
+ - - ! '>='
86
87
  - !ruby/object:Gem::Version
87
88
  version: '0'
88
89
  type: :development
89
90
  prerelease: false
90
91
  version_requirements: !ruby/object:Gem::Requirement
91
92
  requirements:
92
- - - "~>"
93
+ - - ! '>='
93
94
  - !ruby/object:Gem::Version
94
95
  version: '0'
95
- description: |2
96
- Lint SCSS files within Roger, using scss-lint.
97
- Will use .scss-lint.yml.
96
+ - !ruby/object:Gem::Dependency
97
+ name: thor
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ~>
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: mocha
112
+ requirement: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ~>
115
+ - !ruby/object:Gem::Version
116
+ version: 1.1.0
117
+ type: :development
118
+ prerelease: false
119
+ version_requirements: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ~>
122
+ - !ruby/object:Gem::Version
123
+ version: 1.1.0
124
+ description: ! " Lint SCSS files within Roger, using scss-lint.\n Will use .scss-lint.yml.\n"
98
125
  email:
99
126
  - info@digitpaint.nl
100
127
  - hans@digitpaint.nl
128
+ - flurin@digitpaint.nl
101
129
  executables: []
102
130
  extensions: []
103
131
  extra_rdoc_files: []
104
132
  files:
105
- - ".gitignore"
106
- - ".rubocop.yml"
107
- - ".travis.yml"
133
+ - .gitignore
134
+ - .rubocop.yml
135
+ - .travis.yml
108
136
  - Gemfile
109
137
  - LICENSE
110
138
  - README.md
@@ -113,9 +141,10 @@ files:
113
141
  - lib/roger_scsslint/generator.rb
114
142
  - lib/roger_scsslint/lint.rb
115
143
  - roger_scsslint.gemspec
144
+ - test/data/sample-scss-lint.yml
145
+ - test/data/test.scss
146
+ - test/generator_test.rb
116
147
  - test/lint_test.rb
117
- - test/test.scss
118
- - test/travis-scss-lint.yml
119
148
  homepage: https://github.com/hkrutzer/roger_scsslint
120
149
  licenses:
121
150
  - MIT
@@ -126,17 +155,17 @@ require_paths:
126
155
  - lib
127
156
  required_ruby_version: !ruby/object:Gem::Requirement
128
157
  requirements:
129
- - - ">="
158
+ - - ! '>='
130
159
  - !ruby/object:Gem::Version
131
160
  version: '0'
132
161
  required_rubygems_version: !ruby/object:Gem::Requirement
133
162
  requirements:
134
- - - ">="
163
+ - - ! '>='
135
164
  - !ruby/object:Gem::Version
136
165
  version: '0'
137
166
  requirements: []
138
167
  rubyforge_project:
139
- rubygems_version: 2.2.2
168
+ rubygems_version: 2.1.5
140
169
  signing_key:
141
170
  specification_version: 4
142
171
  summary: Lint SCSS files within Roger
@@ -1,2 +0,0 @@
1
- scss_files: 'test/**/*.css.scss'
2
- exclude: 'vendor/**'