guard-haml_lint 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0b83ac9eddd921379c6a00bae274d995bab3977a
4
- data.tar.gz: c6b2f3bf308d8e84c0b7864eb26d6d495371699a
3
+ metadata.gz: e0aca0f2bef11e3af10fdb9224f9141b8c4b0db6
4
+ data.tar.gz: b934c4aff61f332bc1066f10a15e6cade268738e
5
5
  SHA512:
6
- metadata.gz: d4df130c6bb414b8448fcf5021b1206bdd96897225d03fbcf065a9169a47e823c36d1eb8e83fb3744fc16ba41dad9737c3ae7651bed9f8462312d32853e6c8b9
7
- data.tar.gz: 0a0bb75f1e2febc17812a2fbd6fbf61424c5fbd4517c36f3f57168eacedd277696a6152895745a573e6951df6511e1ef2396889618a611ce0051a8fc4b75d6c1
6
+ metadata.gz: 2450edc23cf90442c85a79bfc6d500f35390e83b43324f17ec49300413517ceedcf1047e3f8a8182e58231133876fdf8cba54388681b443614c23c4df2eba995
7
+ data.tar.gz: fbc8ca42ea7b36b72f406478360e1f740935af87341d1457b13df62c9bec9609b895e44ceac007f3239c289f630235d364c69d98adccc37ddd2b83f665a8263e
@@ -28,5 +28,5 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency 'bundler', '>= 1.0.0'
29
29
  spec.add_development_dependency 'rake', '~> 10.0'
30
30
  spec.add_development_dependency 'rspec', '~> 3.6.0'
31
- spec.add_development_dependency 'guard-rubocop', '~> 1.2.0'
31
+ spec.add_development_dependency 'guard-rubocop', '~> 1.3.0'
32
32
  end
@@ -1,4 +1,5 @@
1
1
  require 'guard/compat/plugin'
2
+ require 'shellwords'
2
3
 
3
4
  module Guard
4
5
  # This class is Guard plugin
@@ -86,7 +87,7 @@ module Guard
86
87
  #
87
88
  def run(paths = [])
88
89
  command = ['haml-lint']
89
- command << @options[:cli] if @options[:cli]
90
+ command.concat build_cli_command(@options[:cli])
90
91
 
91
92
  if paths.empty?
92
93
  Guard::Compat::UI.info 'Running HAML-Lint for all haml files'
@@ -99,6 +100,16 @@ module Guard
99
100
  throw :task_has_failed unless system(*command)
100
101
  end
101
102
 
103
+ # @param [String] commands
104
+ #
105
+ def build_cli_command(commands)
106
+ case commands
107
+ when String then commands.shellsplit
108
+ when NilClass then []
109
+ else raise ArgumentError, 'Please specify only String for :cli option'
110
+ end
111
+ end
112
+
102
113
  # @return [Array<String>] haml directory paths
103
114
  #
104
115
  def default_haml_dirs
@@ -1,6 +1,6 @@
1
1
  module Guard
2
2
  # guard-haml_lint version class
3
3
  class HamlLintVersion
4
- VERSION = '1.0.0'.freeze
4
+ VERSION = '1.0.1'.freeze
5
5
  end
6
6
  end
@@ -46,6 +46,14 @@ describe Guard::HamlLint do
46
46
  end
47
47
  end
48
48
 
49
+ context 'when more than one :cli option is specified' do
50
+ let(:options) { { cli: '--fail-level error --fail-fast' } }
51
+
52
+ it 'not raise error' do
53
+ expect { subject.start }.to_not raise_error
54
+ end
55
+ end
56
+
49
57
  context 'when correct value is specified for the :cli option' do
50
58
  let(:options) { { cli: '--fail-fast' } }
51
59
 
@@ -58,7 +66,15 @@ describe Guard::HamlLint do
58
66
  let(:options) { { cli: '--error-option' } }
59
67
 
60
68
  it 'raise UncaughtThrowError' do
61
- expect { subject.start }.to raise_error(UncaughtThrowError)
69
+ expect { subject.start }.to raise_error(UncaughtThrowError, /task_has_failed/)
70
+ end
71
+ end
72
+
73
+ context 'when abnormal value is specified for the :cli option' do
74
+ let(:options) { { cli: ['--fail-fast'] } }
75
+
76
+ it 'raise Guard::HamlLint::ArgumentError' do
77
+ expect { subject.start }.to raise_error(Guard::HamlLint::ArgumentError, 'Please specify only String for :cli option')
62
78
  end
63
79
  end
64
80
  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: 1.0.0
4
+ version: 1.0.1
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-12-02 00:00:00.000000000 Z
11
+ date: 2017-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 1.2.0
103
+ version: 1.3.0
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 1.2.0
110
+ version: 1.3.0
111
111
  description: Guard::HamlLint automatically runs Haml Lint tools.
112
112
  email:
113
113
  - toyasyu@gmail.com