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 +1 -1
- data/lib/simplabs/excellent.rb +1 -1
- data/lib/simplabs/excellent/rake/excellent_task.rb +22 -27
- data/lib/simplabs/excellent/runner.rb +1 -1
- metadata +1 -1
data/VERSION.yml
CHANGED
data/lib/simplabs/excellent.rb
CHANGED
|
@@ -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
|
|
9
|
+
# A special rake task for Excellent.
|
|
10
10
|
class ExcellentTask < ::Rake::TaskLib
|
|
11
11
|
|
|
12
|
-
# The Name of the task, defaults to
|
|
12
|
+
# The Name of the task, defaults to <tt>:excellent</tt>.
|
|
13
13
|
attr_accessor :name
|
|
14
14
|
|
|
15
|
-
#
|
|
16
|
-
|
|
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
|
|
19
|
-
|
|
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
|
|
24
|
-
@paths
|
|
25
|
-
@
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
|
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
|