cuporter 0.2.8 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +4 -2
- data/Rakefile +1 -1
- data/bin/cuporter +2 -2
- data/lib/cuporter/formatter/{csv.rb → csv_text_methods.rb} +1 -2
- data/lib/cuporter/formatter/html_node_writer.rb +6 -6
- data/lib/cuporter/formatter/name_report/csv.rb +12 -0
- data/lib/cuporter/formatter/{name_report_html.rb → name_report/html.rb} +18 -16
- data/lib/cuporter/formatter/name_report/html_node_writer.rb +18 -0
- data/lib/cuporter/formatter/name_report/text.rb +16 -0
- data/lib/cuporter/formatter/name_report/text_node_writer.rb +16 -0
- data/lib/cuporter/formatter/{text.rb → pretty_text_methods.rb} +3 -5
- data/lib/cuporter/formatter/tag_report/csv.rb +12 -0
- data/lib/cuporter/formatter/{tag_report_html.rb → tag_report/html.rb} +9 -7
- data/lib/cuporter/formatter/tag_report/html_node_writer.rb +19 -0
- data/lib/cuporter/formatter/tag_report/text.rb +14 -0
- data/lib/cuporter/formatter/tag_report/text_node_writer.rb +17 -0
- data/lib/cuporter/formatter/text_methods.rb +0 -7
- data/lib/cuporter/formatter/writer.rb +12 -8
- data/lib/cuporter/node.rb +0 -9
- data/lib/cuporter/report/name_report.rb +1 -1
- data/lib/cuporter/report/report.rb +4 -5
- data/lib/cuporter/report/tag_report.rb +0 -1
- data/lib/cuporter/tag_list_node.rb +9 -0
- data/lib/cuporter.rb +12 -4
- metadata +16 -8
data/README.textile
CHANGED
@@ -5,11 +5,13 @@ Scrapes your feature files and shows 2 possible reports:
|
|
5
5
|
# scenarios and examples per tag
|
6
6
|
** in Feature and Scenario Outline context, as appropriate
|
7
7
|
** sorted alphbetically
|
8
|
-
** optionally numbered
|
8
|
+
** optionally numbered*, counting scenarios and outline examples per tag
|
9
9
|
# feature, scenario and example names
|
10
10
|
** may be filtered by tags, using same CLI syntax as Cucumber
|
11
11
|
** sorted alphbetically
|
12
|
-
** optionally numbered
|
12
|
+
** optionally numbered*, using 1 count of all scenarios and outline examples for the report
|
13
|
+
|
14
|
+
<notextile>*</notextile> _HTML reports are always numbered._
|
13
15
|
|
14
16
|
Either report may be formatted in HTML, CSV, or Pretty Text.
|
15
17
|
|
data/Rakefile
CHANGED
data/bin/cuporter
CHANGED
@@ -7,11 +7,11 @@ filter_args = Cuporter::CLI::FilterArgsBuilder.new(Cuporter::CLI::Options[:tags]
|
|
7
7
|
|
8
8
|
report = Cuporter::Report.create(Cuporter::CLI::Options[:report],
|
9
9
|
Cuporter::CLI::Options[:input_file] || Cuporter::CLI::Options[:input_dir],
|
10
|
-
Cuporter::CLI::Options[:numbers],
|
11
10
|
filter_args,
|
12
11
|
Cuporter::CLI::Options[:title])
|
13
12
|
|
14
13
|
formatter = Cuporter::Formatter::Writer.create(Cuporter::CLI::Options[:format],
|
15
14
|
report,
|
16
|
-
Cuporter::CLI::Options[:output]
|
15
|
+
Cuporter::CLI::Options[:output],
|
16
|
+
Cuporter::CLI::Options[:numbers])
|
17
17
|
formatter.write
|
@@ -12,13 +12,13 @@ module Cuporter
|
|
12
12
|
@builder = Builder::XmlMarkup.new
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
def write_nodes(report, number_scenarios)
|
16
|
+
report.report_node.number_all_descendants if number_scenarios
|
17
|
+
report.report_node.children.each do |child_node|
|
18
|
+
write_node(child_node)
|
19
|
+
end
|
20
|
+
builder
|
18
21
|
end
|
19
|
-
builder
|
20
|
-
end
|
21
|
-
|
22
22
|
def write_node(node)
|
23
23
|
builder.li(:class => node_class(node.name)) do
|
24
24
|
write_node_name(node)
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Copyright 2010 ThoughtWorks, Inc. Licensed under the MIT License
|
2
|
+
module Cuporter
|
3
|
+
module Formatter
|
4
|
+
module NameReport
|
5
|
+
class Csv < Writer
|
6
|
+
include TextMethods
|
7
|
+
include CsvTextMethods
|
8
|
+
include Cuporter::Formatter::NameReport::TextNodeWriter
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -4,25 +4,26 @@ require 'erb'
|
|
4
4
|
|
5
5
|
module Cuporter
|
6
6
|
module Formatter
|
7
|
-
|
8
|
-
|
7
|
+
module NameReport
|
8
|
+
class Html < Writer
|
9
|
+
include HtmlMethods
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
def title
|
12
|
+
@report.title
|
13
|
+
end
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
15
|
+
def filter_summary
|
16
|
+
return if @report.filter.empty?
|
17
|
+
builder = Builder::XmlMarkup.new
|
18
|
+
builder.div(:id => :filter_summary) do |div|
|
19
|
+
div.p("Filtering:")
|
20
|
+
div.p("Include: #{@report.filter.all.join(' AND ')}") unless @report.filter.all.empty?
|
21
|
+
div.p("Include: #{@report.filter.any.join(' OR ')}") unless @report.filter.any.empty?
|
22
|
+
div.p("Exclude: #{@report.filter.none.join(', ')}") unless @report.filter.none.empty?
|
23
|
+
end
|
22
24
|
end
|
23
|
-
end
|
24
25
|
|
25
|
-
|
26
|
+
RHTML = %{
|
26
27
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
27
28
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
28
29
|
<head>
|
@@ -50,13 +51,14 @@ module Cuporter
|
|
50
51
|
</div>
|
51
52
|
</div>
|
52
53
|
<ul class="tag_list, name_report">
|
53
|
-
<%= HtmlNodeWriter.new.write_nodes(@report
|
54
|
+
<%= Cuporter::Formatter::NameReport::HtmlNodeWriter.new.write_nodes(@report)%>
|
54
55
|
</ul>
|
55
56
|
</body>
|
56
57
|
</html>
|
57
58
|
}
|
58
59
|
|
59
60
|
|
61
|
+
end
|
60
62
|
end
|
61
63
|
end
|
62
64
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Copyright 2010 ThoughtWorks, Inc. Licensed under the MIT License
|
2
|
+
|
3
|
+
module Cuporter
|
4
|
+
module Formatter
|
5
|
+
module NameReport
|
6
|
+
class HtmlNodeWriter < Cuporter::Formatter::HtmlNodeWriter
|
7
|
+
|
8
|
+
def write_nodes(report)
|
9
|
+
report.report_node.children.each do |child_node|
|
10
|
+
write_node(child_node)
|
11
|
+
end
|
12
|
+
builder
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Copyright 2010 ThoughtWorks, Inc. Licensed under the MIT License
|
2
|
+
module Cuporter
|
3
|
+
module Formatter
|
4
|
+
module NameReport
|
5
|
+
class Text < Writer
|
6
|
+
|
7
|
+
COL_WIDTH = 6
|
8
|
+
MARGIN = 4
|
9
|
+
include TextMethods
|
10
|
+
include PrettyTextMethods
|
11
|
+
include Cuporter::Formatter::NameReport::TextNodeWriter
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Copyright 2010 ThoughtWorks, Inc. Licensed under the MIT License
|
2
|
+
module Cuporter
|
3
|
+
module Formatter
|
4
|
+
module NameReport
|
5
|
+
module TextNodeWriter
|
6
|
+
|
7
|
+
def write
|
8
|
+
@report.report_node.children.each do |child_node|
|
9
|
+
write_node(child_node, 0)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -1,19 +1,17 @@
|
|
1
1
|
# Copyright 2010 ThoughtWorks, Inc. Licensed under the MIT License
|
2
2
|
module Cuporter
|
3
3
|
module Formatter
|
4
|
-
|
5
|
-
include TextMethods
|
4
|
+
module PrettyTextMethods
|
6
5
|
|
7
6
|
def tab
|
8
7
|
@tab ||= @number_scenarios ? " " : " "
|
9
8
|
end
|
10
9
|
|
11
|
-
COL_WIDTH = 5
|
12
10
|
def line(number, line)
|
13
11
|
if @number_scenarios
|
14
12
|
number_string = number ? "#{number}." : ""
|
15
|
-
number_field = number_string.rjust(COL_WIDTH, " ")
|
16
|
-
line.sub!(/^\s{#{COL_WIDTH}}/, number_field)
|
13
|
+
number_field = number_string.rjust(self.class::COL_WIDTH, " ")
|
14
|
+
line.insert(0, " " * self.class::MARGIN).sub!(/^\s{#{self.class::COL_WIDTH}}/, number_field)
|
17
15
|
end
|
18
16
|
line
|
19
17
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Copyright 2010 ThoughtWorks, Inc. Licensed under the MIT License
|
2
|
+
module Cuporter
|
3
|
+
module Formatter
|
4
|
+
module TagReport
|
5
|
+
class Csv < Writer
|
6
|
+
include TextMethods
|
7
|
+
include CsvTextMethods
|
8
|
+
include Cuporter::Formatter::TagReport::TextNodeWriter
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -4,14 +4,15 @@ require 'erb'
|
|
4
4
|
|
5
5
|
module Cuporter
|
6
6
|
module Formatter
|
7
|
-
|
8
|
-
|
7
|
+
module TagReport
|
8
|
+
class Html < Writer
|
9
|
+
include HtmlMethods
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
def title
|
12
|
+
"Cucumber Tags"
|
13
|
+
end
|
13
14
|
|
14
|
-
|
15
|
+
RHTML = %{
|
15
16
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
16
17
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
17
18
|
<head>
|
@@ -36,13 +37,14 @@ module Cuporter
|
|
36
37
|
</div>
|
37
38
|
</div>
|
38
39
|
<ul class="tag_list">
|
39
|
-
<%= HtmlNodeWriter.new.write_nodes(@report
|
40
|
+
<%= Cuporter::Formatter::TagReport::HtmlNodeWriter.new.write_nodes(@report)%>
|
40
41
|
</ul>
|
41
42
|
</body>
|
42
43
|
</html>
|
43
44
|
}
|
44
45
|
|
45
46
|
|
47
|
+
end
|
46
48
|
end
|
47
49
|
end
|
48
50
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Copyright 2010 ThoughtWorks, Inc. Licensed under the MIT License
|
2
|
+
|
3
|
+
module Cuporter
|
4
|
+
module Formatter
|
5
|
+
module TagReport
|
6
|
+
class HtmlNodeWriter < Cuporter::Formatter::HtmlNodeWriter
|
7
|
+
|
8
|
+
def write_nodes(report)
|
9
|
+
report.report_node.children.each do |tag_node|
|
10
|
+
tag_node.number_all_descendants
|
11
|
+
write_node(tag_node)
|
12
|
+
end
|
13
|
+
builder
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Copyright 2010 ThoughtWorks, Inc. Licensed under the MIT License
|
2
|
+
module Cuporter
|
3
|
+
module Formatter
|
4
|
+
module TagReport
|
5
|
+
class Text < Writer
|
6
|
+
COL_WIDTH = 5
|
7
|
+
MARGIN = 0
|
8
|
+
include TextMethods
|
9
|
+
include PrettyTextMethods
|
10
|
+
include Cuporter::Formatter::TagReport::TextNodeWriter
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Copyright 2010 ThoughtWorks, Inc. Licensed under the MIT License
|
2
|
+
module Cuporter
|
3
|
+
module Formatter
|
4
|
+
module TagReport
|
5
|
+
module TextNodeWriter
|
6
|
+
|
7
|
+
def write
|
8
|
+
@report.report_node.children.each do |tag_node|
|
9
|
+
tag_node.number_all_descendants if @number_scenarios
|
10
|
+
write_node(tag_node, 0)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -3,13 +3,6 @@ module Cuporter
|
|
3
3
|
module Formatter
|
4
4
|
module TextMethods
|
5
5
|
|
6
|
-
def write
|
7
|
-
@report.report_node.children.each do |tag_node|
|
8
|
-
tag_node.number_all_descendants if @number_scenarios
|
9
|
-
write_node(tag_node, 0)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
6
|
def write_node(node, tab_stops)
|
14
7
|
@output.puts line(node.number, "#{tab * tab_stops}#{node.name}")
|
15
8
|
node.children.each do |child|
|
@@ -4,25 +4,29 @@ module Cuporter
|
|
4
4
|
module Formatter
|
5
5
|
class Writer
|
6
6
|
|
7
|
-
|
7
|
+
attr_reader :number_scenarios
|
8
|
+
|
9
|
+
def initialize(report, output, number_scenarios)
|
8
10
|
@report = report
|
9
11
|
@output = output ? File.open(output, "w") : STDOUT
|
12
|
+
@number_scenarios = number_scenarios
|
10
13
|
end
|
11
14
|
|
12
|
-
def self.create(format, report, output)
|
15
|
+
def self.create(format, report, output, number_scenarios)
|
13
16
|
klass = writer_class(format, report.class.name.split(/::/).last)
|
14
|
-
klass.new(report, output)
|
17
|
+
klass.new(report, output, number_scenarios)
|
15
18
|
end
|
16
19
|
|
17
20
|
def self.writer_class(format, report_class)
|
18
|
-
case format
|
19
|
-
when /text|pretty/i
|
20
|
-
|
21
|
+
fmt = case format
|
22
|
+
when /text|pretty/i
|
23
|
+
"Text"
|
21
24
|
when /csv/i
|
22
|
-
|
25
|
+
"Csv"
|
23
26
|
when /html/i
|
24
|
-
|
27
|
+
"Html"
|
25
28
|
end
|
29
|
+
Cuporter::Formatter.const_get(report_class).const_get(fmt)
|
26
30
|
end
|
27
31
|
end
|
28
32
|
end
|
data/lib/cuporter/node.rb
CHANGED
@@ -25,15 +25,6 @@ module Cuporter
|
|
25
25
|
children.collect {|c| c.name }
|
26
26
|
end
|
27
27
|
|
28
|
-
def find_or_create_child(name)
|
29
|
-
child_node = self[name]
|
30
|
-
unless child_node
|
31
|
-
children << Node.new(name)
|
32
|
-
child_node = children.last
|
33
|
-
end
|
34
|
-
child_node
|
35
|
-
end
|
36
|
-
|
37
28
|
def find_by_name(name)
|
38
29
|
children.find {|c| c.name == name.to_s}
|
39
30
|
end
|
@@ -2,11 +2,10 @@
|
|
2
2
|
module Cuporter
|
3
3
|
class Report
|
4
4
|
|
5
|
-
attr_reader :
|
5
|
+
attr_reader :filter, :title
|
6
6
|
|
7
|
-
def initialize(input_file_pattern,
|
7
|
+
def initialize(input_file_pattern, filter_args = nil, title = nil)
|
8
8
|
@input_file_pattern = input_file_pattern
|
9
|
-
@number_scenarios = number_scenarios
|
10
9
|
@filter = Filter.new(filter_args || {})
|
11
10
|
@title = title
|
12
11
|
end
|
@@ -15,9 +14,9 @@ module Cuporter
|
|
15
14
|
Dir[@input_file_pattern].collect {|f| File.expand_path f}
|
16
15
|
end
|
17
16
|
|
18
|
-
def self.create(type, input_file_pattern,
|
17
|
+
def self.create(type, input_file_pattern, filter_args = nil, title = nil)
|
19
18
|
klass = Cuporter.const_get("#{type.downcase}Report".to_class_name)
|
20
|
-
klass.new(input_file_pattern,
|
19
|
+
klass.new(input_file_pattern, filter_args, title)
|
21
20
|
end
|
22
21
|
end
|
23
22
|
end
|
data/lib/cuporter.rb
CHANGED
@@ -15,9 +15,17 @@ require 'cuporter/report/tag_report'
|
|
15
15
|
require 'cuporter/report/name_report'
|
16
16
|
require 'cuporter/formatter/writer'
|
17
17
|
require 'cuporter/formatter/text_methods'
|
18
|
-
require 'cuporter/formatter/
|
19
|
-
require 'cuporter/formatter/
|
18
|
+
require 'cuporter/formatter/pretty_text_methods'
|
19
|
+
require 'cuporter/formatter/csv_text_methods'
|
20
20
|
require 'cuporter/formatter/html_node_writer'
|
21
21
|
require 'cuporter/formatter/html_methods'
|
22
|
-
require 'cuporter/formatter/
|
23
|
-
require 'cuporter/formatter/
|
22
|
+
require 'cuporter/formatter/tag_report/html'
|
23
|
+
require 'cuporter/formatter/tag_report/html_node_writer'
|
24
|
+
require 'cuporter/formatter/tag_report/text_node_writer'
|
25
|
+
require 'cuporter/formatter/tag_report/text'
|
26
|
+
require 'cuporter/formatter/tag_report/csv'
|
27
|
+
require 'cuporter/formatter/name_report/html'
|
28
|
+
require 'cuporter/formatter/name_report/html_node_writer'
|
29
|
+
require 'cuporter/formatter/name_report/text_node_writer'
|
30
|
+
require 'cuporter/formatter/name_report/text'
|
31
|
+
require 'cuporter/formatter/name_report/csv'
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cuporter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 9
|
10
|
+
version: 0.2.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tim Camper
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-09-
|
18
|
+
date: 2010-09-28 00:00:00 -04:00
|
19
19
|
default_executable: cuporter
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -49,14 +49,22 @@ files:
|
|
49
49
|
- Rakefile
|
50
50
|
- lib/cuporter/name_list.rb
|
51
51
|
- lib/cuporter/example_set_node.rb
|
52
|
-
- lib/cuporter/formatter/csv.rb
|
53
|
-
- lib/cuporter/formatter/
|
52
|
+
- lib/cuporter/formatter/tag_report/csv.rb
|
53
|
+
- lib/cuporter/formatter/tag_report/text_node_writer.rb
|
54
|
+
- lib/cuporter/formatter/tag_report/text.rb
|
55
|
+
- lib/cuporter/formatter/tag_report/html_node_writer.rb
|
56
|
+
- lib/cuporter/formatter/tag_report/html.rb
|
57
|
+
- lib/cuporter/formatter/pretty_text_methods.rb
|
54
58
|
- lib/cuporter/formatter/html_node_writer.rb
|
55
59
|
- lib/cuporter/formatter/html_methods.rb
|
56
|
-
- lib/cuporter/formatter/
|
57
|
-
- lib/cuporter/formatter/name_report_html.rb
|
60
|
+
- lib/cuporter/formatter/csv_text_methods.rb
|
58
61
|
- lib/cuporter/formatter/writer.rb
|
59
62
|
- lib/cuporter/formatter/text_methods.rb
|
63
|
+
- lib/cuporter/formatter/name_report/csv.rb
|
64
|
+
- lib/cuporter/formatter/name_report/text_node_writer.rb
|
65
|
+
- lib/cuporter/formatter/name_report/text.rb
|
66
|
+
- lib/cuporter/formatter/name_report/html_node_writer.rb
|
67
|
+
- lib/cuporter/formatter/name_report/html.rb
|
60
68
|
- lib/cuporter/tag_list.rb
|
61
69
|
- lib/cuporter/report/report.rb
|
62
70
|
- lib/cuporter/report/name_report.rb
|