guard-haml_lint 0.1.2 → 0.1.3
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/.rubocop.yml +7 -0
- data/CHANGELOG.md +13 -0
- data/Guardfile +21 -0
- data/README.md +1 -0
- data/guard-haml_lint.gemspec +2 -1
- data/lib/guard/haml_lint.rb +12 -13
- data/lib/guard/hamllint/version.rb +2 -1
- data/spec/guard/haml_lint_spec.rb +2 -3
- data/spec/spec_helper.rb +13 -1
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12a9b490762ae43be9463282ecb1036564988d6c
|
4
|
+
data.tar.gz: 410a9ed0ffd7f2d1977758b14bffc9a74850ed7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5781ffaabbea3e5589e00d6a87b479cc352d6289b6a057e7159b73c9bbdb54b70417002f0e5523b53c08ad4ae655371ee7fea56370451311d59ac0a722fc61b
|
7
|
+
data.tar.gz: e14a15189a4b57dc600e6df0effbf72038bf23c9f10dd1089596a6a592afd65438caa46da67e94b47aa1f41457c63b653142a90eeec112741c34f0aaa1f96110
|
data/.rubocop.yml
ADDED
data/CHANGELOG.md
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
5
|
+
# directories %w(app lib config test spec features) \
|
6
|
+
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
7
|
+
|
8
|
+
## Note: if you are using the `directories` clause above and you are not
|
9
|
+
## watching the project directory ('.'), then you will want to move
|
10
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
11
|
+
#
|
12
|
+
# $ mkdir config
|
13
|
+
# $ mv Guardfile config/
|
14
|
+
# $ ln -s config/Guardfile .
|
15
|
+
#
|
16
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
17
|
+
|
18
|
+
guard :rubocop do
|
19
|
+
watch(%r{.+\.rb$})
|
20
|
+
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
|
21
|
+
end
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
[](https://badge.fury.io/rb/guard-haml_lint)
|
2
|
+
[](https://www.versioneye.com/ruby/guard-haml_lint/0.2.0)
|
2
3
|
[](https://travis-ci.org/yatmsu/guard-haml-lint)
|
3
4
|
[](https://codeclimate.com/github/yatmsu/guard-haml-lint)
|
4
5
|
|
data/guard-haml_lint.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
|
15
15
|
spec.files = `git ls-files`.split("\n")
|
16
16
|
spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
-
spec.executables = `git ls-files -- exe/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
+
spec.executables = `git ls-files -- exe/*`.split("\n").map { |f| File.basename(f) }
|
18
18
|
spec.require_paths = ['lib']
|
19
19
|
|
20
20
|
spec.required_ruby_version = '>= 2.0.0'
|
@@ -26,4 +26,5 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_development_dependency 'bundler', '>= 1.0.0'
|
27
27
|
spec.add_development_dependency 'rake', '~> 10.0'
|
28
28
|
spec.add_development_dependency 'rspec'
|
29
|
+
spec.add_development_dependency 'guard-rubocop', '~> 1.2.0'
|
29
30
|
end
|
data/lib/guard/haml_lint.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'guard/compat/plugin'
|
2
2
|
|
3
3
|
module Guard
|
4
|
+
# This class is Guard plugin
|
4
5
|
class HamlLint < Plugin
|
5
|
-
|
6
6
|
DEFAULT_OPTIONS = {
|
7
7
|
all_on_start: true
|
8
8
|
}
|
@@ -10,7 +10,8 @@ module Guard
|
|
10
10
|
attr_reader :options
|
11
11
|
|
12
12
|
# Initializes a Guard plugin.
|
13
|
-
# Don't do any work here,
|
13
|
+
# Don't do any work here,
|
14
|
+
# especially as Guard plugins get initialized even if they are not in an active group!
|
14
15
|
#
|
15
16
|
# @param [Hash] options the custom Guard plugin options
|
16
17
|
# @option options [Array<Guard::Watcher>] watchers the Guard plugin file watchers
|
@@ -19,9 +20,7 @@ module Guard
|
|
19
20
|
#
|
20
21
|
def initialize(options = {})
|
21
22
|
super
|
22
|
-
@options = DEFAULT_OPTIONS
|
23
|
-
.merge({ haml_dires: default_haml_dirs })
|
24
|
-
.merge(options)
|
23
|
+
@options = DEFAULT_OPTIONS.merge(haml_dires: default_haml_dirs).merge(options)
|
25
24
|
end
|
26
25
|
|
27
26
|
# Called once when Guard starts. Please override initialize method to init stuff.
|
@@ -34,7 +33,8 @@ module Guard
|
|
34
33
|
end
|
35
34
|
|
36
35
|
# Called when `reload|r|z + enter` is pressed.
|
37
|
-
# This method should be mainly used for "reload" (really!)
|
36
|
+
# This method should be mainly used for "reload" (really!)
|
37
|
+
# actions like reloading passenger/spork/bundler/...
|
38
38
|
#
|
39
39
|
# @raise [:task_has_failed] when reload has failed
|
40
40
|
# @return [Object] the task result
|
@@ -85,14 +85,14 @@ module Guard
|
|
85
85
|
|
86
86
|
private
|
87
87
|
|
88
|
-
def run(
|
89
|
-
Guard::Compat::UI.info 'Running HAML-Lint for all haml files'
|
90
|
-
|
88
|
+
def run(paths = [])
|
91
89
|
command = ['haml-lint']
|
92
|
-
if
|
90
|
+
if paths.empty?
|
91
|
+
Guard::Compat::UI.info 'Running HAML-Lint for all haml files'
|
93
92
|
command.concat @options[:haml_dires]
|
94
93
|
else
|
95
|
-
|
94
|
+
Guard::Compat::UI.info "Running HAML-Lint for some of the haml files: #{paths.join('\n')}"
|
95
|
+
command.concat paths
|
96
96
|
end
|
97
97
|
|
98
98
|
throw :task_has_failed unless system(*command)
|
@@ -101,8 +101,7 @@ module Guard
|
|
101
101
|
# @return [Array<String>] haml directory paths
|
102
102
|
#
|
103
103
|
def default_haml_dirs
|
104
|
-
File.
|
104
|
+
File.exist?('app/views') ? ['app/views'] : ['.']
|
105
105
|
end
|
106
|
-
|
107
106
|
end
|
108
107
|
end
|
@@ -10,7 +10,7 @@ describe Guard::HamlLint do
|
|
10
10
|
|
11
11
|
context 'when app/views directory exists' do
|
12
12
|
before do
|
13
|
-
allow(File).to receive(:
|
13
|
+
allow(File).to receive(:exist?).with('app/views').and_return(true)
|
14
14
|
end
|
15
15
|
|
16
16
|
it { expect(subject.options[:haml_dires]).to eq ['app/views'] }
|
@@ -18,7 +18,7 @@ describe Guard::HamlLint do
|
|
18
18
|
|
19
19
|
context 'when app/views directory not exists' do
|
20
20
|
before do
|
21
|
-
allow(File).to receive(:
|
21
|
+
allow(File).to receive(:exist?).with('app/views').and_return(false)
|
22
22
|
end
|
23
23
|
|
24
24
|
it { expect(subject.options[:haml_dires]).to eq ['.'] }
|
@@ -43,5 +43,4 @@ describe Guard::HamlLint do
|
|
43
43
|
|
44
44
|
xdescribe '#run_on_removals' do
|
45
45
|
end
|
46
|
-
|
47
46
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,15 @@
|
|
1
1
|
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
|
-
require 'guard/
|
2
|
+
require 'guard/ui'
|
3
3
|
require 'guard/compat/test/helper'
|
4
|
+
require 'guard/haml_lint'
|
5
|
+
|
6
|
+
RSpec.configure do |config|
|
7
|
+
config.expect_with :rspec do |expectations|
|
8
|
+
expectations.syntax = :expect
|
9
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
10
|
+
end
|
11
|
+
|
12
|
+
config.mock_with :rspec do |mocks|
|
13
|
+
mocks.verify_partial_doubles = true
|
14
|
+
end
|
15
|
+
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.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- y@su
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: guard
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: guard-rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ~>
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.2.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.2.0
|
97
111
|
description: Guard::HamlLint automatically runs Haml Lint tools.
|
98
112
|
email:
|
99
113
|
- toyasyu@gmail.com
|
@@ -103,8 +117,11 @@ extra_rdoc_files: []
|
|
103
117
|
files:
|
104
118
|
- .gitignore
|
105
119
|
- .rspec
|
120
|
+
- .rubocop.yml
|
106
121
|
- .travis.yml
|
122
|
+
- CHANGELOG.md
|
107
123
|
- Gemfile
|
124
|
+
- Guardfile
|
108
125
|
- MIT-LICENSE
|
109
126
|
- README.md
|
110
127
|
- Rakefile
|