guard-haml_lint 0.3.0 → 1.0.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/CHANGELOG.md +4 -0
- data/README.md +15 -17
- data/guard-haml_lint.gemspec +1 -1
- data/lib/guard/haml_lint.rb +4 -1
- data/lib/guard/hamllint/templates/Guardfile +1 -0
- data/lib/guard/hamllint/version.rb +1 -1
- data/spec/guard/haml_lint_spec.rb +20 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b83ac9eddd921379c6a00bae274d995bab3977a
|
4
|
+
data.tar.gz: c6b2f3bf308d8e84c0b7864eb26d6d495371699a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4df130c6bb414b8448fcf5021b1206bdd96897225d03fbcf065a9169a47e823c36d1eb8e83fb3744fc16ba41dad9737c3ae7651bed9f8462312d32853e6c8b9
|
7
|
+
data.tar.gz: 0a0bb75f1e2febc17812a2fbd6fbf61424c5fbd4517c36f3f57168eacedd277696a6152895745a573e6951df6511e1ef2396889618a611ce0051a8fc4b75d6c1
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
[](https://badge.fury.io/rb/guard-haml_lint)
|
2
|
-
[](https://www.versioneye.com/ruby/guard-haml_lint/0.3.0)
|
3
3
|
[](https://travis-ci.org/yatmsu/guard-haml-lint)
|
4
4
|
[](https://codeclimate.com/github/yatmsu/guard-haml-lint)
|
5
5
|
|
@@ -9,23 +9,26 @@ A guard to lint your Haml.
|
|
9
9
|
|
10
10
|
## Installation
|
11
11
|
|
12
|
-
Add this line to your application's Gemfile
|
12
|
+
Add this line to your application's Gemfile
|
13
13
|
|
14
14
|
```ruby
|
15
15
|
gem 'guard-haml_lint'
|
16
16
|
```
|
17
17
|
|
18
|
-
|
18
|
+
Add the default guard-haml_lint definition to your Guardfile
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
$ gem install guard-haml_lint
|
20
|
+
```bash
|
21
|
+
$ guard init haml_lint
|
22
|
+
```
|
25
23
|
|
26
|
-
Add
|
24
|
+
Add options in Guardfile
|
27
25
|
|
28
|
-
|
26
|
+
```ruby
|
27
|
+
guard :haml_lint, cli: '--fail-fast' do
|
28
|
+
watch(%r{.+\.html.*\.haml$})
|
29
|
+
watch(%r{(?:.+/)?\.haml-lint\.yml$}) { |m| File.dirname(m[0]) }
|
30
|
+
end
|
31
|
+
```
|
29
32
|
|
30
33
|
## Guardfile
|
31
34
|
|
@@ -35,12 +38,7 @@ Available options:
|
|
35
38
|
|
36
39
|
all_on_start: true # Check all files at Guard startup. default: true
|
37
40
|
haml_dires: ['app/views'] # Check Directories. default: 'app/views' or '.'
|
38
|
-
|
39
|
-
## Development
|
40
|
-
|
41
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
42
|
-
|
43
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
41
|
+
cli: '--fail-fast --no-color' # Additional command line options to haml-lint. default: nil
|
44
42
|
|
45
43
|
## Contributing
|
46
44
|
|
@@ -48,4 +46,4 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/yatmsu
|
|
48
46
|
|
49
47
|
## License
|
50
48
|
|
51
|
-
|
49
|
+
guard-haml_lint is released under the [MIT License](https://opensource.org/licenses/MIT).
|
data/guard-haml_lint.gemspec
CHANGED
@@ -5,7 +5,7 @@ require 'guard/hamllint/version'
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'guard-haml_lint'
|
7
7
|
spec.version = Guard::HamlLintVersion::VERSION
|
8
|
-
spec.authors = ['
|
8
|
+
spec.authors = ['Yasuhiko Katoh']
|
9
9
|
spec.email = ['toyasyu@gmail.com']
|
10
10
|
|
11
11
|
spec.summary = 'Guard plugin for HAML-Lint'
|
data/lib/guard/haml_lint.rb
CHANGED
@@ -4,7 +4,8 @@ module Guard
|
|
4
4
|
# This class is Guard plugin
|
5
5
|
class HamlLint < Plugin
|
6
6
|
DEFAULT_OPTIONS = {
|
7
|
-
all_on_start: true
|
7
|
+
all_on_start: true,
|
8
|
+
cli: nil
|
8
9
|
}.freeze
|
9
10
|
|
10
11
|
attr_reader :options
|
@@ -85,6 +86,8 @@ module Guard
|
|
85
86
|
#
|
86
87
|
def run(paths = [])
|
87
88
|
command = ['haml-lint']
|
89
|
+
command << @options[:cli] if @options[:cli]
|
90
|
+
|
88
91
|
if paths.empty?
|
89
92
|
Guard::Compat::UI.info 'Running HAML-Lint for all haml files'
|
90
93
|
command.concat @options[:haml_dires]
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# Guard-HamlLint supports a lot options with default values:
|
2
2
|
# all_on_start: true # Check all files at Guard startup. default: true
|
3
3
|
# haml_dires: ['app/views'] # Check Directories. default: 'app/views' or '.'
|
4
|
+
# cli: '--fail-fast --no-color' # Additional command line options to haml-lint.
|
4
5
|
guard :haml_lint do
|
5
6
|
watch(%r{.+\.html.*\.haml$})
|
6
7
|
watch(%r{(?:.+/)?\.haml-lint\.yml$}) { |m| File.dirname(m[0]) }
|
@@ -2,11 +2,12 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Guard::HamlLint do
|
4
4
|
subject { described_class.new(options) }
|
5
|
-
let(:options) { { all_on_start: true } }
|
5
|
+
let(:options) { { all_on_start: true, cli: nil } }
|
6
6
|
|
7
7
|
describe '#initialize' do
|
8
8
|
context 'when default initialized' do
|
9
|
-
it { expect(subject.options[:all_on_start]).to
|
9
|
+
it { expect(subject.options[:all_on_start]).to eq true }
|
10
|
+
it { expect(subject.options[:cli]).to eq nil }
|
10
11
|
|
11
12
|
context 'when app/views directory exists' do
|
12
13
|
before do
|
@@ -44,6 +45,22 @@ describe Guard::HamlLint do
|
|
44
45
|
subject.start
|
45
46
|
end
|
46
47
|
end
|
48
|
+
|
49
|
+
context 'when correct value is specified for the :cli option' do
|
50
|
+
let(:options) { { cli: '--fail-fast' } }
|
51
|
+
|
52
|
+
it 'not raise error' do
|
53
|
+
expect { subject.start }.to_not raise_error
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'when abnormal value is specified for the :cli option' do
|
58
|
+
let(:options) { { cli: '--error-option' } }
|
59
|
+
|
60
|
+
it 'raise UncaughtThrowError' do
|
61
|
+
expect { subject.start }.to raise_error(UncaughtThrowError)
|
62
|
+
end
|
63
|
+
end
|
47
64
|
end
|
48
65
|
|
49
66
|
describe '#reload' do
|
@@ -72,6 +89,6 @@ describe Guard::HamlLint do
|
|
72
89
|
end
|
73
90
|
|
74
91
|
describe '#run_on_removals' do
|
75
|
-
it { expect(subject.
|
92
|
+
it { expect(subject.run_on_removals(['spec/views/sample.html.haml'])).to eq nil }
|
76
93
|
end
|
77
94
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-haml_lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Yasuhiko Katoh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: guard
|