rake_command_filter 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/command_definition.rb +22 -13
- data/lib/rake_command_filter/version.rb +1 -1
- data/lib/rake_command_filter.rb +1 -0
- data/lib/rspec_command_definition.rb +7 -3
- data/lib/rubocop_command_definition.rb +2 -2
- data/lib/scss_lint_command_definition.rb +34 -0
- data/lib/yard_command_definition.rb +2 -2
- data/rake_command_filter.gemspec +1 -0
- data/test_cases/rspec/ok/coverage/.resultset.json +1 -1
- data/test_cases/rspec/ok/coverage/index.html +1 -1
- data/test_cases/scss/fail/fail.css.scss +4 -0
- data/test_cases/scss/ok/ok.css.scss +4 -0
- data/test_cases/yard/fail/doc/YardUndocumented.html +1 -1
- data/test_cases/yard/fail/doc/_index.html +1 -1
- data/test_cases/yard/fail/doc/index.html +1 -1
- data/test_cases/yard/fail/doc/top-level-namespace.html +1 -1
- data/test_cases/yard/ok/doc/YardDocumented.html +1 -1
- data/test_cases/yard/ok/doc/_index.html +1 -1
- data/test_cases/yard/ok/doc/index.html +1 -1
- data/test_cases/yard/ok/doc/top-level-namespace.html +1 -1
- data/test_cases/yard/warn/doc/YardDocumented.html +1 -1
- data/test_cases/yard/warn/doc/_index.html +1 -1
- data/test_cases/yard/warn/doc/index.html +1 -1
- data/test_cases/yard/warn/doc/top-level-namespace.html +1 -1
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6da33db01e0aa28bf058126cf2c218064bc7b23
|
4
|
+
data.tar.gz: 44341e8177e2edcbdc1c4277fbeecf9439a6b82c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1374a9869b8750de1ddd274d868ea42ff7e2fdb16656822e7922bad713af50390d6cec1bce4479f238032b34950a749ea6fde31c7471c754293b3407f3ad06eb
|
7
|
+
data.tar.gz: da1ddebd4327c0cc8cafb97b3985eb6b7dd9d908418e7917ebbaac7a255408323f326c2cdb353a1de53f3f0bebace6150349ef38344bee90e247a6376ec548b4
|
data/README.md
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/rake_command_filter.svg)](https://badge.fury.io/rb/rake_command_filter)
|
1
2
|
[![Build Status](https://travis-ci.org/chrisjones-tripletri/rake_command_filter.svg?branch=master)](https://travis-ci.org/chrisjones-tripletri/rake_command_filter)
|
2
3
|
[![Code Climate](https://codeclimate.com/github/chrisjones-tripletri/rake_command_filter/badges/gpa.svg)](https://codeclimate.com/github/chrisjones-tripletri/rake_command_filter)
|
3
4
|
[![Test Coverage](https://codeclimate.com/github/chrisjones-tripletri/rake_command_filter/badges/coverage.svg)](https://codeclimate.com/github/chrisjones-tripletri/rake_command_filter/coverage)
|
@@ -48,6 +49,9 @@ require 'rake_command_filter'
|
|
48
49
|
|
49
50
|
RakeCommandFilter::RakeTask.new(:full_validation) do
|
50
51
|
desc 'Run full validation'
|
52
|
+
run_definition(RakeCommandFilter::RubocopCommandDefinition.new) do
|
53
|
+
add_parameter('app/assets/stylesheets')
|
54
|
+
end
|
51
55
|
run_definition(RakeCommandFilter::RubocopCommandDefinition.new)
|
52
56
|
run_definition(RakeCommandFilter::RSpecCommandDefinition.new)
|
53
57
|
run_definition(RakeCommandFilter::YardCommandDefinition.new)
|
data/lib/command_definition.rb
CHANGED
@@ -32,6 +32,7 @@ module RakeCommandFilter
|
|
32
32
|
|
33
33
|
# override this method
|
34
34
|
def execute
|
35
|
+
return execute_system(@name)
|
35
36
|
end
|
36
37
|
|
37
38
|
# @return the most severe result from an array of results
|
@@ -44,33 +45,31 @@ module RakeCommandFilter
|
|
44
45
|
worst << result
|
45
46
|
end
|
46
47
|
end
|
47
|
-
worst = result_failure('INTERNAL ERROR: no pattern matched a result in the output') if worst.empty?
|
48
48
|
return worst
|
49
49
|
end
|
50
50
|
|
51
|
-
protected
|
52
|
-
|
53
51
|
# @return a result indicating the command was successful
|
54
|
-
def result_success(msg)
|
52
|
+
def self.result_success(msg)
|
55
53
|
create_result(RakeCommandFilter::MATCH_SUCCESS, msg)
|
56
54
|
end
|
57
55
|
|
58
56
|
# @return a result indicating the command failed.
|
59
|
-
def result_failure(msg)
|
57
|
+
def self.result_failure(msg)
|
60
58
|
create_result(RakeCommandFilter::MATCH_FAILURE, msg)
|
61
59
|
end
|
62
60
|
|
63
61
|
# @return a result indicating the command showed a warning.
|
64
|
-
def result_warning(msg)
|
62
|
+
def self.result_warning(msg)
|
65
63
|
create_result(RakeCommandFilter::MATCH_WARNING, msg)
|
66
64
|
end
|
67
65
|
|
68
|
-
|
69
|
-
|
70
|
-
def create_result(result, msg)
|
66
|
+
# used to create a result with the specified result code and msg
|
67
|
+
def self.create_result(result, msg)
|
71
68
|
LineFilterResult.new(@name, result, msg)
|
72
69
|
end
|
73
70
|
|
71
|
+
private
|
72
|
+
|
74
73
|
def execute_system(command)
|
75
74
|
saved_lines = []
|
76
75
|
results = []
|
@@ -100,12 +99,11 @@ module RakeCommandFilter
|
|
100
99
|
end
|
101
100
|
|
102
101
|
def output_results(results, saved_lines, command_start)
|
102
|
+
results << create_default_result if results.empty?
|
103
103
|
worst_results = CommandDefinition.find_worst_result(results)
|
104
|
+
|
104
105
|
# if the lines
|
105
|
-
|
106
|
-
@default_line_handling == RakeCommandFilter::LINE_HANDLING_HIDE_UNTIL_ERROR
|
107
|
-
print_lines(saved_lines)
|
108
|
-
end
|
106
|
+
output_lines(worst_results, saved_lines)
|
109
107
|
unless @default_line_handling == RakeCommandFilter::LINE_HANDLING_HIDE_ALWAYS
|
110
108
|
worst_results.each do |result|
|
111
109
|
result.output(Time.now - command_start) unless result.result == RakeCommandFilter::MATCH_WARNING
|
@@ -113,6 +111,17 @@ module RakeCommandFilter
|
|
113
111
|
end
|
114
112
|
end
|
115
113
|
|
114
|
+
def output_lines(worst_results, saved_lines)
|
115
|
+
if worst_results[0].result != RakeCommandFilter::MATCH_SUCCESS &&
|
116
|
+
@default_line_handling == RakeCommandFilter::LINE_HANDLING_HIDE_UNTIL_ERROR
|
117
|
+
print_lines(saved_lines)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def create_default_result
|
122
|
+
CommandDefinition.result_failure('INTERNAL ERROR: no pattern matched a result in the output')
|
123
|
+
end
|
124
|
+
|
116
125
|
def match_line(line, results)
|
117
126
|
result = process_filters(line)
|
118
127
|
results << result if result
|
data/lib/rake_command_filter.rb
CHANGED
@@ -9,6 +9,7 @@ require_relative './rake_command_definition'
|
|
9
9
|
require_relative './rubocop_command_definition'
|
10
10
|
require_relative './rspec_command_definition'
|
11
11
|
require_relative './yard_command_definition'
|
12
|
+
require_relative './scss_lint_command_definition'
|
12
13
|
require_relative './command_failed_error'
|
13
14
|
|
14
15
|
# A rake task that filters the output of other rake tasks so you can see
|
@@ -31,9 +31,9 @@ module RakeCommandFilter
|
|
31
31
|
add_filter(:rspec_filter, /(\d+)\s+example[s]?,\s+(\d+)\s+failure/) do |matches|
|
32
32
|
failures = matches[1].to_i
|
33
33
|
if failures > 0
|
34
|
-
result_failure(RSpecCommandDefinition.failure_msg(failures))
|
34
|
+
CommandDefinition.result_failure(RSpecCommandDefinition.failure_msg(failures))
|
35
35
|
else
|
36
|
-
result_success(RSpecCommandDefinition.success_msg(matches[0]))
|
36
|
+
CommandDefinition.result_success(RSpecCommandDefinition.success_msg(matches[0]))
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
@@ -42,7 +42,11 @@ module RakeCommandFilter
|
|
42
42
|
add_filter(:simplecov_filter, /Coverage.+LOC\s+\((\d+[\.]?\d+)%/) do |matches|
|
43
43
|
percent = matches[0].to_f
|
44
44
|
msg = RSpecCommandDefinition.coverage_msg(percent)
|
45
|
-
|
45
|
+
if percent >= coverage_threshold
|
46
|
+
CommandDefinition.result_success(msg)
|
47
|
+
else
|
48
|
+
CommandDefinition.result_failure(msg)
|
49
|
+
end
|
46
50
|
end
|
47
51
|
end
|
48
52
|
end
|
@@ -18,11 +18,11 @@ module RakeCommandFilter
|
|
18
18
|
|
19
19
|
# just use sensible defaults here.
|
20
20
|
add_filter(:offenses_filter, /(\d+)\s+file.*,\s+(\d+)\s+offense/) do |matches|
|
21
|
-
result_failure(RubocopCommandDefinition.failure_msg(matches[1], matches[0]))
|
21
|
+
CommandDefinition.result_failure(RubocopCommandDefinition.failure_msg(matches[1], matches[0]))
|
22
22
|
end
|
23
23
|
|
24
24
|
add_filter(:no_offenses_filter, /(\d+)\s+file.*,\s+no\s+offenses/) do |matches|
|
25
|
-
result_success(RubocopCommandDefinition.success_msg(matches[0]))
|
25
|
+
CommandDefinition.result_success(RubocopCommandDefinition.success_msg(matches[0]))
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module RakeCommandFilter
|
2
|
+
# default way to run rubocop and parse its output
|
3
|
+
class ScssLintCommandDefinition < CommandDefinition
|
4
|
+
# for testing
|
5
|
+
def self.warning_msg
|
6
|
+
'One or more scss warnings, see above'
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.error_msg
|
10
|
+
'One or more scss errors, see above'
|
11
|
+
end
|
12
|
+
|
13
|
+
# Default parser for scss lint output.
|
14
|
+
# @param id override this if you want to do something other than 'scss-lint'
|
15
|
+
def initialize(id = 'scss-lint')
|
16
|
+
super(id)
|
17
|
+
# just use sensible defaults here.
|
18
|
+
add_filter(:scss_error, /(.*\[(.)\].*)/) do |matches|
|
19
|
+
kind = matches[1]
|
20
|
+
if kind == 'W'
|
21
|
+
CommandDefinition.result_warning(ScssLintCommandDefinition.warning_msg)
|
22
|
+
else
|
23
|
+
CommandDefinition.result_failure(ScssLintCommandDefinition.error_msg)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
protected
|
29
|
+
|
30
|
+
def create_default_result
|
31
|
+
CommandDefinition.result_success('No errors.')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -22,10 +22,10 @@ module RakeCommandFilter
|
|
22
22
|
add_filter(:yard_percentage, /(\d+.?\d+)%\s+document/) do |matches|
|
23
23
|
percent = matches[0].to_f
|
24
24
|
msg = YardCommandDefinition.percent_msg(percent)
|
25
|
-
(percent >= threshold) ? result_success(msg) : result_failure(msg)
|
25
|
+
(percent >= threshold) ? CommandDefinition.result_success(msg) : CommandDefinition.result_failure(msg)
|
26
26
|
end
|
27
27
|
add_filter(:yard_warning, /\[warn\]:(.*)/) do |_matches|
|
28
|
-
result_warning(YardCommandDefinition.warning_msg)
|
28
|
+
CommandDefinition.result_warning(YardCommandDefinition.warning_msg)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
data/rake_command_filter.gemspec
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
<img src="./assets/0.10.0/loading.gif" alt="loading"/>
|
15
15
|
</div>
|
16
16
|
<div id="wrapper" style="display:none;">
|
17
|
-
<div class="timestamp">Generated <abbr class="timeago" title="2016-02-
|
17
|
+
<div class="timestamp">Generated <abbr class="timeago" title="2016-02-12T09:43:22-06:00">2016-02-12T09:43:22-06:00</abbr></div>
|
18
18
|
<ul class="group_tabs"></ul>
|
19
19
|
|
20
20
|
<div id="content">
|
@@ -297,7 +297,7 @@
|
|
297
297
|
</div>
|
298
298
|
|
299
299
|
<div id="footer">
|
300
|
-
Generated on
|
300
|
+
Generated on Fri Feb 12 09:43:19 2016 by
|
301
301
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
302
302
|
0.8.7.6 (ruby-2.2.3).
|
303
303
|
</div>
|
@@ -103,7 +103,7 @@
|
|
103
103
|
</div>
|
104
104
|
|
105
105
|
<div id="footer">
|
106
|
-
Generated on
|
106
|
+
Generated on Fri Feb 12 09:43:19 2016 by
|
107
107
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
108
108
|
0.8.7.6 (ruby-2.2.3).
|
109
109
|
</div>
|
@@ -334,7 +334,7 @@
|
|
334
334
|
</div>
|
335
335
|
|
336
336
|
<div id="footer">
|
337
|
-
Generated on
|
337
|
+
Generated on Fri Feb 12 09:43:20 2016 by
|
338
338
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
339
339
|
0.8.7.6 (ruby-2.2.3).
|
340
340
|
</div>
|
@@ -103,7 +103,7 @@
|
|
103
103
|
</div>
|
104
104
|
|
105
105
|
<div id="footer">
|
106
|
-
Generated on
|
106
|
+
Generated on Fri Feb 12 09:43:20 2016 by
|
107
107
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
108
108
|
0.8.7.6 (ruby-2.2.3).
|
109
109
|
</div>
|
@@ -334,7 +334,7 @@
|
|
334
334
|
</div>
|
335
335
|
|
336
336
|
<div id="footer">
|
337
|
-
Generated on
|
337
|
+
Generated on Fri Feb 12 09:43:25 2016 by
|
338
338
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
339
339
|
0.8.7.6 (ruby-2.2.3).
|
340
340
|
</div>
|
@@ -103,7 +103,7 @@
|
|
103
103
|
</div>
|
104
104
|
|
105
105
|
<div id="footer">
|
106
|
-
Generated on
|
106
|
+
Generated on Fri Feb 12 09:43:25 2016 by
|
107
107
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
108
108
|
0.8.7.6 (ruby-2.2.3).
|
109
109
|
</div>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake_command_filter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Jones
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: scss-lint
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
125
139
|
description: Runs several rake tasks or system commands, and filters their output
|
126
140
|
for easy review
|
127
141
|
email:
|
@@ -151,6 +165,7 @@ files:
|
|
151
165
|
- lib/rake_command_filter/version.rb
|
152
166
|
- lib/rspec_command_definition.rb
|
153
167
|
- lib/rubocop_command_definition.rb
|
168
|
+
- lib/scss_lint_command_definition.rb
|
154
169
|
- lib/yard_command_definition.rb
|
155
170
|
- rake_command_filter.gemspec
|
156
171
|
- test_cases/rspec/fail/coverage/.last_run.json
|
@@ -215,6 +230,8 @@ files:
|
|
215
230
|
- test_cases/rubocop/fail/rubocop_fail.rb
|
216
231
|
- test_cases/rubocop/ok/rubocop_ok.rb
|
217
232
|
- test_cases/rubocop/rubocop.yml
|
233
|
+
- test_cases/scss/fail/fail.css.scss
|
234
|
+
- test_cases/scss/ok/ok.css.scss
|
218
235
|
- test_cases/yard/.yardoc/checksums
|
219
236
|
- test_cases/yard/.yardoc/object_types
|
220
237
|
- test_cases/yard/.yardoc/objects/root.dat
|