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
data/README.textile CHANGED
@@ -1,40 +1,73 @@
1
1
  h1. Cuporter
2
2
 
3
- Scrapes your feature files and shows 2 possible reports:
3
+ h3. A Cucumber Reporter
4
4
 
5
- # Tag Report: scenarios and examples per tag
6
- ** in Feature and Scenario Outline context, as appropriate
7
- ** sorted alphbetically by file path, scenario name, scenario outline name, example name
8
- ** optionally numbered*, counting scenarios and outline examples per tag
9
- # Inventory Report: feature, scenario and example names
10
- ** may be filtered by tags, using same CLI syntax as Cucumber
11
- ** sorted alphbetically by file path, scenario name, scenario outline name, example name
12
- ** optionally numbered*, using 1 count of all scenarios and outline examples for the report
5
+ Scrapes your feature files to show test counts and tag relationships.
13
6
 
14
- <notextile>*</notextile> _HTML reports are always numbered._
7
+ h3. 3 Views
15
8
 
16
- Either report may be formatted in HTML, CSV, or Pretty Text.
9
+ # Tag Report
10
+ ** Tags listed with all features and scenarios associated with them
11
+ ** Each scenario shows all of its tags, for simple cross referencing
12
+ # Feature Report
13
+ ** Simple list of all Cucumber features, sorted by name and file name.
14
+ ** Collapsable scenario and scenario outline breakdowns
15
+ ** Totals, subtotals, scenario numbering
16
+ # Tree Report
17
+ ** Expandy-collapsy jquery.treeview of your @features/**@ dir
18
+ ** Same feature data as above
19
+ ** Subtotals on folders
17
20
 
18
- * HTML reports do jQuery expand-collapse, with acklowedgment due to the Cucumber HTML formatter.
21
+ h3. 4 Output Formats
19
22
 
20
- Consider this a stop-gap until we get this functionality in a proper cucumber formatter.
23
+ # html
24
+ # xml
25
+ # pretty-print text
26
+ # csv
27
+
28
+ h3. A bunch of configuration options
29
+
30
+ See the help output below.
21
31
 
22
32
  ---------
23
- h3. Example Tag Report Output: numbered pretty text
33
+
34
+ h3. Example Tag Report Ouput
35
+
36
+
37
+ h4. xml of single test
38
+
39
+ <notextile>
40
+ <pre>
41
+ &lt;?xml version="1.0" encoding="UTF-8"?&gt;
42
+ &lt;xml&gt;
43
+ &lt;body&gt;
44
+ &lt;report view="tag" title="Cucumber Tags" total="1"&gt;
45
+ &lt;tag cuke_name="@just_me" total="1"&gt;
46
+ &lt;feature cuke_name="Feature: Pretty print report on 3 features" file_path="features/pretty_print.feature" total="1"&gt;
47
+ &lt;scenario cuke_name="Scenario: Tag report on everything in fixtures/self_test" tags="@just_me" number="1"/&gt;
48
+ &lt;/feature&gt;
49
+ &lt;/tag&gt;
50
+ &lt;/report&gt;
51
+ &lt;/body&gt;
52
+ &lt;/xml&gt;
53
+ </pre>
54
+ </notextile>
55
+
56
+ h4. numbered pretty text
24
57
 
25
58
  <pre>
26
59
  @failing
27
- Feature: Abominable Aardvark
60
+ Feature: Abominable Aardvark @failing, @zoology
28
61
  1. Scenario: An Aardvark eats ants
29
62
  2. Scenario: Zee Zebra eats zee aardvark
30
- Feature: Wired
31
- 3. Scenario: Everybody's Wired
63
+ Feature: Wired
64
+ 3. Scenario: Everybody's Wired @failing
32
65
  Scenario Outline: Why is everybody so wired?
33
66
  Examples: loosely wired
34
67
  | arg1 | arg2 |
35
68
  4. | foo | bar |
36
69
  5. | shif | fish |
37
- Examples: tightly wired
70
+ Examples: tightly wired @ignore
38
71
  | arg1 | arg2 |
39
72
  6. | foo | bar |
40
73
  7. | frotz | knurl |
@@ -66,6 +99,9 @@ h3. Install
66
99
  $ gem install cuporter
67
100
  </pre>
68
101
 
102
+ Once installed, you can run @$ cuporter@ anywhere on your system. In any project dir, it will read your @features/**@ by default.
103
+ If you clone the repo, you can run @$ ./bin/cuporter@ from within it.
104
+
69
105
  ---------
70
106
 
71
107
  h3. Command Lines
@@ -73,45 +109,88 @@ h3. Command Lines
73
109
  h4. help
74
110
 
75
111
  <pre>
76
- $ ./bin/cuporter -h
112
+ $ cuporter -h
77
113
 
78
114
  Usage: cuporter [options]
115
+
116
+ -r, --report [tag|feature|tree] View, or type of report.
117
+ Default: "tag"
118
+
119
+ -f, --format [xml|html|csv|text] Output format.
120
+ Default: text (it's pretty, though!)
121
+
122
+ -i, --input-dir DIR Root directory of *.feature files.
123
+ Default: "features"
124
+
125
+ Used to build the glob pattern '[--in]/**/*.feature', which is really most likely
126
+ "features/**/*.features" and finds all feature files anywhere under "features" or
127
+ your custom root supplied with this option.
128
+ Overridden by "--file-input'.
129
+
130
+ -I, --file-input FILE Single *.feature file. Full name with extension, like 'path/to/file.feature.'
131
+ Overrides "--input-dir" and used mostly for testing.
132
+
133
+ -o, --output-file FILE Output file path, like 'tmp/cucumber/tag_report.html'.
134
+
135
+ -t, --tags TAG_EXPRESSION Filter on tags for name report.
136
+ TAG_EXPRESSION rules:
137
+ 1. $ cucumber --help
138
+ 2. http://github.com/aslakhellesoy/cucumber/wiki/Tags
139
+
140
+ -T, --title STRING Override report default title, which is different for each view/report.
141
+ This affects the xml 'report' node title and the html head > title attributes.
142
+
143
+ Reporting options: on by default but can be turned off:
144
+
145
+ --no-sort Do not sort tags, features, scenarios, or outlines
146
+ --no-number Do not get or show scenario or example numbers, (i.e., do not number the leaf nodes).
147
+ --no-total Do not get or show totals
148
+ --no-show-tags Do not show cucumber tags at the feature, scenario, or outline level.
149
+ --no-show-files Do not show feature file paths.
150
+ --no-leaves Show features only, with no scenarios or outlines.
151
+
79
152
 
80
- -i, --in DIR directory of *.feature files
81
- Default: features/**/*.feature
153
+ </pre>
82
154
 
83
- -I, --input-file FILE full file name with extension: 'path/to/file.feature'
155
+ h4. Examples
84
156
 
85
- -o, --out FILE Output file path
157
+ <pre>
158
+ # pretty-print demo report to stdout
159
+ $ ./bin/cuporter -i fixtures/self_test
86
160
 
87
- -f, --format [pretty|html|csv] Output format
88
- Default: pretty text
161
+ # same, XML to console
162
+ $ ./bin/cuporter -i fixtures/self_test -f xml
89
163
 
90
- -n, --numbers number scenarios and examples
164
+ # List View: html without totals, xml without leaves (scenarios and examples)
165
+ $ cuporter -i fixtures/ -r feature -f html --no-total > redirecting_is_ok_too.html
166
+ $ cuporter -i fixtures/ -r feature -f xml -o fixtures_demo.xml --no-leaves
91
167
 
92
- -t, --tags TAG_EXPRESSION Filter on tags for name report.
93
- TAG_EXPRESSION rules: see '$ cucumber --help' and http://github.com/aslakhellesoy/cucumber/wiki/Tags
168
+ # Tree View of default input features/**/*.feature to
169
+ $ cuporter -f html -r tree -o feature_tree_view.html
94
170
 
95
- -r, --report [tag|name] type of report
96
- Default: tag
171
+ # filtered html feature report, with non-default title
172
+ $ cuporter -f html -o active_customer.html -r feature -T "Active Customer Test Inventory" -t ~@wip -t @customer,@client
173
+ </pre>
97
174
 
98
- -T, --title STRING title of name report
99
- Default: 'Cucumber Scenario Inventory'
175
+ ----
100
176
 
101
- </pre>
177
+ h3. Dependencies
102
178
 
103
- h4. run script directly
179
+ # Nokogiri 1.4.4 or above
180
+ ** For all things Nodular: XML document building and XSL transformation into HTML
181
+ ** Not tested on earlier versions yet but I'd guess you'll be fine with anything recent.
182
+ ** @libxml2@ and @libxslt@ are required by this gem, which *should* handle them smoothly. However, @libxml@ and cousins
183
+ can at times present installation difficulties in the form of clashes with already-installed C resources. It has to do with very specific
184
+ lib versioning and installation order issues. It's not always the same problem,
185
+ so there's no prescription for it but Google, unfortunately.
186
+ # jQuery and jQueryTreeview
187
+ ** packaged with the gem
188
+ ** jquery.treeview relies on image files, so our tree view requires the HTML to link to its resources rather than copying them to the &lt;head&gt;.
104
189
 
105
- <pre>
106
- # pretty-print demo report to stdout
107
- $ ./bin/cuporter -i fixtures/self_text
190
+ h3. Acknowledgements
108
191
 
109
- # same, but number the scenarios and example rows
110
- $ ./bin/cuporter -i fixtures/self_text -n
192
+ * Acknowledgements remain due to the Cucumber HTML formatter, and to the human one, too!.
193
+ * Thanks to everyone involved in Nokogiri, jQuery and the Treeview plugin.
111
194
 
112
- # default input features/**/*.feature to named html output file
113
- $ ./bin/cuporter -f html -o feature_tag_report.html
195
+ I used to _"Consider this a stop-gap until we get this functionality in a proper cucumber formatter"_, but now I'm not so sure. Megalomania?
114
196
 
115
- # filtered html name report, with non-default title
116
- $ ./bin/cuporter -f html -o active_customer.html -r name -T "Active Customer Test Inventory" -t ~@wip -t @customer,@client
117
- </pre>
data/Rakefile CHANGED
@@ -27,13 +27,13 @@ namespace :cuporter do
27
27
  desc "unit specs"
28
28
  RSpec::Core::RakeTask.new(:unit) do |t|
29
29
  t.pattern = "spec/cuporter/*_spec.rb"
30
- t.spec_opts = ["--color" , "--format" , "doc" ]
30
+ t.rspec_opts = ["--color" , "--format" , "doc" ]
31
31
  end
32
32
 
33
33
  desc "functional specs against feature fixtures"
34
34
  RSpec::Core::RakeTask.new(:functional) do |t|
35
35
  t.pattern = "spec/cuporter/functional/**/*_spec.rb"
36
- t.spec_opts = ["--color" , "--format" , "doc" ]
36
+ t.rspec_opts = ["--color" , "--format" , "doc" ]
37
37
  end
38
38
 
39
39
  desc "cucumber features"
@@ -56,7 +56,7 @@ namespace :cuporter do
56
56
 
57
57
  spec = Gem::Specification.new do |s|
58
58
  s.name = 'cuporter'
59
- s.version = '0.3.2'
59
+ s.version = '0.3.3'
60
60
  s.rubyforge_project = s.name
61
61
 
62
62
  s.platform = Gem::Platform::RUBY
@@ -69,12 +69,12 @@ namespace :cuporter do
69
69
  s.email = 'twcamper@thoughtworks.com'
70
70
  s.homepage = 'http://github.com/twcamper/cuporter'
71
71
  s.required_ruby_version = '>= 1.8.7'
72
- s.add_dependency('builder', '>= 2.1.2')
72
+ s.add_dependency('nokogiri', '>= 1.4.4')
73
73
  s.default_executable = "cuporter"
74
74
  s.executables = [s.default_executable]
75
75
 
76
76
  s.files = %w(LICENSE README.textile Rakefile) +
77
- FileList["lib/**/*.{rb,css,js}", "bin/*"].to_a
77
+ FileList["lib/**/*.{rb,xslt}", "bin/*", "public/**/*.{css,js,gif}"].to_a
78
78
 
79
79
  s.require_path = "lib"
80
80
  end
data/bin/cuporter CHANGED
@@ -1,17 +1,25 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
3
+ $LOAD_PATH.unshift File.expand_path('../lib', File.dirname(__FILE__))
4
4
  require 'cuporter'
5
5
 
6
- filter_args = Cuporter::CLI::FilterArgsBuilder.new(Cuporter::CLI::Options[:tags]).args
7
6
 
8
- report = Cuporter::Report.create(Cuporter::CLI::Options[:report],
9
- Cuporter::CLI::Options[:input_file] || Cuporter::CLI::Options[:input_dir],
10
- filter_args,
11
- Cuporter::CLI::Options[:title])
7
+ report = Cuporter::ReportBase.create(Cuporter.options).build
12
8
 
13
- formatter = Cuporter::Formatter::Writer.create(Cuporter::CLI::Options[:format],
14
- report,
15
- Cuporter::CLI::Options[:output],
16
- Cuporter::CLI::Options[:numbers])
17
- formatter.write
9
+ (Cuporter.output_file || STDOUT).puts case Cuporter.options[:format]
10
+ when 'xml'
11
+ report.doc.to_xml(:indent => 2, :encoding => 'UTF-8')
12
+ when 'csv'
13
+ report.doc.to_csv
14
+ when 'text', 'pretty'
15
+ report.doc.to_text
16
+ when 'html'
17
+ html = Cuporter::Document.new_html(Cuporter.options[:report])
18
+ formatters = File.expand_path("../lib/cuporter/formatters", File.dirname(__FILE__))
19
+ xslt = Nokogiri::XSLT(File.read("#{formatters}/xml_to_html.xslt"))
20
+ html.add_report(xslt.transform(report.doc).at('.report'))
21
+ html.to_html
22
+ end
23
+
24
+ __END__
25
+ xsltproc --stringparam view feature lib/cuporter/formatters/xml_to_html.xslt new_feature.xml | ruby -e "f = STDIN.read; puts f.gsub(/\<\!--[\*\/]{2}--\>/, '')" | tee xslt_feature.html
data/lib/cuporter.rb CHANGED
@@ -1,31 +1,20 @@
1
1
  # Copyright 2010 ThoughtWorks, Inc. Licensed under the MIT License
2
- require 'cuporter/node'
3
- require 'cuporter/filter'
4
- require 'cuporter/tag_list_node'
5
- require 'cuporter/example_set_node'
6
- require 'cuporter/node_numberer'
7
- require 'cuporter/feature_parser'
8
- require 'cuporter/tag_list_parser'
9
- require 'cuporter/name_list_parser'
2
+ $LOAD_PATH.unshift( File.expand_path("#{File.dirname(__FILE__)}"))
3
+ $LOAD_PATH.unshift( File.expand_path("#{File.dirname(__FILE__)}/.."))
4
+ require 'cuporter/extensions/nokogiri'
10
5
  require 'cuporter/extensions/string'
11
6
  require 'cuporter/cli/options'
12
7
  require 'cuporter/cli/filter_args_builder'
13
- require 'cuporter/report/report'
8
+ require 'cuporter/node'
9
+ require 'cuporter/formatters/text'
10
+ require 'cuporter/formatters/csv'
11
+ require 'cuporter/filter'
12
+ require 'cuporter/feature_parser'
13
+ require 'cuporter/tag_nodes_parser'
14
+ require 'cuporter/node_parser'
15
+ require 'cuporter/document'
16
+ require 'cuporter/document/html_document'
17
+ require 'cuporter/report/report_base'
14
18
  require 'cuporter/report/tag_report'
15
- require 'cuporter/report/name_report'
16
- require 'cuporter/formatter/writer'
17
- require 'cuporter/formatter/text_methods'
18
- require 'cuporter/formatter/pretty_text_methods'
19
- require 'cuporter/formatter/csv_text_methods'
20
- require 'cuporter/formatter/html_node_writer'
21
- require 'cuporter/formatter/html_methods'
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'
19
+ require 'cuporter/report/tree_report'
20
+ require 'cuporter/report/feature_report'
@@ -4,6 +4,7 @@ require 'fileutils'
4
4
 
5
5
  module Cuporter
6
6
  module CLI
7
+
7
8
  class Options
8
9
 
9
10
  def self.[](key)
@@ -11,59 +12,131 @@ module Cuporter
11
12
  end
12
13
 
13
14
  def self.options
14
- self.parse unless @options
15
+ unless @options
16
+ self.parse
17
+ @options[:input_file_pattern] = @options.delete(:input_file) || "#{@options.delete(:input_dir)}/**/*.feature"
18
+ @options[:root_dir] = @options[:input_file_pattern].split(File::SEPARATOR).first
19
+ @options[:filter_args] = Cuporter::CLI::FilterArgsBuilder.new(@options.delete(:tags)).args
20
+ end
15
21
  @options
16
22
  end
17
23
 
24
+ def self.args
25
+ @@args
26
+ end
27
+
18
28
  def self.parse
29
+ @@args = ARGV.dup
19
30
  @options = {}
20
31
  OptionParser.new(ARGV.dup) do |opts|
21
32
  opts.banner = "Usage: cuporter [options]\n\n"
22
33
 
23
- @options[:input_dir] = "features/**/*.feature"
24
- opts.on("-i", "--in DIR", "directory of *.feature files\n\t\t\t\t\tDefault: features/**/*.feature\n\n") do |i|
25
- @options[:input_dir] = "#{i}/**/*.feature"
34
+ @options[:report] = "tag"
35
+ opts.on("-r", "--report [tag|feature|tree]", %Q{View, or type of report.
36
+ Default: "tag"
37
+ }) do |r|
38
+ @options[:report] = (r == 'name' ? 'feature' : r)
26
39
  end
27
40
 
28
- opts.on("-I", "--input-file FILE", "full file name with extension: 'path/to/file.feature'\n\n") do |file|
41
+ @options[:format] = "text"
42
+ opts.on("-f", "--format [xml|html|csv|text]", %Q{Output format.
43
+ Default: text (it's pretty, though!)
44
+ }) do |f|
45
+ @options[:format] = f
46
+ end
47
+
48
+ @options[:input_dir] = "features"
49
+ opts.on("-i", "--input-dir DIR", %Q{Root directory of *.feature files.
50
+ Default: "features"
51
+
52
+ Used to build the glob pattern '[--in]/**/*.feature', which is really most likely
53
+ "features/**/*.features" and finds all feature files anywhere under "features" or
54
+ your custom root supplied with this option.
55
+ Overridden by "--file-input'.
56
+ }) do |i|
57
+ @options[:input_dir] = i.sub(/#{File::SEPARATOR}$/,'')
58
+ end
59
+
60
+ opts.on("-I", "--file-input FILE", %Q{Single *.feature file. Full name with extension, like 'path/to/file.feature.'
61
+ Overrides "--input-dir" and used mostly for testing.
62
+ }) do |file|
29
63
  @options[:input_file] = file
30
64
  end
31
- opts.on("-o", "--out FILE", "Output file path\n\n") do |o|
65
+
66
+ @options[:output_file]
67
+ opts.on("-o", "--output-file FILE", %Q{Output file path, like 'tmp/cucumber/tag_report.html'.
68
+ }) do |o|
32
69
  full_path = File.expand_path(o)
33
70
  path = full_path.split(File::SEPARATOR)
34
71
  file = path.pop
35
72
  FileUtils.makedirs(path.join(File::SEPARATOR))
73
+
74
+ @options[:output_file] = full_path
75
+ end
36
76
 
37
- @options[:output] = full_path
77
+ @options[:tags] = []
78
+ opts.on("-t", "--tags TAG_EXPRESSION", %Q{Filter on tags for name report.
79
+ TAG_EXPRESSION rules:
80
+ 1. $ cucumber --help
81
+ 2. http://github.com/aslakhellesoy/cucumber/wiki/Tags
82
+ }) do |t|
83
+ @options[:tags] << t
38
84
  end
39
- @options[:format] = "text"
40
- opts.on("-f", "--format [pretty|html|csv]", "Output format\n\t\t\t\t\tDefault: pretty text\n\n") do |f|
41
- @options[:format] = f
85
+
86
+ opts.on("-T", "--title STRING", %Q{Override report default title, which is different for each view/report.
87
+ This affects the xml 'report' node title and the html head > title attributes.
88
+ }) do |title|
89
+ @options[:title] = title
42
90
  end
43
91
 
44
- opts.on("-n", "--numbers", "number scenarios and examples\n\n") do |n|
45
- @options[:numbers] = n
92
+ opts.separator "Reporting options: on by default but can be turned off:\n\n"
93
+ @options[:sort] = true
94
+ opts.on("--no-sort", "Do not sort tags, features, scenarios, or outlines\n") do |n|
95
+ @options[:sort] = n
46
96
  end
47
97
 
48
- @options[:tags] = []
49
- opts.on("-t", "--tags TAG_EXPRESSION", "Filter on tags for name report.\n\t\t\t\t\tTAG_EXPRESSION rules: see '$ cucumber --help' and http://github.com/aslakhellesoy/cucumber/wiki/Tags\n\n") do |t|
50
- @options[:tags] << t
98
+ @options[:number] = true
99
+ opts.on("--no-number", "Do not get or show scenario or example numbers, (i.e., do not number the leaf nodes).\n") do |n|
100
+ @options[:number] = n
51
101
  end
52
102
 
53
- @options[:report] = "tag"
54
- opts.on("-r", "--report [tag|name]", "type of report\n\t\t\t\t\tDefault: tag\n\n") do |r|
55
- @options[:report] = r
103
+ @options[:total] = true
104
+ opts.on("--no-total", "Do not get or show totals\n") do |n|
105
+ @options[:total] = n
56
106
  end
57
107
 
58
- @options[:title] = "Cucumber Scenario Inventory"
59
- opts.on("-T", "--title STRING", "title of name report\n\t\t\t\t\tDefault: 'Cucumber Scenario Inventory'\n\n") do |title|
60
- @options[:title] = title
108
+ @options[:show_tags] = true
109
+ opts.on("--no-show-tags", "Do not show cucumber tags at the feature, scenario, or outline level.\n") do |show_tags|
110
+ @options[:show_tags] = show_tags
61
111
  end
62
112
 
63
- end.parse!
113
+ @options[:show_files] = true
114
+ opts.on("--no-show-files", "Do not show feature file paths.\n") do |show_files|
115
+ @options[:show_files] = show_files
116
+ end
117
+
118
+ @options[:leaves] = true
119
+ opts.on("--no-leaves", "Show features only, with no scenarios or outlines.\n\n\n") do |l|
120
+ @options[:leaves] = l
121
+ end
64
122
 
123
+ end.parse!
65
124
 
66
125
  end
67
126
  end
68
127
  end
128
+
129
+ def self.html?
130
+ CLI::Options[:format] == 'html'
131
+ end
132
+
133
+ def self.options
134
+ CLI::Options.options
135
+ end
136
+
137
+ def self.output_file
138
+ if options[:output_file]
139
+ File.open(options[:output_file], "w")
140
+ end
141
+ end
69
142
  end