cuporter 0.3.2 → 0.3.3

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.
Files changed (77) hide show
  1. data/README.textile +123 -44
  2. data/Rakefile +5 -5
  3. data/bin/cuporter +19 -11
  4. data/lib/cuporter.rb +15 -26
  5. data/lib/cuporter/cli/options.rb +95 -22
  6. data/lib/cuporter/document.rb +23 -0
  7. data/lib/cuporter/document/html_document.rb +82 -0
  8. data/lib/cuporter/extensions/nokogiri.rb +46 -0
  9. data/lib/cuporter/feature_parser.rb +38 -19
  10. data/lib/cuporter/filter.rb +1 -0
  11. data/lib/cuporter/formatters/csv.rb +69 -0
  12. data/lib/cuporter/formatters/text.rb +166 -0
  13. data/lib/cuporter/formatters/xml_to_html.xslt +315 -0
  14. data/lib/cuporter/node.rb +7 -83
  15. data/lib/cuporter/node/node_base.rb +114 -0
  16. data/lib/cuporter/node/numbering.rb +32 -0
  17. data/lib/cuporter/node/sorting.rb +27 -0
  18. data/lib/cuporter/node/tagged_node.rb +22 -0
  19. data/lib/cuporter/node/totalling.rb +19 -0
  20. data/lib/cuporter/node/types.rb +158 -0
  21. data/lib/cuporter/node_parser.rb +62 -0
  22. data/lib/cuporter/report/feature_report.rb +23 -0
  23. data/lib/cuporter/report/report_base.rb +69 -0
  24. data/lib/cuporter/report/tag_report.rb +27 -7
  25. data/lib/cuporter/report/tree_report.rb +24 -0
  26. data/lib/cuporter/tag_nodes_parser.rb +94 -0
  27. data/public/images/ajax-loader.gif +0 -0
  28. data/public/images/file.gif +0 -0
  29. data/public/images/folder-closed.gif +0 -0
  30. data/public/images/folder.gif +0 -0
  31. data/public/images/minus.gif +0 -0
  32. data/public/images/plus.gif +0 -0
  33. data/public/images/treeview-black-line.gif +0 -0
  34. data/public/images/treeview-black.gif +0 -0
  35. data/public/images/treeview-default-line.gif +0 -0
  36. data/public/images/treeview-default.gif +0 -0
  37. data/public/images/treeview-famfamfam-line.gif +0 -0
  38. data/public/images/treeview-famfamfam.gif +0 -0
  39. data/public/images/treeview-gray-line.gif +0 -0
  40. data/public/images/treeview-gray.gif +0 -0
  41. data/public/images/treeview-red-line.gif +0 -0
  42. data/public/images/treeview-red.gif +0 -0
  43. data/public/javascripts/expand-collapse.js +47 -0
  44. data/public/javascripts/jquery-min.js +167 -0
  45. data/public/javascripts/jquery.treeview.js +267 -0
  46. data/public/javascripts/treeview-loader.js +11 -0
  47. data/public/stylesheets/cuporter.css +101 -0
  48. data/{lib/cuporter/formatter/name_report/style.css → public/stylesheets/feature_style.css} +17 -18
  49. data/public/stylesheets/jquery.treeview.css +75 -0
  50. data/{lib/cuporter/formatter/tag_report/style.css → public/stylesheets/tag_style.css} +17 -22
  51. data/public/stylesheets/tree_style.css +104 -0
  52. metadata +52 -37
  53. data/lib/cuporter/example_set_node.rb +0 -15
  54. data/lib/cuporter/formatter/csv_text_methods.rb +0 -20
  55. data/lib/cuporter/formatter/cuporter.css +0 -64
  56. data/lib/cuporter/formatter/html_methods.rb +0 -122
  57. data/lib/cuporter/formatter/html_node_writer.rb +0 -104
  58. data/lib/cuporter/formatter/jquery-min.js +0 -154
  59. data/lib/cuporter/formatter/name_report/csv.rb +0 -12
  60. data/lib/cuporter/formatter/name_report/html.rb +0 -48
  61. data/lib/cuporter/formatter/name_report/html_node_writer.rb +0 -18
  62. data/lib/cuporter/formatter/name_report/text.rb +0 -16
  63. data/lib/cuporter/formatter/name_report/text_node_writer.rb +0 -16
  64. data/lib/cuporter/formatter/pretty_text_methods.rb +0 -22
  65. data/lib/cuporter/formatter/tag_report/csv.rb +0 -12
  66. data/lib/cuporter/formatter/tag_report/html.rb +0 -35
  67. data/lib/cuporter/formatter/tag_report/html_node_writer.rb +0 -19
  68. data/lib/cuporter/formatter/tag_report/text.rb +0 -14
  69. data/lib/cuporter/formatter/tag_report/text_node_writer.rb +0 -17
  70. data/lib/cuporter/formatter/text_methods.rb +0 -19
  71. data/lib/cuporter/formatter/writer.rb +0 -33
  72. data/lib/cuporter/name_list_parser.rb +0 -44
  73. data/lib/cuporter/node_numberer.rb +0 -18
  74. data/lib/cuporter/report/name_report.rb +0 -19
  75. data/lib/cuporter/report/report.rb +0 -22
  76. data/lib/cuporter/tag_list_node.rb +0 -54
  77. data/lib/cuporter/tag_list_parser.rb +0 -39
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: 23
5
- prerelease: false
4
+ hash: 21
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 2
10
- version: 0.3.2
9
+ - 3
10
+ version: 0.3.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tim Camper
@@ -15,11 +15,11 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-28 00:00:00 -05:00
18
+ date: 2011-04-27 00:00:00 -04:00
19
19
  default_executable: cuporter
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- name: builder
22
+ name: nokogiri
23
23
  prerelease: false
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
@@ -28,10 +28,10 @@ dependencies:
28
28
  - !ruby/object:Gem::Version
29
29
  hash: 15
30
30
  segments:
31
- - 2
32
31
  - 1
33
- - 2
34
- version: 2.1.2
32
+ - 4
33
+ - 4
34
+ version: 1.4.4
35
35
  type: :runtime
36
36
  version_requirements: *id001
37
37
  description: Scrapes Cucumber *.feature files to build reports on tag usage and test inventory
@@ -49,40 +49,55 @@ files:
49
49
  - Rakefile
50
50
  - lib/cuporter/cli/filter_args_builder.rb
51
51
  - lib/cuporter/cli/options.rb
52
- - lib/cuporter/example_set_node.rb
52
+ - lib/cuporter/document/html_document.rb
53
+ - lib/cuporter/document.rb
54
+ - lib/cuporter/extensions/nokogiri.rb
53
55
  - lib/cuporter/extensions/string.rb
54
56
  - lib/cuporter/feature_parser.rb
55
57
  - lib/cuporter/filter.rb
56
- - lib/cuporter/formatter/csv_text_methods.rb
57
- - lib/cuporter/formatter/html_methods.rb
58
- - lib/cuporter/formatter/html_node_writer.rb
59
- - lib/cuporter/formatter/name_report/csv.rb
60
- - lib/cuporter/formatter/name_report/html.rb
61
- - lib/cuporter/formatter/name_report/html_node_writer.rb
62
- - lib/cuporter/formatter/name_report/text.rb
63
- - lib/cuporter/formatter/name_report/text_node_writer.rb
64
- - lib/cuporter/formatter/pretty_text_methods.rb
65
- - lib/cuporter/formatter/tag_report/csv.rb
66
- - lib/cuporter/formatter/tag_report/html.rb
67
- - lib/cuporter/formatter/tag_report/html_node_writer.rb
68
- - lib/cuporter/formatter/tag_report/text.rb
69
- - lib/cuporter/formatter/tag_report/text_node_writer.rb
70
- - lib/cuporter/formatter/text_methods.rb
71
- - lib/cuporter/formatter/writer.rb
72
- - lib/cuporter/name_list_parser.rb
58
+ - lib/cuporter/formatters/csv.rb
59
+ - lib/cuporter/formatters/text.rb
60
+ - lib/cuporter/node/node_base.rb
61
+ - lib/cuporter/node/numbering.rb
62
+ - lib/cuporter/node/sorting.rb
63
+ - lib/cuporter/node/tagged_node.rb
64
+ - lib/cuporter/node/totalling.rb
65
+ - lib/cuporter/node/types.rb
73
66
  - lib/cuporter/node.rb
74
- - lib/cuporter/node_numberer.rb
75
- - lib/cuporter/report/name_report.rb
76
- - lib/cuporter/report/report.rb
67
+ - lib/cuporter/node_parser.rb
68
+ - lib/cuporter/report/feature_report.rb
69
+ - lib/cuporter/report/report_base.rb
77
70
  - lib/cuporter/report/tag_report.rb
78
- - lib/cuporter/tag_list_node.rb
79
- - lib/cuporter/tag_list_parser.rb
71
+ - lib/cuporter/report/tree_report.rb
72
+ - lib/cuporter/tag_nodes_parser.rb
80
73
  - lib/cuporter.rb
81
- - lib/cuporter/formatter/cuporter.css
82
- - lib/cuporter/formatter/name_report/style.css
83
- - lib/cuporter/formatter/tag_report/style.css
84
- - lib/cuporter/formatter/jquery-min.js
74
+ - lib/cuporter/formatters/xml_to_html.xslt
85
75
  - bin/cuporter
76
+ - public/stylesheets/cuporter.css
77
+ - public/stylesheets/feature_style.css
78
+ - public/stylesheets/jquery.treeview.css
79
+ - public/stylesheets/tag_style.css
80
+ - public/stylesheets/tree_style.css
81
+ - public/javascripts/expand-collapse.js
82
+ - public/javascripts/jquery-min.js
83
+ - public/javascripts/jquery.treeview.js
84
+ - public/javascripts/treeview-loader.js
85
+ - public/images/ajax-loader.gif
86
+ - public/images/file.gif
87
+ - public/images/folder-closed.gif
88
+ - public/images/folder.gif
89
+ - public/images/minus.gif
90
+ - public/images/plus.gif
91
+ - public/images/treeview-black-line.gif
92
+ - public/images/treeview-black.gif
93
+ - public/images/treeview-default-line.gif
94
+ - public/images/treeview-default.gif
95
+ - public/images/treeview-famfamfam-line.gif
96
+ - public/images/treeview-famfamfam.gif
97
+ - public/images/treeview-gray-line.gif
98
+ - public/images/treeview-gray.gif
99
+ - public/images/treeview-red-line.gif
100
+ - public/images/treeview-red.gif
86
101
  has_rdoc: true
87
102
  homepage: http://github.com/twcamper/cuporter
88
103
  licenses: []
@@ -122,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
137
  requirements: []
123
138
 
124
139
  rubyforge_project: cuporter
125
- rubygems_version: 1.3.7
140
+ rubygems_version: 1.4.2
126
141
  signing_key:
127
142
  specification_version: 3
128
143
  summary: Scrapes Cucumber *.feature files to build reports on tag usage and test inventory
@@ -1,15 +0,0 @@
1
- # Copyright 2010 ThoughtWorks, Inc. Licensed under the MIT License
2
- module Cuporter
3
- class ExampleSetNode < TagListNode
4
-
5
- def sort!
6
- # no op
7
- end
8
-
9
- def add_child(node)
10
- node.numerable = false unless has_children? #first row ( arg list header)
11
- super(node)
12
- end
13
-
14
- end
15
- end
@@ -1,20 +0,0 @@
1
- # Copyright 2010 ThoughtWorks, Inc. Licensed under the MIT License
2
- module Cuporter
3
- module Formatter
4
- module CsvTextMethods
5
-
6
- def tab
7
- ","
8
- end
9
-
10
- def line(number, empty_columns, name)
11
- empty_columns.sub!(/^#{tab}/, "#{number}#{tab}") if number
12
- name.gsub!(tab, ";")
13
- name.sub!(/^\|/, '')
14
- name.gsub!("|", tab)
15
- empty_columns + name
16
- end
17
-
18
- end
19
- end
20
- end
@@ -1,64 +0,0 @@
1
- body {
2
- margin: 0;
3
- padding: 0;
4
- font: normal 11px "Lucida Grande", Helvetica, sans-serif
5
- }
6
- .cuporter_header {
7
- padding-left: 2em;
8
- padding-bottom: 0.3em;
9
- padding-top: 0.05em;
10
- color: white;
11
- height: 7em;
12
- }
13
- .cuporter_header #label {
14
- padding-right: 2em;
15
- float: left;
16
- }
17
- #summary {
18
- position: absolute;
19
- right: 1em;
20
- text-align: right;
21
- top: 1.2em;
22
- }
23
-
24
- #summary p {
25
- margin: 0px 0px 0px 2px;
26
- }
27
-
28
- ul {
29
- list-style-type: none;
30
- }
31
- .main_list {
32
- padding-left: 0.5em;
33
- }
34
- .feature {
35
- margin-bottom: 0.5em;
36
- margin-right: 1em;
37
- }
38
- .feature_name {
39
- padding-top: 0.3em;
40
- padding-bottom: 0.3em;
41
- font-weight: bold;
42
- }
43
-
44
- .file {
45
- float: right;
46
- padding-right: 0.5em;
47
- font-weight: normal;
48
- color: black;
49
- }
50
-
51
- .file .dir {
52
- font-weight: bold;
53
- }
54
-
55
- .example td.val {
56
- padding-left: 0.5em;
57
- }
58
-
59
- .number {
60
- position: absolute;
61
- font-weight: bold;
62
- }
63
-
64
-
@@ -1,122 +0,0 @@
1
- # Copyright 2010 ThoughtWorks, Inc. Licensed under the MIT License
2
- require 'rubygems'
3
- require 'erb'
4
-
5
- module Cuporter
6
- module Formatter
7
- module HtmlMethods
8
-
9
- def document
10
- builder = Builder::XmlMarkup.new
11
- builder.declare!(:DOCTYPE, :html,
12
- :PUBLIC, "-//W3C//DTD XHTML 1.0 Transitional//EN",
13
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
14
- )
15
- builder
16
- end
17
-
18
- def html
19
- document.html(:xmlns => "http://www.w3.org/1999/xhtml") do |html|
20
- head(html)
21
- body(html)
22
- end.to_s.sub("<to_s/>",'')
23
- end
24
-
25
- def head(html)
26
- html.head do |head|
27
- head.title(title)
28
- head.style(inline_file("cuporter.css"))
29
- head.style(inline_file(inline_style))
30
- head.script(:type => "text/javascript") do
31
- head << inline_jquery # jquery is corrupted if it isn't handled this way
32
- head << inline_js_content
33
- end
34
- end
35
- end
36
-
37
- def body(html)
38
- html.body do |body|
39
- header(body)
40
- body.ul(:class => :main_list) do |ul|
41
- write_report_node(body)
42
- end
43
- end
44
- end
45
-
46
- def label(header)
47
- header.div(:id => :label) do |div|
48
- div.h1(title)
49
- end
50
- end
51
-
52
- def inline_file(file_name)
53
- File.read("#{File.dirname(__FILE__)}/#{file_name}")
54
- end
55
-
56
- def write_report_node(body)
57
- report_node_writer.new(@report, body).write_report_node
58
- end
59
-
60
- def write
61
- @output.puts html
62
- end
63
-
64
- def inline_jquery
65
- inline_file('/jquery-min.js')
66
- end
67
-
68
- def inline_js_content
69
- <<-EOF
70
-
71
- FEATURES = "li.feature .feature_name";
72
- TAGS = "li.tag .tag_name";
73
-
74
- $(document).ready(function() {
75
- $(FEATURES).css('cursor', 'pointer');
76
- $(FEATURES).click(function() {
77
- $(this).siblings().toggle(250);
78
- });
79
-
80
- $(TAGS).css('cursor', 'pointer');
81
- $(TAGS).click(function() {
82
- $(this).siblings().toggle(250);
83
- });
84
-
85
- $("#collapser").css('cursor', 'pointer');
86
- $("#collapser").click(function() {
87
- $(TAGS).siblings().hide();
88
- $(FEATURES).siblings().hide();
89
- });
90
-
91
- $("#expand_tags").css('cursor', 'pointer');
92
- $("#expand_tags").click(function() {
93
- $(TAGS).siblings().show();
94
- $(FEATURES).siblings().hide();
95
- });
96
-
97
- $("#expand_all").css('cursor', 'pointer');
98
- $("#expand_all").click(function() {
99
- $(TAGS).siblings().show();
100
- $(FEATURES).siblings().show();
101
- });
102
-
103
- $("#expand_features").css('cursor', 'pointer');
104
- $("#expand_features").click(function() {
105
- $(FEATURES).siblings().show();
106
- });
107
-
108
- $("#collapse_features").css('cursor', 'pointer');
109
- $("#collapse_features").click(function() {
110
- $(FEATURES).siblings().hide();
111
- });
112
-
113
- // load page with features collapsed
114
- $("#collapser, #collapse_features").click();
115
- })
116
-
117
- EOF
118
- end
119
-
120
- end
121
- end
122
- end
@@ -1,104 +0,0 @@
1
- # Copyright 2010 ThoughtWorks, Inc. Licensed under the MIT License
2
- require 'rubygems'
3
- require 'builder'
4
-
5
- module Cuporter
6
- module Formatter
7
- class HtmlNodeWriter
8
-
9
- attr_reader :builder
10
-
11
- def initialize(report, builder)
12
- @report = report
13
- @builder = builder
14
- end
15
-
16
- def write_node(node)
17
- builder.li(:class => node_class(node.name)) do
18
- write_node_name(node)
19
- write_children(node)
20
- end
21
- end
22
-
23
- def write_node_name(node)
24
- builder.span("#{node.number}.", :class => :number) if node.number
25
- builder.div(:class => "#{node_class(node.name)}_name") do
26
- builder.span(node.name)
27
- write_file(node.file) if node.file
28
- builder.span("[#{node.total}]", :class => :total) if node_class(node.name) == :tag
29
- end
30
- end
31
-
32
- def write_file(file)
33
- builder.div(:class => :file) do |div|
34
- path_nodes = file.split(File::Separator)
35
- file_name = path_nodes.pop
36
- parent_dir = path_nodes.pop
37
- div.span(path_nodes.join("/"))
38
- div.span("/#{parent_dir}", :class => :dir)
39
- div.span("/#{file_name}")
40
- end
41
- end
42
-
43
- def write_children(node)
44
- return if node.children.empty?
45
- if node.is_a? ExampleSetNode
46
- write_children_in_table(node.children)
47
- else
48
- write_children_in_list(node.children)
49
- end
50
- end
51
-
52
- def write_children_in_table(children)
53
- builder.div(:class => :example_rows) do
54
- builder.table do
55
- builder.thead {to_row(children.first)}
56
- builder.tbody do
57
- children[1..-1].each do |child|
58
- to_row(child, :class => :example)
59
- end
60
- end
61
- end
62
- end
63
- end
64
-
65
- def to_row(node, attributes = {})
66
- builder.tr(attributes) do |row|
67
- number_string = node.number ? "#{node.number}." : ""
68
- row.td(number_string, :class => :number)
69
- node.name.sub(/^\|/,"").split("|").each {|s| row.td(s.strip, :class => :val) }
70
- end
71
- end
72
-
73
- def write_children_in_list(children)
74
- builder.ul do
75
- children.each do |child|
76
- if child.has_children?
77
- write_node(child)
78
- else
79
- builder.li() { write_node_name(child) }
80
- end
81
- end
82
- end
83
- end
84
-
85
- def node_class(name)
86
- case name
87
- when FeatureParser::TAG_LINE
88
- :tag
89
- when FeatureParser::FEATURE_LINE
90
- :feature
91
- when FeatureParser::SCENARIO_LINE
92
- :scenario
93
- when FeatureParser::SCENARIO_OUTLINE_LINE
94
- :scenario_outline
95
- when FeatureParser::SCENARIO_SET_LINE, FeatureParser::EXAMPLE_SET_LINE
96
- :example_set
97
- else
98
- :example
99
- end
100
- end
101
-
102
- end
103
- end
104
- end