guard-reek 1.1.0 → 1.2.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/.travis.yml +8 -4
- data/CHANGELOG.md +5 -0
- data/Guardfile +1 -1
- data/README.md +3 -0
- data/lib/guard/reek/runner.rb +34 -20
- data/lib/guard/reek/version.rb +1 -1
- data/spec/guard/reek/runner_spec.rb +16 -4
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b2f9c07536b9de785e7d0e455756820f4d49cfa
|
4
|
+
data.tar.gz: 7e5006fbdef4fe4e1c66ac86fd7d0d369f0e1520
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2a585c094df8e9e40b353c5945a86d821f75ee5c8b080d98080b2088b82e969d523ca83fcfb09eb00c4c8e2ea7042a314a3b9ccfc2fca0e64dc76b4ced83ec2
|
7
|
+
data.tar.gz: ef18dd28416c02bd8f2cde852b60fac8e9c413e3d803f021185d027312da3d74af729a8debe1cf4556cad0dcd615f13764b6de34f3fa203d8fd5e4f2915ae002
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
data/Guardfile
CHANGED
data/README.md
CHANGED
@@ -54,6 +54,9 @@ end
|
|
54
54
|
```
|
55
55
|
all_on_start: true # Check all files at Guard startup.
|
56
56
|
# default: true
|
57
|
+
all: 'app lib spec' # What to run when running all
|
58
|
+
# An array or string is acceptable.
|
59
|
+
# default: *
|
57
60
|
cli: '--single-line' # Pass arbitrary reek CLI arguments.
|
58
61
|
# An array or string is acceptable.
|
59
62
|
# default: nil
|
data/lib/guard/reek/runner.rb
CHANGED
@@ -9,41 +9,55 @@ module Guard
|
|
9
9
|
|
10
10
|
def initialize(options)
|
11
11
|
@cli = options[:cli]
|
12
|
+
@all = options[:all] || '*'
|
12
13
|
@notifier = options[:notifier] || Notifier
|
13
14
|
@ui = options[:ui] || UI
|
14
15
|
end
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
notify_about_result
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
17
|
+
# this class decides which files are run against reek
|
18
|
+
class Paths
|
19
|
+
def initialize(paths, all)
|
20
|
+
@all = all
|
21
|
+
@paths = paths
|
22
|
+
@paths = [] if @paths.include?('.reek')
|
23
|
+
end
|
27
24
|
|
28
|
-
|
29
|
-
|
30
|
-
|
25
|
+
def to_s
|
26
|
+
@paths.empty? ? 'all' : @paths.to_s
|
27
|
+
end
|
31
28
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
29
|
+
def to_ary
|
30
|
+
if @paths.empty?
|
31
|
+
Array(@all)
|
32
|
+
else
|
33
|
+
@paths
|
34
|
+
end
|
37
35
|
end
|
38
36
|
end
|
39
37
|
|
40
|
-
def
|
38
|
+
def run(paths = [])
|
39
|
+
result = run_reek_cmd(paths)
|
40
|
+
|
41
41
|
if result
|
42
42
|
notifier.notify('Reek Results', title: 'Passed', image: :success)
|
43
43
|
else
|
44
44
|
notifier.notify('Reek Results', title: 'Failed', image: :failed)
|
45
45
|
end
|
46
46
|
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def run_reek_cmd(paths)
|
51
|
+
runner_paths = Paths.new(paths, @all)
|
52
|
+
ui.info("Guard::Reek is running on #{runner_paths}")
|
53
|
+
|
54
|
+
command = reek_cmd.concat(runner_paths)
|
55
|
+
Kernel.system(command.join(' '))
|
56
|
+
end
|
57
|
+
|
58
|
+
def reek_cmd
|
59
|
+
['reek', @cli].compact
|
60
|
+
end
|
47
61
|
end
|
48
62
|
end
|
49
63
|
end
|
data/lib/guard/reek/version.rb
CHANGED
@@ -12,23 +12,35 @@ describe Guard::Reek::Runner do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'executes reek' do
|
15
|
-
expect(Kernel).to receive(:system).with('reek')
|
15
|
+
expect(Kernel).to receive(:system).with('reek *')
|
16
16
|
subject.run
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'executes reek with file' do
|
20
|
-
expect(Kernel).to receive(:system).with('reek
|
20
|
+
expect(Kernel).to receive(:system).with('reek test.rb')
|
21
21
|
subject.run(['test.rb'])
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'executes reek when .reek updated' do
|
25
|
-
expect(Kernel).to receive(:system).with('reek')
|
25
|
+
expect(Kernel).to receive(:system).with('reek *')
|
26
26
|
subject.run(['.reek'])
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'executes reek with cli options' do
|
30
30
|
options[:cli] = '-s'
|
31
|
-
expect(Kernel).to receive(:system).with('reek
|
31
|
+
expect(Kernel).to receive(:system).with('reek -s *')
|
32
|
+
subject.run
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'executes reek with all options as string' do
|
36
|
+
options[:all] = 'app'
|
37
|
+
expect(Kernel).to receive(:system).with('reek app')
|
38
|
+
subject.run
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'executes reek with all options as array' do
|
42
|
+
options[:all] = %w[app lib]
|
43
|
+
expect(Kernel).to receive(:system).with('reek app lib')
|
32
44
|
subject.run
|
33
45
|
end
|
34
46
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-reek
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grant Petersen-Speelman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-06-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: reek
|
@@ -148,6 +148,7 @@ files:
|
|
148
148
|
- .gitignore
|
149
149
|
- .rspec
|
150
150
|
- .travis.yml
|
151
|
+
- CHANGELOG.md
|
151
152
|
- Gemfile
|
152
153
|
- Guardfile
|
153
154
|
- LICENSE.txt
|