simplabs-excellent 1.4.0 → 1.4.1
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/History.txt +4 -0
- data/VERSION.yml +1 -1
- data/lib/simplabs/excellent.rb +1 -1
- data/lib/simplabs/excellent/rake.rb +1 -0
- data/lib/simplabs/excellent/rake/excellent_task.rb +65 -0
- metadata +3 -1
data/History.txt
CHANGED
data/VERSION.yml
CHANGED
data/lib/simplabs/excellent.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
require 'simplabs/excellent/rake/excellent_task'
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'rake'
|
2
|
+
|
3
|
+
module Simplabs
|
4
|
+
|
5
|
+
module Excellent
|
6
|
+
|
7
|
+
module Rake
|
8
|
+
|
9
|
+
# A custom rake task for Excellent.
|
10
|
+
class ExcellentTask < ::Rake::TaskLib
|
11
|
+
|
12
|
+
# The Name of the task, defaults to :excellent.
|
13
|
+
attr_accessor :name
|
14
|
+
|
15
|
+
# The format to use for the output. This is either html:<filename> or nothing
|
16
|
+
attr_reader :format
|
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
|
20
|
+
|
21
|
+
# Initializes an ExcellentTask with the name +name+.
|
22
|
+
def initialize(name = :excellent)
|
23
|
+
@name = name
|
24
|
+
@paths = nil || []
|
25
|
+
@format = nil
|
26
|
+
yield self if block_given?
|
27
|
+
define
|
28
|
+
end
|
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
|
+
def paths=(paths) #:nodoc:
|
39
|
+
if paths.is_a?(String)
|
40
|
+
@paths = [paths]
|
41
|
+
elsif paths.is_a?(Array)
|
42
|
+
@paths = paths
|
43
|
+
else
|
44
|
+
raise ArgumentError.new('Specify paths either as a String or as an Array!')
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
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?
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
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.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marco Otte-Witte
|
@@ -106,6 +106,8 @@ files:
|
|
106
106
|
- lib/simplabs/excellent/parsing/until_context.rb
|
107
107
|
- lib/simplabs/excellent/parsing/while_context.rb
|
108
108
|
- lib/simplabs/excellent/parsing.rb
|
109
|
+
- lib/simplabs/excellent/rake/excellent_task.rb
|
110
|
+
- lib/simplabs/excellent/rake.rb
|
109
111
|
- lib/simplabs/excellent/runner.rb
|
110
112
|
- lib/simplabs/excellent/warning.rb
|
111
113
|
- lib/simplabs/excellent.rb
|