guard-reek 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +7 -2
- data/Gemfile +4 -0
- data/Guardfile +3 -8
- data/README.md +5 -2
- data/config.reek +2 -0
- data/lib/guard/reek/runner.rb +9 -5
- data/lib/guard/reek/version.rb +3 -3
- data/spec/guard/reek/runner_spec.rb +13 -6
- metadata +27 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e14145294d2397904b31818eca863d6c8d0fc29
|
4
|
+
data.tar.gz: 83f8324385d5faf09c04205d38dcc281eb6564dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed13bded7c1a6889fff97b47abf83b68afed9ba5e2acf795ea13759be9233bd17dfdb8943285a211c4a6eb9e308aeeba72c37a790bdca10e75a60ba677f32e06
|
7
|
+
data.tar.gz: f8ccbff9580d94599e85d772b6bd46762dcc82b869fda20243c2a9f12b1922d5ce4f448f3d9cdbb81cca49f11a1be5008267459e752a768de7f19ef93d3a25fe
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Guardfile
CHANGED
@@ -1,15 +1,10 @@
|
|
1
|
-
guard :rspec do
|
1
|
+
guard :rspec, cmd: 'bundle exec rspec', all_on_start: true do
|
2
2
|
watch(%r{^spec/.+_spec\.rb$})
|
3
3
|
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
4
4
|
watch('spec/spec_helper.rb') { "spec" }
|
5
5
|
end
|
6
6
|
|
7
|
-
guard :
|
8
|
-
watch('
|
9
|
-
watch('guard-reek.gemspec')
|
10
|
-
end
|
11
|
-
|
12
|
-
guard :reek do
|
13
|
-
watch("lib/guard/reek.rb")
|
7
|
+
guard :reek, cli: '--single-line' do
|
8
|
+
watch('config.reek')
|
14
9
|
watch(/^lib\/.*\.rb$/)
|
15
10
|
end
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
[![Gem Version](http://img.shields.io/gem/v/guard-reek.svg)](http://badge.fury.io/rb/guard-reek)
|
2
|
-
[![Build Status](https://travis-ci.org/
|
2
|
+
[![Build Status](https://travis-ci.org/grantspeelman/guard-reek.svg?branch=master)](https://travis-ci.org/grantspeelman/guard-reek)
|
3
3
|
|
4
4
|
# guard-reek
|
5
5
|
|
@@ -44,7 +44,7 @@ Please read the [Guard usage documentation](https://github.com/guard/guard#readm
|
|
44
44
|
You can pass some options in `Guardfile` like the following example:
|
45
45
|
|
46
46
|
```ruby
|
47
|
-
guard :reek, all_on_start: false, run_all: false do
|
47
|
+
guard :reek, all_on_start: false, run_all: false, cli: '--single-line --no-wiki-links' do
|
48
48
|
# ...
|
49
49
|
end
|
50
50
|
```
|
@@ -54,6 +54,9 @@ end
|
|
54
54
|
```
|
55
55
|
all_on_start: true # Check all files at Guard startup.
|
56
56
|
# default: true
|
57
|
+
cli: '--single-line' # Pass arbitrary reek CLI arguments.
|
58
|
+
# An array or string is acceptable.
|
59
|
+
# default: nil
|
57
60
|
run_all: true # Check all files on "Enter"
|
58
61
|
# default: true
|
59
62
|
```
|
data/config.reek
ADDED
data/lib/guard/reek/runner.rb
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
|
3
3
|
module Guard
|
4
4
|
class Reek
|
5
|
-
# This class runs `
|
6
|
-
# An instance of this class is intended to invoke `
|
5
|
+
# This class runs `reek` command, retrieves result and notifies.
|
6
|
+
# An instance of this class is intended to invoke `reek` only once in its lifetime.
|
7
7
|
class Runner
|
8
8
|
attr_reader :notifier, :ui, :result
|
9
9
|
|
10
10
|
def initialize(options)
|
11
|
-
@
|
11
|
+
@cli = options[:cli]
|
12
12
|
@notifier = options[:notifier] || Notifier
|
13
13
|
@ui = options[:ui] || UI
|
14
14
|
end
|
@@ -17,14 +17,18 @@ module Guard
|
|
17
17
|
paths = [] if paths.include?('.reek')
|
18
18
|
ui_message(paths)
|
19
19
|
|
20
|
-
command =
|
21
|
-
@result = system(*command)
|
20
|
+
command = reek_cmd.concat(paths)
|
21
|
+
@result = Kernel.system(*command)
|
22
22
|
|
23
23
|
notify_about_result
|
24
24
|
end
|
25
25
|
|
26
26
|
private
|
27
27
|
|
28
|
+
def reek_cmd
|
29
|
+
['reek', @cli].compact
|
30
|
+
end
|
31
|
+
|
28
32
|
def ui_message(paths)
|
29
33
|
if paths.empty?
|
30
34
|
ui.info('Guard::Reek running on all')
|
data/lib/guard/reek/version.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
3
|
module Guard
|
4
|
-
# A workaround for declaring `class
|
4
|
+
# A workaround for declaring `class Reek`
|
5
5
|
# before `class Reek < Guard` in reek.rb
|
6
6
|
module ReekVersion
|
7
7
|
# http://semver.org/
|
8
8
|
MAJOR = 1
|
9
|
-
MINOR =
|
10
|
-
PATCH =
|
9
|
+
MINOR = 1
|
10
|
+
PATCH = 0
|
11
11
|
|
12
12
|
def self.to_s
|
13
13
|
[MAJOR, MINOR, PATCH].join('.')
|
@@ -3,31 +3,38 @@ require 'spec_helper'
|
|
3
3
|
describe Guard::Reek::Runner do
|
4
4
|
subject { Guard::Reek::Runner.new(options) }
|
5
5
|
let(:options) { { ui: ui, notifier: notifier } }
|
6
|
+
let(:kernel) { class_double('Kernel', system: true) }
|
6
7
|
let(:ui) { class_double('Guard::UI', info: true) }
|
7
8
|
let(:notifier) { class_double('Guard::Notifier', notify: true) }
|
8
9
|
|
9
10
|
before do
|
10
|
-
allow(
|
11
|
+
allow(Kernel).to receive(:system)
|
11
12
|
end
|
12
13
|
|
13
14
|
it 'executes reek' do
|
14
|
-
expect(
|
15
|
+
expect(Kernel).to receive(:system).with('reek')
|
15
16
|
subject.run
|
16
17
|
end
|
17
18
|
|
18
19
|
it 'executes reek with file' do
|
19
|
-
expect(
|
20
|
+
expect(Kernel).to receive(:system).with('reek', 'test.rb')
|
20
21
|
subject.run(['test.rb'])
|
21
22
|
end
|
22
23
|
|
23
24
|
it 'executes reek when .reek updated' do
|
24
|
-
expect(
|
25
|
+
expect(Kernel).to receive(:system).with('reek')
|
25
26
|
subject.run(['.reek'])
|
26
27
|
end
|
27
28
|
|
29
|
+
it 'executes reek with cli options' do
|
30
|
+
options[:cli] = '-s'
|
31
|
+
expect(Kernel).to receive(:system).with('reek', '-s')
|
32
|
+
subject.run
|
33
|
+
end
|
34
|
+
|
28
35
|
context 'when reek exited with 0 status' do
|
29
36
|
before do
|
30
|
-
allow(
|
37
|
+
allow(Kernel).to receive(:system).and_return(true)
|
31
38
|
end
|
32
39
|
|
33
40
|
it 'notifies about success' do
|
@@ -38,7 +45,7 @@ describe Guard::Reek::Runner do
|
|
38
45
|
|
39
46
|
context 'when reek exited with non 0 status' do
|
40
47
|
before do
|
41
|
-
allow(
|
48
|
+
allow(Kernel).to receive(:system).and_return(false)
|
42
49
|
end
|
43
50
|
|
44
51
|
it 'notifies about failure' do
|
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.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grant Petersen-Speelman
|
@@ -9,132 +9,132 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-05-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: reek
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - '>='
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - '>='
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: guard-compat
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ~>
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '1.1'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ~>
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '1.1'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: listen
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - ~>
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: 3.0.8
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - ~>
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 3.0.8
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: bundler
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - ~>
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '1.3'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '1.3'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: guard-rspec
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - '>='
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- -
|
81
|
+
- - '>='
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: guard-bundler
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
88
|
+
- - '>='
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0'
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- -
|
95
|
+
- - '>='
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: simplecov
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
|
-
- -
|
102
|
+
- - '>='
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: '0'
|
105
105
|
type: :development
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
|
-
- -
|
109
|
+
- - '>='
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '0'
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
113
|
name: rspec
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
|
-
- -
|
116
|
+
- - ~>
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: '3.0'
|
119
119
|
type: :development
|
120
120
|
prerelease: false
|
121
121
|
version_requirements: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
|
-
- -
|
123
|
+
- - ~>
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '3.0'
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: rake
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
|
-
- -
|
130
|
+
- - '>='
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '0'
|
133
133
|
type: :development
|
134
134
|
prerelease: false
|
135
135
|
version_requirements: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
|
-
- -
|
137
|
+
- - '>='
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: '0'
|
140
140
|
description: Guard::Reek automatically runs Reek when files change
|
@@ -145,14 +145,15 @@ executables: []
|
|
145
145
|
extensions: []
|
146
146
|
extra_rdoc_files: []
|
147
147
|
files:
|
148
|
-
-
|
149
|
-
-
|
150
|
-
-
|
148
|
+
- .gitignore
|
149
|
+
- .rspec
|
150
|
+
- .travis.yml
|
151
151
|
- Gemfile
|
152
152
|
- Guardfile
|
153
153
|
- LICENSE.txt
|
154
154
|
- README.md
|
155
155
|
- Rakefile
|
156
|
+
- config.reek
|
156
157
|
- guard-reek.gemspec
|
157
158
|
- lib/guard/reek.rb
|
158
159
|
- lib/guard/reek/runner.rb
|
@@ -171,17 +172,17 @@ require_paths:
|
|
171
172
|
- lib
|
172
173
|
required_ruby_version: !ruby/object:Gem::Requirement
|
173
174
|
requirements:
|
174
|
-
- -
|
175
|
+
- - '>='
|
175
176
|
- !ruby/object:Gem::Version
|
176
177
|
version: '0'
|
177
178
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
179
|
requirements:
|
179
|
-
- -
|
180
|
+
- - '>='
|
180
181
|
- !ruby/object:Gem::Version
|
181
182
|
version: '0'
|
182
183
|
requirements: []
|
183
184
|
rubyforge_project:
|
184
|
-
rubygems_version: 2.
|
185
|
+
rubygems_version: 2.6.11
|
185
186
|
signing_key:
|
186
187
|
specification_version: 4
|
187
188
|
summary: Guard plugin for Reek
|