cuporter 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (25) hide show
  1. data/README.textile +22 -10
  2. data/Rakefile +1 -1
  3. data/bin/cuporter +2 -1
  4. data/lib/cuporter/cli/options.rb +28 -7
  5. data/lib/cuporter/document/html_document.rb +22 -19
  6. data/lib/cuporter/document.rb +11 -1
  7. data/public/{images → jquery.treeview/images}/ajax-loader.gif +0 -0
  8. data/public/{images → jquery.treeview/images}/file.gif +0 -0
  9. data/public/{images → jquery.treeview/images}/folder-closed.gif +0 -0
  10. data/public/{images → jquery.treeview/images}/folder.gif +0 -0
  11. data/public/{images → jquery.treeview/images}/minus.gif +0 -0
  12. data/public/{images → jquery.treeview/images}/plus.gif +0 -0
  13. data/public/{images → jquery.treeview/images}/treeview-black-line.gif +0 -0
  14. data/public/{images → jquery.treeview/images}/treeview-black.gif +0 -0
  15. data/public/{images → jquery.treeview/images}/treeview-default-line.gif +0 -0
  16. data/public/{images → jquery.treeview/images}/treeview-default.gif +0 -0
  17. data/public/{images → jquery.treeview/images}/treeview-famfamfam-line.gif +0 -0
  18. data/public/{images → jquery.treeview/images}/treeview-famfamfam.gif +0 -0
  19. data/public/{images → jquery.treeview/images}/treeview-gray-line.gif +0 -0
  20. data/public/{images → jquery.treeview/images}/treeview-gray.gif +0 -0
  21. data/public/{images → jquery.treeview/images}/treeview-red-line.gif +0 -0
  22. data/public/{images → jquery.treeview/images}/treeview-red.gif +0 -0
  23. data/public/{stylesheets → jquery.treeview}/jquery.treeview.css +15 -15
  24. data/public/{javascripts → jquery.treeview}/jquery.treeview.js +0 -0
  25. metadata +22 -22
data/README.textile CHANGED
@@ -115,34 +115,46 @@ h4. help
115
115
  $ cuporter -h
116
116
 
117
117
  Usage: cuporter [options]
118
-
118
+
119
119
  -r, --report [tag|feature|tree] View, or type of report.
120
120
  Default: "tag"
121
-
121
+
122
122
  -f, --format [xml|html|csv|text] Output format.
123
- Default: text (it's pretty, though!)
124
-
123
+ Default: text (it's pretty, though!)
124
+
125
125
  -i, --input-dir DIR Root directory of *.feature files.
126
126
  Default: "features"
127
-
127
+
128
128
  Used to build the glob pattern '[--input-dir]/**/*.feature', which is really most likely
129
129
  "features/**/*.features" and finds all feature files anywhere under "features" or
130
130
  your custom root supplied with this option.
131
131
  Overridden by "--file-input'.
132
-
132
+
133
133
  -I, --file-input FILE Single *.feature file. Full name with extension, like 'path/to/file.feature.'
134
134
  Overrides "--input-dir" and used mostly for testing.
135
-
135
+
136
136
  -o, --output-file FILE Output file path, like 'tmp/cucumber/tag_report.html'.
137
-
137
+
138
138
  -t, --tags TAG_EXPRESSION Filter on tags for name report.
139
139
  TAG_EXPRESSION rules:
140
140
  1. $ cucumber --help
141
141
  2. http://github.com/aslakhellesoy/cucumber/wiki/Tags
142
-
142
+
143
143
  -T, --title STRING Override report default title, which is different for each view/report.
144
144
  This affects the xml 'report' node title and the html head > title attributes.
145
-
145
+ CSS and Javascript asset options:
146
+
147
+ -a, --assets-dir PATH Path to folder for CSS and Javascript assets.
148
+ Only applies with '--link-assets', which is off by default.
149
+ Setting this will cause assets to be copied from 'public';
150
+ otherwise, the html will link to the files under 'cuporter/public' in
151
+ your gempath.
152
+
153
+ -l, --link-assets Do not inline CSS and js in <style/> and <script/> tags, but link to
154
+ external files instead.
155
+ Default: 'false' for the tag and feature views, not optional for the
156
+ tree view, which requires external gifs.
157
+
146
158
  Reporting options: on by default but can be turned off:
147
159
 
148
160
  --no-sort Do not sort tags, features, scenarios, or outlines
data/Rakefile CHANGED
@@ -65,7 +65,7 @@ namespace :cuporter do
65
65
 
66
66
  spec = Gem::Specification.new do |s|
67
67
  s.name = 'cuporter'
68
- s.version = '0.3.5'
68
+ s.version = '0.3.6'
69
69
  s.rubyforge_project = s.name
70
70
 
71
71
  s.platform = Gem::Platform::RUBY
data/bin/cuporter CHANGED
@@ -14,7 +14,8 @@ when 'csv'
14
14
  when 'text', 'pretty'
15
15
  report.doc.to_text
16
16
  when 'html'
17
- html = Cuporter::Document.new_html(Cuporter.options[:report])
17
+ Cuporter.options[:link_assets] = true if Cuporter.options[:report] == "tree"
18
+ html = Cuporter::Document.new_html(Cuporter.options[:report], Cuporter.options[:link_assets], Cuporter.options[:assets_dir])
18
19
  formatters = File.expand_path("../lib/cuporter/formatters", File.dirname(__FILE__))
19
20
  xslt = Nokogiri::XSLT(File.read("#{formatters}/xml_to_html.xslt"))
20
21
  html.add_report(xslt.transform(report.doc).at('.report'))
@@ -25,6 +25,15 @@ module Cuporter
25
25
  @@args
26
26
  end
27
27
 
28
+
29
+ def self.full_path(path)
30
+ expanded_path = File.expand_path(path)
31
+ path_nodes = expanded_path.split(File::SEPARATOR)
32
+ file = path_nodes.pop
33
+ FileUtils.makedirs(path_nodes.join(File::SEPARATOR))
34
+ expanded_path
35
+ end
36
+
28
37
  def self.parse
29
38
  @@args = ARGV.dup
30
39
  @options = {}
@@ -63,15 +72,9 @@ module Cuporter
63
72
  @options[:input_file] = file
64
73
  end
65
74
 
66
- @options[:output_file]
67
75
  opts.on("-o", "--output-file FILE", %Q{Output file path, like 'tmp/cucumber/tag_report.html'.
68
76
  }) do |o|
69
- full_path = File.expand_path(o)
70
- path = full_path.split(File::SEPARATOR)
71
- file = path.pop
72
- FileUtils.makedirs(path.join(File::SEPARATOR))
73
-
74
- @options[:output_file] = full_path
77
+ @options[:output_file] = full_path(o)
75
78
  end
76
79
 
77
80
  @options[:tags] = []
@@ -89,6 +92,24 @@ module Cuporter
89
92
  @options[:title] = title
90
93
  end
91
94
 
95
+ opts.separator "CSS and Javascript asset options:\n\n"
96
+ opts.on("-a", "--assets-dir PATH", %Q{Path to folder for CSS and Javascript assets.
97
+ Only applies with '--link-assets', which is off by default.
98
+ Setting this will cause assets to be copied from 'public';
99
+ otherwise, the html will link to the files under 'cuporter/public' in
100
+ your gempath.
101
+ }) do |a|
102
+ @options[:assets_dir] = full_path(a)
103
+ end
104
+
105
+ opts.on("-l", "--link-assets", %Q{Do not inline CSS and js in <style/> and <script/> tags, but link to
106
+ external files instead.
107
+ Default: 'false' for the tag and feature views, not optional for the
108
+ tree view, which requires external gifs.
109
+ }) do |l|
110
+ @options[:link_assets] = l
111
+ end
112
+
92
113
  opts.separator "Reporting options: on by default but can be turned off:\n\n"
93
114
  @options[:sort] = true
94
115
  opts.on("--no-sort", "Do not sort tags, features, scenarios, or outlines\n") do |n|
@@ -2,7 +2,7 @@
2
2
  module Cuporter
3
3
  module Document
4
4
  module Html
5
- attr_accessor :view
5
+ attr_accessor :view, :link_assets, :assets_dir
6
6
 
7
7
  def add_report(node)
8
8
  root << head(node['title'])
@@ -26,43 +26,46 @@ module Cuporter
26
26
 
27
27
  case view
28
28
  when "tree"
29
- h << link_js("jquery-min.js")
30
- h << link_js("jquery.treeview.js")
31
- h << link_css("jquery.treeview.css")
32
- h << link_js("treeview-loader.js")
33
- h << link_css("cuporter.css")
34
- h << link_css("#{view}_style.css")
29
+ h << link_js("javascripts/jquery-min.js")
30
+ h << link_js("jquery.treeview/jquery.treeview.js")
31
+ h << link_css("jquery.treeview/jquery.treeview.css")
32
+ h << link_js("javascripts/treeview-loader.js")
33
+ h << link_css("stylesheets/cuporter.css")
34
+ h << link_css("stylesheets/#{view}_style.css")
35
35
  else
36
- h << script_js("jquery-min.js")
37
- h << style_css("cuporter.css")
38
- h << style_css("#{view}_style.css")
39
- h << script_js("expand-collapse.js")
36
+ if link_assets
37
+ h << link_js("javascripts/jquery-min.js")
38
+ h << link_css("stylesheets/cuporter.css")
39
+ h << link_css("stylesheets/#{view}_style.css")
40
+ h << link_js("javascripts/expand-collapse.js")
41
+ else
42
+ h << script_js("javascripts/jquery-min.js")
43
+ h << style_css("stylesheets/cuporter.css")
44
+ h << style_css("stylesheets/#{view}_style.css")
45
+ h << script_js("javascripts/expand-collapse.js")
46
+ end
40
47
  end
41
48
  h
42
49
  end
43
50
 
44
- def assets_dir
45
- @assets_dir ||= File.expand_path('public', File.dirname(__FILE__) + "/../../../")
46
- end
47
-
48
51
  def style_css(file)
49
52
  style = new_node('style', 'type' => 'text/css')
50
- style << file_contents("#{assets_dir}/stylesheets/#{file}")
53
+ style << file_contents("#{assets_dir}/#{file}")
51
54
  style
52
55
  end
53
56
 
54
57
  def script_js(file)
55
58
  script = new_node('script', 'type' => 'text/javascript')
56
- script << file_contents("#{assets_dir}/javascripts/#{file}")
59
+ script << file_contents("#{assets_dir}/#{file}")
57
60
  script
58
61
  end
59
62
 
60
63
  def link_css(file)
61
- new_node('link', 'type' => 'text/css', 'rel' => 'stylesheet', 'href' => "#{assets_dir}/stylesheets/#{file}")
64
+ new_node('link', 'type' => 'text/css', 'rel' => 'stylesheet', 'href' => "#{assets_dir}/#{file}")
62
65
  end
63
66
 
64
67
  def link_js(file)
65
- new_node('script', 'type' => 'text/javascript', 'src' => "#{assets_dir}/javascripts/#{file}")
68
+ new_node('script', 'type' => 'text/javascript', 'src' => "#{assets_dir}/#{file}")
66
69
  end
67
70
 
68
71
  def file_contents(file_name)
@@ -10,10 +10,20 @@ module Cuporter
10
10
  doc
11
11
  end
12
12
 
13
- def self.new_html(view)
13
+ def self.new_html(view, link_assets, assets_dir)
14
14
  Nokogiri::XML::Document.send(:include, Cuporter::Document::Html)
15
15
  doc = Nokogiri::XML::Document.new
16
16
  doc.view = view
17
+ doc.link_assets = link_assets
18
+ project_assets = File.expand_path( "public", File.dirname(__FILE__) + "../../../")
19
+
20
+ # we count on the dirs being created by the option parser
21
+ if assets_dir
22
+ FileUtils.cp_r("#{project_assets}/.", assets_dir)
23
+ doc.assets_dir = assets_dir
24
+ else
25
+ doc.assets_dir = project_assets
26
+ end
17
27
  root = Nokogiri::XML::Node.new('html', doc)
18
28
  root.create_internal_subset( 'html', "-//W3C//DTD XHTML 1.0 Strict//EN", "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd")
19
29
  doc << root
File without changes
File without changes
File without changes
@@ -10,7 +10,7 @@
10
10
  }
11
11
 
12
12
  .treeview .hitarea {
13
- background: url(../images/treeview-default.gif) -64px -25px no-repeat;
13
+ background: url(images/treeview-default.gif) -64px -25px no-repeat;
14
14
  height: 16px;
15
15
  width: 16px;
16
16
  margin-left: -16px;
@@ -36,32 +36,32 @@
36
36
 
37
37
  .treeview .hover { color: red; cursor: pointer; }
38
38
 
39
- .treeview li { background: url(../images/treeview-default-line.gif) 0 0 no-repeat; }
39
+ .treeview li { background: url(images/treeview-default-line.gif) 0 0 no-repeat; }
40
40
  .treeview li.collapsable, .treeview li.expandable { background-position: 0 -176px; }
41
41
 
42
42
  .treeview .expandable-hitarea { background-position: -80px -3px; }
43
43
 
44
44
  .treeview li.last { background-position: 0 -1766px }
45
- .treeview li.lastCollapsable, .treeview li.lastExpandable { background-image: url(../images/treeview-default.gif); }
45
+ .treeview li.lastCollapsable, .treeview li.lastExpandable { background-image: url(images/treeview-default.gif); }
46
46
  .treeview li.lastCollapsable { background-position: 0 -111px }
47
47
  .treeview li.lastExpandable { background-position: -32px -67px }
48
48
 
49
49
  .treeview div.lastCollapsable-hitarea, .treeview div.lastExpandable-hitarea { background-position: 0; }
50
50
 
51
- .treeview-red li { background-image: url(../images/treeview-red-line.gif); }
52
- .treeview-red .hitarea, .treeview-red li.lastCollapsable, .treeview-red li.lastExpandable { background-image: url(../images/treeview-red.gif); }
51
+ .treeview-red li { background-image: url(images/treeview-red-line.gif); }
52
+ .treeview-red .hitarea, .treeview-red li.lastCollapsable, .treeview-red li.lastExpandable { background-image: url(images/treeview-red.gif); }
53
53
 
54
- .treeview-black li { background-image: url(../images/treeview-black-line.gif); }
55
- .treeview-black .hitarea, .treeview-black li.lastCollapsable, .treeview-black li.lastExpandable { background-image: url(../images/treeview-black.gif); }
54
+ .treeview-black li { background-image: url(images/treeview-black-line.gif); }
55
+ .treeview-black .hitarea, .treeview-black li.lastCollapsable, .treeview-black li.lastExpandable { background-image: url(images/treeview-black.gif); }
56
56
 
57
- .treeview-gray li { background-image: url(../images/treeview-gray-line.gif); }
58
- .treeview-gray .hitarea, .treeview-gray li.lastCollapsable, .treeview-gray li.lastExpandable { background-image: url(../images/treeview-gray.gif); }
57
+ .treeview-gray li { background-image: url(images/treeview-gray-line.gif); }
58
+ .treeview-gray .hitarea, .treeview-gray li.lastCollapsable, .treeview-gray li.lastExpandable { background-image: url(images/treeview-gray.gif); }
59
59
 
60
- .treeview-famfamfam li { background-image: url(../images/treeview-famfamfam-line.gif); }
61
- .treeview-famfamfam .hitarea, .treeview-famfamfam li.lastCollapsable, .treeview-famfamfam li.lastExpandable { background-image: url(../images/treeview-famfamfam.gif); }
60
+ .treeview-famfamfam li { background-image: url(images/treeview-famfamfam-line.gif); }
61
+ .treeview-famfamfam .hitarea, .treeview-famfamfam li.lastCollapsable, .treeview-famfamfam li.lastExpandable { background-image: url(images/treeview-famfamfam.gif); }
62
62
 
63
63
  .treeview .placeholder {
64
- background: url(../images/ajax-loader.gif) 0 0 no-repeat;
64
+ background: url(images/ajax-loader.gif) 0 0 no-repeat;
65
65
  height: 16px;
66
66
  width: 16px;
67
67
  display: block;
@@ -69,7 +69,7 @@
69
69
 
70
70
  .filetree li { padding: 3px 0 2px 16px; }
71
71
  .filetree span.folder, .filetree span.file { padding: 1px 0 1px 16px; display: block; }
72
- .filetree span.folder { background: url(../images/folder.gif) 0 0 no-repeat; }
73
- .filetree li.expandable span.folder { background: url(../images/folder-closed.gif) 0 0 no-repeat; }
74
- .filetree span.file { background: url(../images/file.gif) 0 0 no-repeat; }
72
+ .filetree span.folder { background: url(images/folder.gif) 0 0 no-repeat; }
73
+ .filetree li.expandable span.folder { background: url(images/folder-closed.gif) 0 0 no-repeat; }
74
+ .filetree span.file { background: url(images/file.gif) 0 0 no-repeat; }
75
75
 
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: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 5
10
- version: 0.3.5
9
+ - 6
10
+ version: 0.3.6
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: 2011-04-29 00:00:00 -04:00
18
+ date: 2011-05-08 00:00:00 -04:00
19
19
  default_executable: cuporter
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -73,31 +73,31 @@ files:
73
73
  - lib/cuporter.rb
74
74
  - lib/cuporter/formatters/xml_to_html.xslt
75
75
  - bin/cuporter
76
+ - public/jquery.treeview/jquery.treeview.css
76
77
  - public/stylesheets/cuporter.css
77
78
  - public/stylesheets/feature_style.css
78
- - public/stylesheets/jquery.treeview.css
79
79
  - public/stylesheets/tag_style.css
80
80
  - public/stylesheets/tree_style.css
81
81
  - public/javascripts/expand-collapse.js
82
82
  - public/javascripts/jquery-min.js
83
- - public/javascripts/jquery.treeview.js
84
83
  - 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
84
+ - public/jquery.treeview/jquery.treeview.js
85
+ - public/jquery.treeview/images/ajax-loader.gif
86
+ - public/jquery.treeview/images/file.gif
87
+ - public/jquery.treeview/images/folder-closed.gif
88
+ - public/jquery.treeview/images/folder.gif
89
+ - public/jquery.treeview/images/minus.gif
90
+ - public/jquery.treeview/images/plus.gif
91
+ - public/jquery.treeview/images/treeview-black-line.gif
92
+ - public/jquery.treeview/images/treeview-black.gif
93
+ - public/jquery.treeview/images/treeview-default-line.gif
94
+ - public/jquery.treeview/images/treeview-default.gif
95
+ - public/jquery.treeview/images/treeview-famfamfam-line.gif
96
+ - public/jquery.treeview/images/treeview-famfamfam.gif
97
+ - public/jquery.treeview/images/treeview-gray-line.gif
98
+ - public/jquery.treeview/images/treeview-gray.gif
99
+ - public/jquery.treeview/images/treeview-red-line.gif
100
+ - public/jquery.treeview/images/treeview-red.gif
101
101
  has_rdoc: true
102
102
  homepage: http://github.com/twcamper/cuporter
103
103
  licenses: []