guard-slimlint 1.1.2 → 1.2.1
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/Gemfile +1 -3
- data/Guardfile +6 -0
- data/lib/guard/slimlint.rb +41 -9
- data/lib/guard/slimlint/templates/Guardfile +4 -1
- data/lib/guard/slimlint/version.rb +1 -1
- metadata +3 -3
- data/lib/guard/slimlint/notifier.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a91163e1f2044c92b299d1e5e8816bffe65a249
|
4
|
+
data.tar.gz: 50cedaa71b1969f1c4bdb006883fc8750cfc38db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc59cbc42f957a5fb0fa968ae3898279b82b5b027e04381ce7f91a97d886aee1c3e61f045f6c86b360711634089ae63563551ead08e5cb3f418f3771b5ca62b5
|
7
|
+
data.tar.gz: 0d7cbf7a1d6c796e9d6ad91df04a7cb82c11b0fced7d294087dfd1f3c1a09397e7e8f816bfea6cae8ddf5cd25be7b5eb1b79604ab2a843ee0ea7e92f3eb9be22
|
data/Gemfile
CHANGED
data/Guardfile
ADDED
data/lib/guard/slimlint.rb
CHANGED
@@ -1,38 +1,70 @@
|
|
1
1
|
require 'guard/compat/plugin'
|
2
2
|
require 'colorize'
|
3
|
-
require 'guard/slimlint/notifier'
|
4
3
|
|
5
4
|
module Guard
|
6
5
|
class SlimLint < Plugin
|
6
|
+
attr_accessor :notify_on
|
7
|
+
|
7
8
|
def initialize(options = {})
|
9
|
+
@notify_on = options[:notify_on] ? options[:notify_on] : :failure
|
8
10
|
super
|
9
11
|
end
|
10
12
|
|
13
|
+
def start
|
14
|
+
run
|
15
|
+
end
|
16
|
+
|
11
17
|
def run_all
|
12
18
|
run
|
13
19
|
end
|
14
20
|
|
15
|
-
def
|
21
|
+
def startguard
|
16
22
|
run
|
17
23
|
end
|
18
24
|
|
19
|
-
def run_on_modifications(
|
20
|
-
run(
|
25
|
+
def run_on_modifications(paths)
|
26
|
+
run(paths)
|
21
27
|
end
|
22
28
|
|
23
|
-
def run_on_additions(
|
24
|
-
run(
|
29
|
+
def run_on_additions(paths)
|
30
|
+
run(paths)
|
25
31
|
end
|
26
32
|
|
27
33
|
private
|
28
34
|
|
29
|
-
def run(
|
30
|
-
|
35
|
+
def run(paths = ['.'])
|
36
|
+
result = system "slim-lint #{paths.join(' ')}"
|
37
|
+
if result
|
31
38
|
UI.info 'No Slim offences detected'.green
|
32
39
|
else
|
33
40
|
UI.info 'Slim offences has been detected'.red
|
34
|
-
Notifier.notify(false, 'Slim offences detected')
|
35
41
|
end
|
42
|
+
check_and_notify(result)
|
43
|
+
end
|
44
|
+
|
45
|
+
def notification_allowed?(result)
|
46
|
+
case notify_on
|
47
|
+
when :failure then !result
|
48
|
+
when :success then result
|
49
|
+
when :both then true
|
50
|
+
when :none then false
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def check_and_notify(result)
|
55
|
+
notify(result) if notification_allowed?(result)
|
56
|
+
end
|
57
|
+
|
58
|
+
def image(result)
|
59
|
+
result ? :success : :failed
|
60
|
+
end
|
61
|
+
|
62
|
+
def message(result)
|
63
|
+
result ? 'No slim offences' : 'Slim offences detected'
|
64
|
+
end
|
65
|
+
|
66
|
+
def notify(result)
|
67
|
+
Notifier.notify(message(result), title: 'Slim-lint results', image: image(result))
|
36
68
|
end
|
37
69
|
end
|
38
70
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-slimlint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michal Gajowiak
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01
|
11
|
+
date: 2016-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -121,6 +121,7 @@ files:
|
|
121
121
|
- ".travis.yml"
|
122
122
|
- CODE_OF_CONDUCT.md
|
123
123
|
- Gemfile
|
124
|
+
- Guardfile
|
124
125
|
- LICENSE.txt
|
125
126
|
- README.md
|
126
127
|
- Rakefile
|
@@ -128,7 +129,6 @@ files:
|
|
128
129
|
- bin/setup
|
129
130
|
- guard-slimlint.gemspec
|
130
131
|
- lib/guard/slimlint.rb
|
131
|
-
- lib/guard/slimlint/notifier.rb
|
132
132
|
- lib/guard/slimlint/templates/Guardfile
|
133
133
|
- lib/guard/slimlint/version.rb
|
134
134
|
homepage: https://github.com/mike927/guard-slimlint
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'guard/slimlint'
|
4
|
-
|
5
|
-
module Guard
|
6
|
-
class SlimLint < Plugin
|
7
|
-
class Notifier
|
8
|
-
class << self
|
9
|
-
def image(result)
|
10
|
-
result ? :success : :failed
|
11
|
-
end
|
12
|
-
|
13
|
-
def notify(result, message)
|
14
|
-
Compat::UI.notify(message, title: 'Slimlint results!', image: image(result))
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|