preek 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/README.md +2 -1
- data/lib/preek/cli.rb +7 -2
- data/lib/preek/version.rb +1 -1
- data/preek.gemspec +3 -3
- data/spec/cli_spec.rb +12 -2
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc66d75c60afea8fc34f0ab395268d29698ff0fd
|
4
|
+
data.tar.gz: 2cd1af5168dd19c51340767e057311ec93e2b998
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22fe8c9460bb5a087ebff9ba5c28df2bdc92094b332620e4553839138969dd517e213ce535c832961a255039e559d974e84edd765707feac1da5cbd5643b2307
|
7
|
+
data.tar.gz: 278da11c18cf1fa2424123cd846ff8dd4f4ba287fef7765dac0d42256ce6ddc100d52887a31776e45379a448a13d0ccea10519634b0927bdf3832c4815dabed5
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -8,7 +8,8 @@
|
|
8
8
|
# Preek
|
9
9
|
|
10
10
|
For a pretty colorful output of [Reek](https://github.com/troessner/reek), which is an awesome gem!
|
11
|
-
This is just something I came up with while learning [Thor](https://github.com/wycats/thor).
|
11
|
+
This is just something I came up with while learning [Thor](https://github.com/wycats/thor).
|
12
|
+
To make your refactoring life easier you can also use [Guard::Preek](https://github.com/joenas/guard-preek)!
|
12
13
|
|
13
14
|
## Installation
|
14
15
|
|
data/lib/preek/cli.rb
CHANGED
@@ -38,14 +38,19 @@ module Preek
|
|
38
38
|
|
39
39
|
desc 'git', 'Run Preek on git changes'
|
40
40
|
def git
|
41
|
-
files =
|
41
|
+
files = git_status
|
42
42
|
if $?.exitstatus == 0 && !files.empty?
|
43
|
-
args = files.scan(/[ M?]+
|
43
|
+
args = files.scan(/[ M?]+(.*\.rb)/)
|
44
44
|
smell *args.flatten
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
48
|
private
|
49
|
+
|
50
|
+
def git_status
|
51
|
+
`git status -s`
|
52
|
+
end
|
53
|
+
|
49
54
|
def reporter
|
50
55
|
options[:verbose] ? VerboseReport : QuietReport
|
51
56
|
end
|
data/lib/preek/version.rb
CHANGED
data/preek.gemspec
CHANGED
@@ -18,9 +18,9 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.version = Preek::VERSION
|
19
19
|
gem.add_runtime_dependency "thor", "~> 0.18"
|
20
20
|
gem.add_runtime_dependency "reek", "~> 1.3.3"
|
21
|
-
gem.add_development_dependency "rspec", "
|
21
|
+
gem.add_development_dependency "rspec", "~> 2.14.1"
|
22
22
|
gem.add_development_dependency "rspec-given"
|
23
|
-
gem.add_development_dependency "guard", "
|
24
|
-
gem.add_development_dependency "guard-rspec", "
|
23
|
+
gem.add_development_dependency "guard", "~> 2.3.0"
|
24
|
+
gem.add_development_dependency "guard-rspec", "~> 4.2.5"
|
25
25
|
gem.add_development_dependency 'coveralls'
|
26
26
|
end
|
data/spec/cli_spec.rb
CHANGED
@@ -9,8 +9,6 @@ describe Preek::CLI do
|
|
9
9
|
File.expand_path(File.join(File.dirname(__FILE__),'test_files/',"#{file_name}.rb"))
|
10
10
|
end
|
11
11
|
|
12
|
-
When(:output) { capture(:stdout) { Preek::CLI.start args } }
|
13
|
-
|
14
12
|
describe 'Commands' do
|
15
13
|
|
16
14
|
context 'errors' do
|
@@ -28,6 +26,7 @@ describe Preek::CLI do
|
|
28
26
|
end
|
29
27
|
|
30
28
|
context 'no errors' do
|
29
|
+
When(:output) { capture(:stdout) { Preek::CLI.start args } }
|
31
30
|
|
32
31
|
context 'with "smell" and a file as argument' do
|
33
32
|
Given(:args){ ['smell', test_file('non_smelly')] }
|
@@ -59,6 +58,7 @@ describe Preek::CLI do
|
|
59
58
|
end
|
60
59
|
|
61
60
|
describe "Reports" do
|
61
|
+
When(:output) { capture(:stdout) { Preek::CLI.start args } }
|
62
62
|
|
63
63
|
context 'default quiet report' do
|
64
64
|
|
@@ -158,4 +158,14 @@ describe Preek::CLI do
|
|
158
158
|
end
|
159
159
|
end
|
160
160
|
end
|
161
|
+
|
162
|
+
describe 'Git' do
|
163
|
+
Given(:cli) { Preek::CLI.new }
|
164
|
+
Given(:git_output){" M .travis.yml\n M Gemfile\n M lib/random/file.rb\n M preek.gemspec\n"}
|
165
|
+
Given{cli.stub(:git_status).and_return(git_output)}
|
166
|
+
Given{cli.should_receive(:smell).with('lib/random/file.rb')}
|
167
|
+
|
168
|
+
When{cli.git}
|
169
|
+
Then{}
|
170
|
+
end
|
161
171
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: preek
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Neverland
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 2.14.1
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 2.14.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec-given
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,30 +70,30 @@ dependencies:
|
|
70
70
|
name: guard
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ~>
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 2.3.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ~>
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 2.3.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: guard-rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ~>
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 4.2.5
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ~>
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 4.2.5
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: coveralls
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|