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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d4f0e16c0c697387cdf311fb01538c8e11f323d
4
- data.tar.gz: 1bd8da34a9e8353a888181679ca2d02de985584e
3
+ metadata.gz: 0b83ac9eddd921379c6a00bae274d995bab3977a
4
+ data.tar.gz: c6b2f3bf308d8e84c0b7864eb26d6d495371699a
5
5
  SHA512:
6
- metadata.gz: dec8daf1b3096d9dc24677453623940ab03be5d742f8d5ff11b78078ceb05dc686a65afc409e94d25bb0ff21e9ca82c956a85bebace9f67c5aedefd805ccef29
7
- data.tar.gz: 39224d3cfaf3e1966485fcd02f56be9a845234b15a0d693e2f8e19d3680eb56f0dad5ac33609e0dba7669948ac724233b473b885ed18ef35119a6afa323b473d
6
+ metadata.gz: d4df130c6bb414b8448fcf5021b1206bdd96897225d03fbcf065a9169a47e823c36d1eb8e83fb3744fc16ba41dad9737c3ae7651bed9f8462312d32853e6c8b9
7
+ data.tar.gz: 0a0bb75f1e2febc17812a2fbd6fbf61424c5fbd4517c36f3f57168eacedd277696a6152895745a573e6951df6511e1ef2396889618a611ce0051a8fc4b75d6c1
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.0.0
4
+
5
+ * Add cli option
6
+
3
7
  ## v0.3.0
4
8
 
5
9
  * Changed not to run when Guard run_on_removals
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/guard-haml_lint.svg)](https://badge.fury.io/rb/guard-haml_lint)
2
- [![Dependency Status](https://www.versioneye.com/ruby/guard-haml_lint/0.2.0/badge?style=flat)](https://www.versioneye.com/ruby/guard-haml_lint/0.2.0)
2
+ [![Dependency Status](https://www.versioneye.com/ruby/guard-haml_lint/0.3.0/badge?style=flat)](https://www.versioneye.com/ruby/guard-haml_lint/0.3.0)
3
3
  [![Build Status](https://travis-ci.org/yatmsu/guard-haml-lint.svg)](https://travis-ci.org/yatmsu/guard-haml-lint)
4
4
  [![Code Climate](https://codeclimate.com/github/yatmsu/guard-haml-lint/badges/gpa.svg)](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
- And then execute:
18
+ Add the default guard-haml_lint definition to your Guardfile
19
19
 
20
- $ bundle
21
-
22
- Or install it yourself as:
23
-
24
- $ gem install guard-haml_lint
20
+ ```bash
21
+ $ guard init haml_lint
22
+ ```
25
23
 
26
- Add the default guard-haml_lint definition to your Guardfile:
24
+ Add options in Guardfile
27
25
 
28
- $ guard init haml_lint
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
- Ruby on Rails is released under the [MIT License](https://opensource.org/licenses/MIT).
49
+ guard-haml_lint is released under the [MIT License](https://opensource.org/licenses/MIT).
@@ -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 = ['y@su']
8
+ spec.authors = ['Yasuhiko Katoh']
9
9
  spec.email = ['toyasyu@gmail.com']
10
10
 
11
11
  spec.summary = 'Guard plugin for HAML-Lint'
@@ -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]) }
@@ -1,6 +1,6 @@
1
1
  module Guard
2
2
  # guard-haml_lint version class
3
3
  class HamlLintVersion
4
- VERSION = '0.3.0'.freeze
4
+ VERSION = '1.0.0'.freeze
5
5
  end
6
6
  end
@@ -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 be true }
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.reload).to eq nil }
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.3.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
- - y@su
7
+ - Yasuhiko Katoh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-11 00:00:00.000000000 Z
11
+ date: 2017-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard