preek 1.4.3 → 1.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0381b8f7518b3ec3a5007118bc49aebb0c1ad448
4
- data.tar.gz: 4908aa1896f8b21d66eb98682256a7bec1ba575a
3
+ metadata.gz: c585c8febf862238a426fd347775911454140bbb
4
+ data.tar.gz: e1ec29fbab5d972d84a4abf5731cd815cd1d2e83
5
5
  SHA512:
6
- metadata.gz: 3e4f7564855597775457f785c52f4613249501bf6c8044c50353f147cffe27fbd9105e60c93a57385436b65d8680cb86dcbff846ab7a87c3d8563174742842f4
7
- data.tar.gz: 2ea27c77c1937cc9a55a38e2dfce367a4e4f73f8fe1bccf33b8a3aaac947c5b97b63b1f6125307783a97e4adbcb4720b4da23a35530ad5cb26f8f21dfe982803
6
+ metadata.gz: fa32eff70b87f0f4ebfa3ff282ed72399d15192fb537b403163c75f284f3486f4001a82d5631f40f33c8581068a6a91823bf8723ec101742fe928170007a4ed2
7
+ data.tar.gz: 52f8ef1a293c65142a1d834e499a581d91f505f1dc9d81c56c5895f33b5183c93a431ed51ae807b49014b21c2e842164935c1cb8ff523b5499e695b590768883
@@ -2,6 +2,7 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
+ - 2.1.0
5
6
  - jruby-19mode
6
7
  branches:
7
8
  only:
@@ -13,9 +13,11 @@ module Preek
13
13
 
14
14
  def perform
15
15
  examine_and_report
16
- report_totals if totals_to_report?
17
- @output.print_line
18
- report_non_existing if non_existing_files?
16
+ @output.separated do
17
+ report_success if report_success?
18
+ report_total_smells unless success?
19
+ report_non_existing if non_existing_files?
20
+ end
19
21
  end
20
22
 
21
23
  private
@@ -34,19 +36,24 @@ module Preek
34
36
  end
35
37
  end
36
38
 
37
- def totals_to_report?
38
- return false if @reporter.verbose? || @sources.count == 0
39
+ def success?
39
40
  @total_smells == 0
40
41
  end
41
42
 
42
- def report_totals
43
- @output.print_line
43
+ def report_success?
44
+ !@reporter.verbose? && @sources.count > 0 && success?
45
+ end
46
+
47
+ def report_success
44
48
  @output.green :success, %(No smells detected)
45
49
  end
46
50
 
51
+ def report_total_smells
52
+ @output.red :total, @total_smells
53
+ end
54
+
47
55
  def report_non_existing
48
56
  @output.red :error, %{No such file(s) - #{non_existing_files.join(', ')}.\n}
49
- @output.print_line
50
57
  end
51
58
 
52
59
  def existing_files
@@ -9,6 +9,8 @@ module Preek
9
9
  say "\n\t#{'-'*60}\n\n"
10
10
  end
11
11
 
12
+ alias :separator :print_line
13
+
12
14
  def blue(*args)
13
15
  status *args, :blue
14
16
  end
@@ -20,6 +22,12 @@ module Preek
20
22
  def red(*args)
21
23
  status *args, :red
22
24
  end
25
+
26
+ def separated(&block)
27
+ print_line
28
+ yield
29
+ print_line
30
+ end
23
31
  end
24
32
 
25
33
  class CompactOutput < Output
@@ -32,5 +40,6 @@ module Preek
32
40
  def print_line
33
41
  say "\n-\n\n"
34
42
  end
43
+ alias :separator :print_line
35
44
  end
36
45
  end
@@ -1,3 +1,3 @@
1
1
  module Preek
2
- VERSION = "1.4.3"
2
+ VERSION = "1.5.0"
3
3
  end
@@ -4,8 +4,8 @@ require File.expand_path('../lib/preek/version', __FILE__)
4
4
  Gem::Specification.new do |gem|
5
5
  gem.authors = ["Jon Neverland"]
6
6
  gem.email = ["jonwestin@gmail.com"]
7
- gem.description = %q{Gives a nice, colorful output to Reek. Based on Thor.}
8
- gem.summary = %q{It might reek but its pretty}
7
+ gem.description = %q{Preek prints Ruby code smells in color, using Reek. }
8
+ gem.summary = %q{Code smells in color}
9
9
  gem.homepage = "https://github.com/joenas/preek"
10
10
  gem.license = 'MIT'
11
11
 
@@ -68,7 +68,7 @@ describe Preek::CLI do
68
68
  Then{output.should_not include(args[0])}
69
69
  end
70
70
 
71
- context "when given file has no smells" do
71
+ context "when given file has no smells and the other does not exist" do
72
72
  Given(:args){ [test_file('non_smelly'), 'i/am/not/a_file'] }
73
73
  Then{output.should include("No smells")}
74
74
  Then{output.should_not include(args[0])}
@@ -86,6 +86,10 @@ describe Preek::CLI do
86
86
  Given(:args){ [test_file('two_smelly_classes')] }
87
87
  Then{output.should include('SecondSmelly')}
88
88
  Then{output.should include('UncommunicativeMethodName')}
89
+
90
+ describe 'total count' do
91
+ Then{output.should match(/total.*1/)}
92
+ end
89
93
  end
90
94
 
91
95
  context "when given two smelly files" do
@@ -93,6 +97,10 @@ describe Preek::CLI do
93
97
  Then{output.should include('UncommunicativeMethodName', 'TooManyStatements')}
94
98
  Then{output.should include(args[0], args[1])}
95
99
  Then{output.should include("#loong_method", "#x")}
100
+
101
+ describe 'total count' do
102
+ Then{output.should match(/total.*2/)}
103
+ end
96
104
  end
97
105
 
98
106
  context "when given one file without smells and another with smells" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: preek
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Neverland
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-29 00:00:00.000000000 Z
11
+ date: 2014-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -108,7 +108,7 @@ dependencies:
108
108
  - - '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
- description: Gives a nice, colorful output to Reek. Based on Thor.
111
+ description: 'Preek prints Ruby code smells in color, using Reek. '
112
112
  email:
113
113
  - jonwestin@gmail.com
114
114
  executables:
@@ -165,10 +165,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
165
  version: '0'
166
166
  requirements: []
167
167
  rubyforge_project:
168
- rubygems_version: 2.0.3
168
+ rubygems_version: 2.2.1
169
169
  signing_key:
170
170
  specification_version: 4
171
- summary: It might reek but its pretty
171
+ summary: Code smells in color
172
172
  test_files:
173
173
  - spec/capture_helper.rb
174
174
  - spec/cli_spec.rb