html-table 1.5.2 → 1.7.0

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 (59) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/{CHANGES → CHANGES.rdoc} +22 -0
  5. data/Gemfile +7 -0
  6. data/LICENSE +177 -0
  7. data/MANIFEST.rdoc +57 -0
  8. data/README.rdoc +132 -0
  9. data/Rakefile +117 -146
  10. data/doc/table.rdoc +2 -4
  11. data/html-table.gemspec +6 -7
  12. data/lib/html/caption.rb +2 -2
  13. data/lib/html/col.rb +2 -2
  14. data/lib/html/colgroup.rb +4 -4
  15. data/lib/html/content.rb +2 -2
  16. data/lib/html/data.rb +2 -2
  17. data/lib/html/header.rb +2 -2
  18. data/lib/html/mixin/attribute_handler.rb +407 -0
  19. data/lib/html/mixin/html_handler.rb +124 -0
  20. data/lib/html/mixin/strongtyping.rb +17 -0
  21. data/lib/html/mixin/tag_handler.rb +125 -0
  22. data/lib/html/row.rb +2 -2
  23. data/lib/html/table.rb +7 -7
  24. data/lib/html/tablesection.rb +2 -2
  25. data/spec/attribute_handler_spec.rb +360 -0
  26. data/spec/body_spec.rb +81 -0
  27. data/spec/caption_spec.rb +74 -0
  28. data/spec/colgroup_col_spec.rb +34 -0
  29. data/spec/colgroup_spec.rb +83 -0
  30. data/spec/data_spec.rb +72 -0
  31. data/spec/foot_spec.rb +104 -0
  32. data/spec/head_spec.rb +101 -0
  33. data/spec/header_spec.rb +72 -0
  34. data/spec/html_handler_spec.rb +32 -0
  35. data/spec/row_spec.rb +136 -0
  36. data/spec/table_spec.rb +152 -0
  37. data/spec/tablesection_spec.rb +36 -0
  38. data/spec/tag_handler_spec.rb +85 -0
  39. metadata +55 -66
  40. metadata.gz.sig +0 -0
  41. data/MANIFEST +0 -59
  42. data/README +0 -132
  43. data/lib/html/attribute_handler.rb +0 -403
  44. data/lib/html/html_handler.rb +0 -120
  45. data/lib/html/tag_handler.rb +0 -121
  46. data/test/test_attribute_handler.rb +0 -361
  47. data/test/test_body.rb +0 -87
  48. data/test/test_caption.rb +0 -80
  49. data/test/test_col.rb +0 -40
  50. data/test/test_colgroup.rb +0 -89
  51. data/test/test_data.rb +0 -77
  52. data/test/test_foot.rb +0 -111
  53. data/test/test_head.rb +0 -104
  54. data/test/test_header.rb +0 -77
  55. data/test/test_html_handler.rb +0 -37
  56. data/test/test_row.rb +0 -141
  57. data/test/test_table.rb +0 -159
  58. data/test/test_tablesection.rb +0 -42
  59. data/test/test_tag_handler.rb +0 -90
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87568bbb38d42ec54979f7ef7eaea71e4cc239816259e57ad29adc3a1379315e
4
- data.tar.gz: 22b02c5c3d5a818f8f2671f4d3f4b8b3b0fbca163f61c0206dff1fae113ab11f
3
+ metadata.gz: f8c1474767e4e76fd82d8e8dcaa3491d27a534ffc0579fde0ec2c5937ff65a94
4
+ data.tar.gz: 2d430751276ec4ba09da083f4717dea9a67b8681d9723925ab365ee0a49bc966
5
5
  SHA512:
6
- metadata.gz: db5f8612ed1deb09257bcc04f35457b88d5cdb3ee1b1da08f6bde3c1a1638773aba80c7505a9df754bc38de46fff926b811e33d65b1fa2f38194d5b463743bfa
7
- data.tar.gz: ca66a02ceac6eb5c44dd1f48943a66a82552ae2a850f8b406f9768156274038185babd912066b224a87a773f6b96a28e09141fb6498314b02980ecc99083d807
6
+ metadata.gz: 3de452df4f98b15f7be7acb6dedd1a2bc8df8e6e3993740c3e84d292355978fb4db2ec8a251a5aca6bcca795084af9baaed9fa37805e9e26ae6142e8b09c5cf1
7
+ data.tar.gz: 313c1242ece38004aa7090695beb6d125b0ee17b968eb902a4321cd7926bec0bfc3c488c698a297b957af250c726b7ad6d7790795719d65a0d5c15224dfb17f0
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,25 @@
1
+ == 1.7.0 - 8-Sep-2020
2
+ * Switched from test-unit to rspec.
3
+ * Added a Gemfile.
4
+
5
+ == 1.6.3 - 18-Mar-2020
6
+ * Fixed the LICENSE file, which inadvertently included some unrelated
7
+ copyright notices. I also removed some unnecessary boilerplate.
8
+ * Added an explicit .rdoc extension to files that were already in that format.
9
+
10
+ == 1.6.2 - 17-Mar-2020
11
+ * Include copy of Apache-2.0 license in distribution.
12
+
13
+ == 1.6.1 - 24-Feb-2019
14
+ * Namespace all the modules under HTML::Mixin to prevent potential clashes,
15
+ especially for the StrongTyping module. Thanks go to mistoo for the report.
16
+
17
+ == 1.6.0 - 16-Jan-2019
18
+ * Changed license to Apache 2.0.
19
+ * Removed strongtyping dependency, now comes bundled with a pure Ruby
20
+ version instead.
21
+ * Minor documentation updates.
22
+
1
23
  == 1.5.2 - 4-Nov-2018
2
24
  * Added metadata to gemspec.
3
25
 
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org' do
2
+ gem 'rake'
3
+ gem 'structured_warnings', '~> 0.4.0'
4
+ group 'test' do
5
+ gem 'rspec', '~> 3.9'
6
+ end
7
+ end
data/LICENSE ADDED
@@ -0,0 +1,177 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,57 @@
1
+ * CHANGES
2
+ * LICENSE
3
+ * MANIFEST
4
+ * README
5
+ * Gemfile
6
+ * Rakefile
7
+ * html-table.gemspec
8
+ * certs/djberg96_pub.pem
9
+ * doc/attributes.rdoc
10
+ * doc/table_body.rdoc
11
+ * doc/table_caption.rdoc
12
+ * doc/table_content.rdoc
13
+ * doc/table_colgroup.rdoc
14
+ * doc/table_colgroup_col.rdoc
15
+ * doc/table_foot.rdoc
16
+ * doc/table_head.rdoc
17
+ * doc/table_row_data.rdoc
18
+ * doc/table_row_header.rdoc
19
+ * doc/table_row.rdoc
20
+ * doc/table.rdoc
21
+ * doc/examples/advanced.rb
22
+ * doc/examples/intermediate1.rb
23
+ * doc/examples/intermediate2.rb
24
+ * doc/examples/intermediate3.rb
25
+ * doc/examples/simple1.rb
26
+ * doc/examples/simple2.rb
27
+ * doc/examples/simple3.rb
28
+ * lib/html-table.rb
29
+ * lib/html/body.rb
30
+ * lib/html/caption.rb
31
+ * lib/html/col.rb
32
+ * lib/html/colgroup.rb
33
+ * lib/html/content.rb
34
+ * lib/html/data.rb
35
+ * lib/html/foot.rb
36
+ * lib/html/head.rb
37
+ * lib/html/header.rb
38
+ * lib/html/row.rb
39
+ * lib/html/table.rb
40
+ * lib/html/tablesection.rb
41
+ * lib/html/mixin/attribute_handler.rb
42
+ * lib/html/mixin/html_handler.rb
43
+ * lib/html/mixin/strongtyping.rb
44
+ * lib/html/mixin/tag_handler.rb
45
+ * spec/attribute_handler_spec.rb
46
+ * spec/body_spec.rb
47
+ * spec/caption_spec.rb
48
+ * spec/col_spec.rb
49
+ * spec/colgroup_col_spec.rb
50
+ * spec/data_spec.rb
51
+ * spec/head_spec.rb
52
+ * spec/header_spec.rb
53
+ * spec/html_handler_spec.rb
54
+ * spec/row_spec.rb
55
+ * spec/table_spec.rb
56
+ * spec/tablesection_spec.rb
57
+ * spec/tag_handler_spec.rb
@@ -0,0 +1,132 @@
1
+ == Description
2
+ An interface for generating HTML Tables with Ruby.
3
+
4
+ == Installation
5
+ gem install html-table
6
+
7
+ == Synopsis
8
+ require 'html/table'
9
+ include HTML
10
+
11
+ # Explicit syntax
12
+ table = HTML::Table.new{ |t|
13
+ t.border = 1
14
+ t.bgcolor = "red"
15
+ }
16
+
17
+ # Implicit syntax
18
+ table = HTML::Table.new do
19
+ border 1
20
+ bgcolor 'red'
21
+ end
22
+
23
+ table.push Table::Row.new{ |r|
24
+ r.align = "left"
25
+ r.bgcolor = "green"
26
+ r.content = ["foo","bar","baz"]
27
+ }
28
+
29
+ row = Table::Row.new{ |r|
30
+ r.align = "right"
31
+ r.bgcolor = "blue"
32
+ r.content = "hello world"
33
+ }
34
+
35
+ table[1] = row
36
+
37
+ puts table.html
38
+
39
+ # Output
40
+ <table border=1 bgcolor='red'>
41
+ <tr align='left' bgcolor='green'> # row 0
42
+ <td>foo</td> # column 0
43
+ <td>bar</td> # column 1
44
+ <td>baz</td> # column 2
45
+ </tr>
46
+ <tr align='right' bgcolor='blue'> # row 1
47
+ <td>hello world</td> # column 0
48
+ </tr>
49
+ </table>
50
+
51
+ See the 'examples' directory under 'doc' for more examples.
52
+
53
+ == Mixins
54
+ Table is a subclass of Array, and therefore mixes in Enumerable. The
55
+ +push+, +unshift+ and []= methods have been modified. See below for details.
56
+
57
+ Table also mixes in AttributeHandler which provides methods for adding
58
+ attributes to each of the tag types. See attributes.rdoc for more details.
59
+
60
+ == Notes
61
+ A Table consists of Table::Row, Table::Caption, Table::ColGroup,
62
+ Table::Body, Table::Foot, Table::Head and Table::Row objects.
63
+
64
+ Table::Row objects in turn consist of Table::Row::Data and
65
+ Table::Row::Header objects.
66
+
67
+ Table::ColGroup objects consist of Table::ColGroup::Col
68
+ objects.
69
+
70
+ Table::Head, Table::Body and Table::Foot objects consist
71
+ of Table::Row objects.
72
+
73
+ String attributes are quoted. Numeric attributes are not.
74
+
75
+ Some attributes have type checking. Some check for valid arguments. In
76
+ the latter case, it is case-insensitive. See the documentation on
77
+ specific methods for more details.
78
+
79
+ Using a non-standard extension (e.g. "background") will emit a
80
+ NonStandardExtensionWarning. See the documentation for structured_warnings
81
+ for more information on how to control these.
82
+
83
+ == Known Bugs
84
+ None that I'm aware of. Please report bugs on the project page at:
85
+
86
+ http://github.com/djberg96/html-table
87
+
88
+ == Future Plans
89
+ None at this time.
90
+
91
+ == Acknowledgements
92
+ Anthony Peacock, for giving me ideas with his HTML::Table Perl module.
93
+ Holden Glova and Culley Harrelson for API suggestions and comments.
94
+
95
+ == License
96
+ Apache-2.0
97
+
98
+ == Copyright
99
+ (C) 2003-2020 Daniel J. Berger
100
+ All Rights Reserved
101
+
102
+ == Warranty
103
+ This package is provided "as is" and without any express or
104
+ implied warranties, including, without limitation, the implied
105
+ warranties of merchantability and fitness for a particular purpose.
106
+
107
+ == Author
108
+ Daniel J. Berger
109
+
110
+ == Developer's Notes
111
+ Some people might be a little annoyed with the fact that I use a
112
+ strongtyping library. I'm not a big fan of strong typing myself.
113
+ So, why did I do this?
114
+
115
+ Normally when creating code, you setup your own rules as far as what is
116
+ allowed as an argument. You publish the API, set up a good set of tests,
117
+ and don't bother worrying about types because you figure people can read
118
+ the API and won't go out of their way to break it. You certainly don't
119
+ worry about it yourself because you're used to dynamic languages and find
120
+ that you don't need the strong typing training wheels after all, right?
121
+
122
+ However, HTML tables have a predefined set of rules as far as what content
123
+ is valid, and where it's placed in order to be HTML compliant. For
124
+ example, if a caption is included, it should be at the 'top' of your table
125
+ syntax, you can only have one foot section, and so on. I therefore chose to
126
+ enforce these conventions and rules in Ruby via a module. I could have
127
+ lived without it, and instead chose to do a plethora of "kind_of?" checks,
128
+ but the strongtyping lib is simply more convenient all around.
129
+
130
+ UPDATE: I originally used Ryan Pavlik's strongtyping library as a dependency.
131
+ As of version 1.6.0 I now simply include a pure Ruby version with this library.
132
+ This makes it easier to work with JRuby and eliminates a dependency.
data/Rakefile CHANGED
@@ -1,146 +1,117 @@
1
- require 'rake'
2
- require 'rake/clean'
3
- require 'rake/testtask'
4
-
5
- CLEAN.include("**/*.gem", "**/*.rbc")
6
-
7
- namespace :gem do
8
- desc 'Build the html-table gem'
9
- task :create => [:clean] do
10
- require 'rubygems/package'
11
- spec = eval(IO.read('html-table.gemspec'))
12
- spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
13
- Gem::Package.build(spec, true)
14
- end
15
-
16
- desc "Install the html-table package as a gem"
17
- task :install => [:create] do
18
- file = Dir["*.gem"].first
19
- sh "gem install -l #{file}"
20
- end
21
- end
22
-
23
- namespace 'example' do
24
- desc "Run the first simple html-table example"
25
- task :simple1 do
26
- sh 'ruby -Ilib examples/simple1.rb'
27
- end
28
-
29
- desc "Run the second simple html-table example"
30
- task :simple2 do
31
- sh 'ruby -Ilib examples/simple2.rb'
32
- end
33
-
34
- desc "Run the third simple html-table example"
35
- task :simple3 do
36
- sh 'ruby -Ilib examples/simple3.rb'
37
- end
38
-
39
- desc "Run the first intermediate html-table example"
40
- task :intermediate1 do
41
- sh 'ruby -Ilib examples/intermediate1.rb'
42
- end
43
-
44
- desc "Run the second intermediate html-table example"
45
- task :intermediate2 do
46
- sh 'ruby -Ilib examples/intermediate2.rb'
47
- end
48
-
49
- desc "Run the advanced html-table example"
50
- task :advanced do
51
- sh 'ruby -Ilib examples/advanced.rb'
52
- end
53
- end
54
-
55
- Rake::TestTask.new do |t|
56
- t.warning = true
57
- t.verbose = true
58
- end
59
-
60
- namespace 'test' do
61
- Rake::TestTask.new('attribute_handler') do |t|
62
- t.warning = true
63
- t.verbose = true
64
- t.test_files = FileList['test/test_attribute_handler.rb']
65
- end
66
-
67
- Rake::TestTask.new('body') do |t|
68
- t.warning = true
69
- t.verbose = true
70
- t.test_files = FileList['test/test_body.rb']
71
- end
72
-
73
- Rake::TestTask.new('caption') do |t|
74
- t.warning = true
75
- t.verbose = true
76
- t.test_files = FileList['test/test_caption.rb']
77
- end
78
-
79
- Rake::TestTask.new('col') do |t|
80
- t.warning = true
81
- t.verbose = true
82
- t.test_files = FileList['test/test_col.rb']
83
- end
84
-
85
- Rake::TestTask.new('colgroup') do |t|
86
- t.warning = true
87
- t.verbose = true
88
- t.test_files = FileList['test/test_colgroup.rb']
89
- end
90
-
91
- Rake::TestTask.new('data') do |t|
92
- t.warning = true
93
- t.verbose = true
94
- t.test_files = FileList['test/test_data.rb']
95
- end
96
-
97
- Rake::TestTask.new('foot') do |t|
98
- t.warning = true
99
- t.verbose = true
100
- t.test_files = FileList['test/test_foot.rb']
101
- end
102
-
103
- Rake::TestTask.new('head') do |t|
104
- t.warning = true
105
- t.verbose = true
106
- t.test_files = FileList['test/test_head.rb']
107
- end
108
-
109
- Rake::TestTask.new('header') do |t|
110
- t.warning = true
111
- t.verbose = true
112
- t.test_files = FileList['test/test_header.rb']
113
- end
114
-
115
- Rake::TestTask.new('html_handler') do |t|
116
- t.warning = true
117
- t.verbose = true
118
- t.test_files = FileList['test/test_html_handler.rb']
119
- end
120
-
121
- Rake::TestTask.new('row') do |t|
122
- t.warning = true
123
- t.verbose = true
124
- t.test_files = FileList['test/test_row.rb']
125
- end
126
-
127
- Rake::TestTask.new('table') do |t|
128
- t.warning = true
129
- t.verbose = true
130
- t.test_files = FileList['test/test_table.rb']
131
- end
132
-
133
- Rake::TestTask.new('tablesection') do |t|
134
- t.warning = true
135
- t.verbose = true
136
- t.test_files = FileList['test/test_tablesection.rb']
137
- end
138
-
139
- Rake::TestTask.new('tag_handler') do |t|
140
- t.warning = true
141
- t.verbose = true
142
- t.test_files = FileList['test/test_tag_handler.rb']
143
- end
144
- end
145
-
146
- task :default => :test
1
+ require 'rake'
2
+ require 'rake/clean'
3
+ require 'rspec/core/rake_task'
4
+
5
+ CLEAN.include("**/*.gem", "**/*.rbc", "**/*.lock")
6
+
7
+ namespace :gem do
8
+ desc 'Build the html-table gem'
9
+ task :create => [:clean] do
10
+ require 'rubygems/package'
11
+ spec = eval(IO.read('html-table.gemspec'))
12
+ spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
13
+ Gem::Package.build(spec, true)
14
+ end
15
+
16
+ desc "Install the html-table package as a gem"
17
+ task :install => [:create] do
18
+ file = Dir["*.gem"].first
19
+ sh "gem install -l #{file}"
20
+ end
21
+ end
22
+
23
+ namespace 'example' do
24
+ desc "Run the first simple html-table example"
25
+ task :simple1 do
26
+ sh 'ruby -Ilib examples/simple1.rb'
27
+ end
28
+
29
+ desc "Run the second simple html-table example"
30
+ task :simple2 do
31
+ sh 'ruby -Ilib examples/simple2.rb'
32
+ end
33
+
34
+ desc "Run the third simple html-table example"
35
+ task :simple3 do
36
+ sh 'ruby -Ilib examples/simple3.rb'
37
+ end
38
+
39
+ desc "Run the first intermediate html-table example"
40
+ task :intermediate1 do
41
+ sh 'ruby -Ilib examples/intermediate1.rb'
42
+ end
43
+
44
+ desc "Run the second intermediate html-table example"
45
+ task :intermediate2 do
46
+ sh 'ruby -Ilib examples/intermediate2.rb'
47
+ end
48
+
49
+ desc "Run the advanced html-table example"
50
+ task :advanced do
51
+ sh 'ruby -Ilib examples/advanced.rb'
52
+ end
53
+ end
54
+
55
+ namespace :spec do
56
+ RSpec::Core::RakeTask.new(:attribute_handler) do |t|
57
+ t.pattern = 'spec/attribute_handler_spec.rb'
58
+ end
59
+
60
+ RSpec::Core::RakeTask.new(:body) do |t|
61
+ t.pattern = 'spec/body_spec.rb'
62
+ end
63
+
64
+ RSpec::Core::RakeTask.new(:caption) do |t|
65
+ t.pattern = 'spec/caption_spec.rb'
66
+ end
67
+
68
+ RSpec::Core::RakeTask.new(:col) do |t|
69
+ t.pattern = 'spec/col_spec.rb'
70
+ end
71
+
72
+ RSpec::Core::RakeTask.new(:colgroup) do |t|
73
+ t.pattern = 'spec/colgroup_spec.rb'
74
+ end
75
+
76
+ RSpec::Core::RakeTask.new(:data) do |t|
77
+ t.pattern = 'spec/data_spec.rb'
78
+ end
79
+
80
+ RSpec::Core::RakeTask.new(:foot) do |t|
81
+ t.pattern = 'spec/foot_spec.rb'
82
+ end
83
+
84
+ RSpec::Core::RakeTask.new(:head) do |t|
85
+ t.pattern = 'spec/head_spec.rb'
86
+ end
87
+
88
+ RSpec::Core::RakeTask.new(:header) do |t|
89
+ t.pattern = 'spec/header_spec.rb'
90
+ end
91
+
92
+ RSpec::Core::RakeTask.new(:html_handler) do |t|
93
+ t.pattern = 'spec/html_handler_spec.rb'
94
+ end
95
+
96
+ RSpec::Core::RakeTask.new(:row) do |t|
97
+ t.pattern = 'spec/row_spec.rb'
98
+ end
99
+
100
+ RSpec::Core::RakeTask.new(:table) do |t|
101
+ t.pattern = 'spec/table_spec.rb'
102
+ end
103
+
104
+ RSpec::Core::RakeTask.new(:tablesection) do |t|
105
+ t.pattern = 'spec/tablesection_spec.rb'
106
+ end
107
+
108
+ RSpec::Core::RakeTask.new(:tag_handler) do |t|
109
+ t.pattern = 'spec/tag_handler_spec.rb'
110
+ end
111
+
112
+ RSpec::Core::RakeTask.new(:all) do |t|
113
+ t.pattern = 'spec/*_spec.rb'
114
+ end
115
+ end
116
+
117
+ task :default => ['spec:all', :clean]