simplabs-excellent 1.4.1 → 1.4.2

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.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 1
3
3
  :minor: 4
4
- :patch: 1
4
+ :patch: 2
@@ -9,7 +9,7 @@ module Simplabs #:nodoc:
9
9
 
10
10
  module Excellent #:nodoc:
11
11
 
12
- VERSION = '1.4.1'
12
+ VERSION = '1.4.2'
13
13
 
14
14
  end
15
15
 
@@ -4,37 +4,29 @@ module Simplabs
4
4
 
5
5
  module Excellent
6
6
 
7
- module Rake
7
+ module Rake #:nodoc:
8
8
 
9
- # A custom rake task for Excellent.
9
+ # A special rake task for Excellent.
10
10
  class ExcellentTask < ::Rake::TaskLib
11
11
 
12
- # The Name of the task, defaults to :excellent.
12
+ # The Name of the task, defaults to <tt>:excellent</tt>.
13
13
  attr_accessor :name
14
14
 
15
- # The format to use for the output. This is either html:<filename> or nothing
16
- attr_reader :format
15
+ # Specifies whether to output HTML; defaults to false. Assign a file name to output HTML to that file.
16
+ attr_accessor :html
17
17
 
18
- # The paths to process (specify file names or directories; will recursively process all ruby files if a directory are given).
19
- attr_reader :paths
18
+ # The paths to process (specify file names or directories; will recursively process all ruby files if a directory is given).
19
+ attr_accessor :paths
20
20
 
21
21
  # Initializes an ExcellentTask with the name +name+.
22
22
  def initialize(name = :excellent)
23
- @name = name
24
- @paths = nil || []
25
- @format = nil
23
+ @name = name
24
+ @paths = nil || []
25
+ @html = false
26
26
  yield self if block_given?
27
27
  define
28
28
  end
29
29
 
30
- def format=(format) #:nodoc:
31
- if format =~ /html:[^\s]+/
32
- @format = format
33
- else
34
- raise ArgumentError.new("Invalid format #{format}; only 'html:<filename>' is currently supported!")
35
- end
36
- end
37
-
38
30
  def paths=(paths) #:nodoc:
39
31
  if paths.is_a?(String)
40
32
  @paths = [paths]
@@ -45,16 +37,19 @@ module Simplabs
45
37
  end
46
38
  end
47
39
 
48
- def define
49
- unless ::Rake.application.last_comment
50
- desc 'Analyse the code with Excellent'
51
- end
52
- task name do
53
- paths = @paths.join(' ')
54
- system("excellent #{@format} #{paths}")
55
- $stdout.puts("Wrote result to #{@format.split(':').last}") unless @format.blank?
40
+ private
41
+
42
+ def define
43
+ unless ::Rake.application.last_comment
44
+ desc 'Analyse the code with Excellent'
45
+ end
46
+ task name do
47
+ paths = @paths.join(' ')
48
+ format = @html ? " html:#{@html}" : ''
49
+ system("excellent#{format} #{paths}")
50
+ $stdout.puts("\nWrote Excellent result to #{@html}\n\n") if @html
51
+ end
56
52
  end
57
- end
58
53
 
59
54
  end
60
55
 
@@ -82,7 +82,7 @@ module Simplabs
82
82
  #
83
83
  # ==== Parameters
84
84
  #
85
- # * <tt>paths</tt> - The paths to process (specify file names or directories; will recursively process all ruby files if a directory are given).
85
+ # * <tt>paths</tt> - The paths to process (specify file names or directories; will recursively process all ruby files if a directory is given).
86
86
  # * <tt>formatter</tt> - The formatter to use. If a formatter is specified, its +start+, +file+, +warning+ and +end+ methods will be called
87
87
  def check_paths(paths, formatter = nil)
88
88
  formatter.start if formatter
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplabs-excellent
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Otte-Witte