gepub 0.6.9.1 → 0.6.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/Gemfile +1 -0
  4. data/LICENSE.txt +1 -1
  5. data/README.md +4 -3
  6. data/gepub.gemspec +3 -3
  7. data/lib/gepub/book.rb +8 -7
  8. data/lib/gepub/version.rb +1 -1
  9. data/spec/bindings_spec.rb +6 -6
  10. data/spec/builder_spec.rb +106 -106
  11. data/spec/example_spec.rb +16 -7
  12. data/spec/fixtures/{epubcheck-3.0b4 → epubcheck-3.0.1}/COPYING.txt +19 -19
  13. data/spec/fixtures/{epubcheck-3.0b4 → epubcheck-3.0.1}/README.txt +50 -61
  14. data/spec/fixtures/epubcheck-3.0.1/THIRD-PARTY.txt +20 -0
  15. data/spec/fixtures/epubcheck-3.0.1/epubcheck-3.0.1.jar +0 -0
  16. data/spec/fixtures/epubcheck-3.0.1/lib/Saxon-HE-9.4.0.6.jar +0 -0
  17. data/spec/fixtures/epubcheck-3.0.1/lib/commons-compress-1.4.1.jar +0 -0
  18. data/spec/fixtures/epubcheck-3.0.1/lib/guava-13.0.1.jar +0 -0
  19. data/spec/fixtures/{epubcheck-3.0b4/lib/jing.jar → epubcheck-3.0.1/lib/jing-20120724.0.0.jar} +0 -0
  20. data/spec/fixtures/epubcheck-3.0.1/lib/sac-1.3.jar +0 -0
  21. data/spec/fixtures/epubcheck-3.0.1/licenses/Apache-2.0.txt +201 -0
  22. data/spec/fixtures/epubcheck-3.0.1/licenses/BSD-3-Clause.txt +27 -0
  23. data/spec/fixtures/epubcheck-3.0.1/licenses/MPL-1.0.txt +360 -0
  24. data/spec/fixtures/epubcheck-3.0.1/licenses/W3C.txt +16 -0
  25. data/spec/gepub_spec.rb +60 -47
  26. data/spec/manifest_spec.rb +9 -9
  27. data/spec/metadata_spec.rb +50 -50
  28. data/spec/package_spec.rb +29 -29
  29. data/spec/spec_helper.rb +19 -0
  30. data/spec/spine_spec.rb +14 -14
  31. metadata +46 -38
  32. data/spec/fixtures/epubcheck-3.0b4/epubcheck-3.0b4.jar +0 -0
  33. data/spec/fixtures/epubcheck-3.0b4/jing_license.txt +0 -12
  34. data/spec/fixtures/epubcheck-3.0b4/lib/commons-compress-1.2.jar +0 -0
  35. data/spec/fixtures/epubcheck-3.0b4/lib/cssparser-0.9.6.jar +0 -0
  36. data/spec/fixtures/epubcheck-3.0b4/lib/sac-1.3.jar +0 -0
  37. data/spec/fixtures/epubcheck-3.0b4/lib/saxon9he.jar +0 -0
@@ -0,0 +1,360 @@
1
+ MOZILLA PUBLIC LICENSE
2
+ Version 1.0
3
+
4
+ ----------------
5
+
6
+ 1. Definitions.
7
+
8
+ 1.1. ``Contributor'' means each entity that creates or contributes to
9
+ the creation of Modifications.
10
+
11
+ 1.2. ``Contributor Version'' means the combination of the Original
12
+ Code, prior Modifications used by a Contributor, and the Modifications
13
+ made by that particular Contributor.
14
+
15
+ 1.3. ``Covered Code'' means the Original Code or Modifications or the
16
+ combination of the Original Code and Modifications, in each case
17
+ including portions thereof.
18
+
19
+ 1.4. ``Electronic Distribution Mechanism'' means a mechanism generally
20
+ accepted in the software development community for the electronic
21
+ transfer of data.
22
+
23
+ 1.5. ``Executable'' means Covered Code in any form other than Source
24
+ Code.
25
+
26
+ 1.6. ``Initial Developer'' means the individual or entity identified as
27
+ the Initial Developer in the Source Code notice required by Exhibit A.
28
+
29
+ 1.7. ``Larger Work'' means a work which combines Covered Code or
30
+ portions thereof with code not governed by the terms of this License.
31
+
32
+ 1.8. ``License'' means this document.
33
+
34
+ 1.9. ``Modifications'' means any addition to or deletion from the
35
+ substance or structure of either the Original Code or any previous
36
+ Modifications. When Covered Code is released as a series of files, a
37
+ Modification is:
38
+
39
+ A. Any addition to or deletion from the contents of a file
40
+ containing Original Code or previous Modifications.
41
+
42
+ B. Any new file that contains any part of the Original Code or
43
+ previous Modifications.
44
+
45
+ 1.10. ``Original Code'' means Source Code of computer software code
46
+ which is described in the Source Code notice required by Exhibit A as
47
+ Original Code, and which, at the time of its release under this License
48
+ is not already Covered Code governed by this License.
49
+
50
+ 1.11. ``Source Code'' means the preferred form of the Covered Code for
51
+ making modifications to it, including all modules it contains, plus any
52
+ associated interface definition files, scripts used to control
53
+ compilation and installation of an Executable, or a list of source code
54
+ differential comparisons against either the Original Code or another
55
+ well known, available Covered Code of the Contributor's choice. The
56
+ Source Code can be in a compressed or archival form, provided the
57
+ appropriate decompression or de-archiving software is widely available
58
+ for no charge.
59
+
60
+ 1.12. ``You'' means an individual or a legal entity exercising rights
61
+ under, and complying with all of the terms of, this License or a future
62
+ version of this License issued under Section 6.1. For legal entities,
63
+ ``You'' includes any entity which controls, is controlled by, or is
64
+ under common control with You. For purposes of this definition,
65
+ ``control'' means (a) the power, direct or indirect, to cause the
66
+ direction or management of such entity, whether by contract or
67
+ otherwise, or (b) ownership of fifty percent (50%) or more of the
68
+ outstanding shares or beneficial ownership of such entity.
69
+
70
+ 2. Source Code License.
71
+
72
+ 2.1. The Initial Developer Grant.
73
+ The Initial Developer hereby grants You a world-wide, royalty-free,
74
+ non-exclusive license, subject to third party intellectual property
75
+ claims:
76
+
77
+ (a) to use, reproduce, modify, display, perform, sublicense and
78
+ distribute the Original Code (or portions thereof) with or without
79
+ Modifications, or as part of a Larger Work; and
80
+
81
+ (b) under patents now or hereafter owned or controlled by Initial
82
+ Developer, to make, have made, use and sell (``Utilize'') the
83
+ Original Code (or portions thereof), but solely to the extent that
84
+ any such patent is reasonably necessary to enable You to Utilize
85
+ the Original Code (or portions thereof) and not to any greater
86
+ extent that may be necessary to Utilize further Modifications or
87
+ combinations.
88
+
89
+ 2.2. Contributor Grant.
90
+ Each Contributor hereby grants You a world-wide, royalty-free,
91
+ non-exclusive license, subject to third party intellectual property
92
+ claims:
93
+
94
+ (a) to use, reproduce, modify, display, perform, sublicense and
95
+ distribute the Modifications created by such Contributor (or
96
+ portions thereof) either on an unmodified basis, with other
97
+ Modifications, as Covered Code or as part of a Larger Work; and
98
+
99
+ (b) under patents now or hereafter owned or controlled by
100
+ Contributor, to Utilize the Contributor Version (or portions
101
+ thereof), but solely to the extent that any such patent is
102
+ reasonably necessary to enable You to Utilize the Contributor
103
+ Version (or portions thereof), and not to any greater extent that
104
+ may be necessary to Utilize further Modifications or combinations.
105
+
106
+ 3. Distribution Obligations.
107
+
108
+ 3.1. Application of License.
109
+ The Modifications which You create or to which You contribute are
110
+ governed by the terms of this License, including without limitation
111
+ Section 2.2. The Source Code version of Covered Code may be distributed
112
+ only under the terms of this License or a future version of this
113
+ License released under Section 6.1, and You must include a copy of this
114
+ License with every copy of the Source Code You distribute. You may not
115
+ offer or impose any terms on any Source Code version that alters or
116
+ restricts the applicable version of this License or the recipients'
117
+ rights hereunder. However, You may include an additional document
118
+ offering the additional rights described in Section 3.5.
119
+
120
+ 3.2. Availability of Source Code.
121
+ Any Modification which You create or to which You contribute must be
122
+ made available in Source Code form under the terms of this License
123
+ either on the same media as an Executable version or via an accepted
124
+ Electronic Distribution Mechanism to anyone to whom you made an
125
+ Executable version available; and if made available via Electronic
126
+ Distribution Mechanism, must remain available for at least twelve (12)
127
+ months after the date it initially became available, or at least six
128
+ (6) months after a subsequent version of that particular Modification
129
+ has been made available to such recipients. You are responsible for
130
+ ensuring that the Source Code version remains available even if the
131
+ Electronic Distribution Mechanism is maintained by a third party.
132
+
133
+ 3.3. Description of Modifications.
134
+ You must cause all Covered Code to which you contribute to contain a
135
+ file documenting the changes You made to create that Covered Code and
136
+ the date of any change. You must include a prominent statement that the
137
+ Modification is derived, directly or indirectly, from Original Code
138
+ provided by the Initial Developer and including the name of the Initial
139
+ Developer in (a) the Source Code, and (b) in any notice in an
140
+ Executable version or related documentation in which You describe the
141
+ origin or ownership of the Covered Code.
142
+
143
+ 3.4. Intellectual Property Matters
144
+
145
+ (a) Third Party Claims.
146
+ If You have knowledge that a party claims an intellectual property
147
+ right in particular functionality or code (or its utilization
148
+ under this License), you must include a text file with the source
149
+ code distribution titled ``LEGAL'' which describes the claim and
150
+ the party making the claim in sufficient detail that a recipient
151
+ will know whom to contact. If you obtain such knowledge after You
152
+ make Your Modification available as described in Section 3.2, You
153
+ shall promptly modify the LEGAL file in all copies You make
154
+ available thereafter and shall take other steps (such as notifying
155
+ appropriate mailing lists or newsgroups) reasonably calculated to
156
+ inform those who received the Covered Code that new knowledge has
157
+ been obtained.
158
+
159
+ (b) Contributor APIs.
160
+ If Your Modification is an application programming interface and
161
+ You own or control patents which are reasonably necessary to
162
+ implement that API, you must also include this information in the
163
+ LEGAL file.
164
+
165
+ 3.5. Required Notices.
166
+ You must duplicate the notice in Exhibit A in each file of the Source
167
+ Code, and this License in any documentation for the Source Code, where
168
+ You describe recipients' rights relating to Covered Code. If You
169
+ created one or more Modification(s), You may add your name as a
170
+ Contributor to the notice described in Exhibit A. If it is not possible
171
+ to put such notice in a particular Source Code file due to its
172
+ structure, then you must include such notice in a location (such as a
173
+ relevant directory file) where a user would be likely to look for such
174
+ a notice. You may choose to offer, and to charge a fee for, warranty,
175
+ support, indemnity or liability obligations to one or more recipients
176
+ of Covered Code. However, You may do so only on Your own behalf, and
177
+ not on behalf of the Initial Developer or any Contributor. You must
178
+ make it absolutely clear than any such warranty, support, indemnity or
179
+ liability obligation is offered by You alone, and You hereby agree to
180
+ indemnify the Initial Developer and every Contributor for any liability
181
+ incurred by the Initial Developer or such Contributor as a result of
182
+ warranty, support, indemnity or liability terms You offer.
183
+
184
+ 3.6. Distribution of Executable Versions.
185
+ You may distribute Covered Code in Executable form only if the
186
+ requirements of Section 3.1-3.5 have been met for that Covered Code,
187
+ and if You include a notice stating that the Source Code version of the
188
+ Covered Code is available under the terms of this License, including a
189
+ description of how and where You have fulfilled the obligations of
190
+ Section 3.2. The notice must be conspicuously included in any notice in
191
+ an Executable version, related documentation or collateral in which You
192
+ describe recipients' rights relating to the Covered Code. You may
193
+ distribute the Executable version of Covered Code under a license of
194
+ Your choice, which may contain terms different from this License,
195
+ provided that You are in compliance with the terms of this License and
196
+ that the license for the Executable version does not attempt to limit
197
+ or alter the recipient's rights in the Source Code version from the
198
+ rights set forth in this License. If You distribute the Executable
199
+ version under a different license You must make it absolutely clear
200
+ that any terms which differ from this License are offered by You alone,
201
+ not by the Initial Developer or any Contributor. You hereby agree to
202
+ indemnify the Initial Developer and every Contributor for any liability
203
+ incurred by the Initial Developer or such Contributor as a result of
204
+ any such terms You offer.
205
+
206
+ 3.7. Larger Works.
207
+ You may create a Larger Work by combining Covered Code with other code
208
+ not governed by the terms of this License and distribute the Larger
209
+ Work as a single product. In such a case, You must make sure the
210
+ requirements of this License are fulfilled for the Covered Code.
211
+
212
+ 4. Inability to Comply Due to Statute or Regulation.
213
+
214
+ If it is impossible for You to comply with any of the terms of this
215
+ License with respect to some or all of the Covered Code due to statute
216
+ or regulation then You must: (a) comply with the terms of this License
217
+ to the maximum extent possible; and (b) describe the limitations and
218
+ the code they affect. Such description must be included in the LEGAL
219
+ file described in Section 3.4 and must be included with all
220
+ distributions of the Source Code. Except to the extent prohibited by
221
+ statute or regulation, such description must be sufficiently detailed
222
+ for a recipient of ordinary skill to be able to understand it.
223
+
224
+ 5. Application of this License.
225
+
226
+ This License applies to code to which the Initial Developer has
227
+ attached the notice in Exhibit A, and to related Covered Code.
228
+
229
+ 6. Versions of the License.
230
+
231
+ 6.1. New Versions.
232
+ Netscape Communications Corporation (``Netscape'') may publish revised
233
+ and/or new versions of the License from time to time. Each version will
234
+ be given a distinguishing version number.
235
+
236
+ 6.2. Effect of New Versions.
237
+ Once Covered Code has been published under a particular version of the
238
+ License, You may always continue to use it under the terms of that
239
+ version. You may also choose to use such Covered Code under the terms
240
+ of any subsequent version of the License published by Netscape. No one
241
+ other than Netscape has the right to modify the terms applicable to
242
+ Covered Code created under this License.
243
+
244
+ 6.3. Derivative Works.
245
+ If you create or use a modified version of this License (which you may
246
+ only do in order to apply it to code which is not already Covered Code
247
+ governed by this License), you must (a) rename Your license so that the
248
+ phrases ``Mozilla'', ``MOZILLAPL'', ``MOZPL'', ``Netscape'', ``NPL'' or
249
+ any confusingly similar phrase do not appear anywhere in your license
250
+ and (b) otherwise make it clear that your version of the license
251
+ contains terms which differ from the Mozilla Public License and
252
+ Netscape Public License. (Filling in the name of the Initial Developer,
253
+ Original Code or Contributor in the notice described in Exhibit A shall
254
+ not of themselves be deemed to be modifications of this License.)
255
+
256
+ 7. DISCLAIMER OF WARRANTY.
257
+
258
+ COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN ``AS IS'' BASIS,
259
+ WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
260
+ WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
261
+ DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
262
+ THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
263
+ IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
264
+ YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
265
+ COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
266
+ OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
267
+ ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
268
+
269
+ 8. TERMINATION.
270
+
271
+ This License and the rights granted hereunder will terminate
272
+ automatically if You fail to comply with terms herein and fail to cure
273
+ such breach within 30 days of becoming aware of the breach. All
274
+ sublicenses to the Covered Code which are properly granted shall
275
+ survive any termination of this License. Provisions which, by their
276
+ nature, must remain in effect beyond the termination of this License
277
+ shall survive.
278
+
279
+ 9. LIMITATION OF LIABILITY.
280
+
281
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
282
+ (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL THE INITIAL
283
+ DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
284
+ OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO YOU OR ANY OTHER
285
+ PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
286
+ OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF
287
+ GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND
288
+ ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE
289
+ BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
290
+ LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
291
+ RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
292
+ PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
293
+ EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THAT
294
+ EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
295
+
296
+ 10. U.S. GOVERNMENT END USERS.
297
+
298
+ The Covered Code is a ``commercial item,'' as that term is defined in
299
+ 48 C.F.R. 2.101 (Oct. 1995), consisting of ``commercial computer
300
+ software'' and ``commercial computer software documentation,'' as such
301
+ terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
302
+ C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
303
+ all U.S. Government End Users acquire Covered Code with only those
304
+ rights set forth herein.
305
+
306
+ 11. MISCELLANEOUS.
307
+
308
+ This License represents the complete agreement concerning subject
309
+ matter hereof. If any provision of this License is held to be
310
+ unenforceable, such provision shall be reformed only to the extent
311
+ necessary to make it enforceable. This License shall be governed by
312
+ California law provisions (except to the extent applicable law, if any,
313
+ provides otherwise), excluding its conflict-of-law provisions. With
314
+ respect to disputes in which at least one party is a citizen of, or an
315
+ entity chartered or registered to do business in, the United States of
316
+ America: (a) unless otherwise agreed in writing, all disputes relating
317
+ to this License (excepting any dispute relating to intellectual
318
+ property rights) shall be subject to final and binding arbitration,
319
+ with the losing party paying all costs of arbitration; (b) any
320
+ arbitration relating to this Agreement shall be held in Santa Clara
321
+ County, California, under the auspices of JAMS/EndDispute; and (c) any
322
+ litigation relating to this Agreement shall be subject to the
323
+ jurisdiction of the Federal Courts of the Northern District of
324
+ California, with venue lying in Santa Clara County, California, with
325
+ the losing party responsible for costs, including without limitation,
326
+ court costs and reasonable attorneys fees and expenses. The application
327
+ of the United Nations Convention on Contracts for the International
328
+ Sale of Goods is expressly excluded. Any law or regulation which
329
+ provides that the language of a contract shall be construed against the
330
+ drafter shall not apply to this License.
331
+
332
+ 12. RESPONSIBILITY FOR CLAIMS.
333
+
334
+ Except in cases where another Contributor has failed to comply with
335
+ Section 3.4, You are responsible for damages arising, directly or
336
+ indirectly, out of Your utilization of rights under this License, based
337
+ on the number of copies of Covered Code you made available, the
338
+ revenues you received from utilizing such rights, and other relevant
339
+ factors. You agree to work with affected parties to distribute
340
+ responsibility on an equitable basis.
341
+
342
+ EXHIBIT A.
343
+
344
+ ``The contents of this file are subject to the Mozilla Public License
345
+ Version 1.0 (the "License"); you may not use this file except in
346
+ compliance with the License. You may obtain a copy of the License at
347
+ http://www.mozilla.org/MPL/
348
+
349
+ Software distributed under the License is distributed on an "AS IS"
350
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
351
+ License for the specific language governing rights and limitations
352
+ under the License.
353
+
354
+ The Original Code is ______________________________________.
355
+
356
+ The Initial Developer of the Original Code is ________________________.
357
+ Portions created by ______________________ are Copyright (C) ______
358
+ _______________________. All Rights Reserved.
359
+
360
+ Contributor(s): ______________________________________.''
@@ -0,0 +1,16 @@
1
+ W3C® SOFTWARE NOTICE AND LICENSE
2
+
3
+ Copyright © 1994-2002 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. http://www.w3.org/Consortium/Legal/
4
+
5
+ This W3C work (including software, documents, or other related items) is being provided by the copyright holders under the following license. By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions:
6
+
7
+ Permission to use, copy, modify, and distribute this software and its documentation, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications, that you make:
8
+
9
+ The full text of this NOTICE in a location viewable to users of the redistributed or derivative work.
10
+ Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, a short notice of the following form (hypertext is preferred, text is permitted) should be used within the body of any redistributed or derivative code: "Copyright © [$date-of-software] World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. http://www.w3.org/Consortium/Legal/"
11
+ Notice of any changes or modifications to the W3C files, including the date changes were made. (We recommend you provide URIs to the location from which the code is derived.)
12
+ THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
13
+
14
+ COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
15
+
16
+ The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders.
@@ -6,34 +6,34 @@ require 'nokogiri'
6
6
  describe GEPUB::Item do
7
7
  it "should return atttributes" do
8
8
  item = GEPUB::Item.new('theid', 'foo/bar.bar', 'application/xhtml+xml')
9
- item.itemid.should == 'theid'
10
- item.href.should == 'foo/bar.bar'
11
- item.mediatype.should == 'application/xhtml+xml'
9
+ expect(item.itemid).to eq('theid')
10
+ expect(item.href).to eq('foo/bar.bar')
11
+ expect(item.mediatype).to eq('application/xhtml+xml')
12
12
  end
13
13
 
14
14
  it "should handle html" do
15
15
  item = GEPUB::Item.new('id', 'text/foo.html')
16
- item.mediatype.should == 'application/xhtml+xml'
16
+ expect(item.mediatype).to eq('application/xhtml+xml')
17
17
  end
18
18
 
19
19
  it "should handle xhtml" do
20
20
  item = GEPUB::Item.new('id', 'text/foo.xhtml')
21
- item.mediatype.should == 'application/xhtml+xml'
21
+ expect(item.mediatype).to eq('application/xhtml+xml')
22
22
  end
23
23
 
24
24
  it "should handle JPG" do
25
25
  item = GEPUB::Item.new('id', 'img/foo.JPG')
26
- item.mediatype.should == 'image/jpeg'
26
+ expect(item.mediatype).to eq('image/jpeg')
27
27
  end
28
28
 
29
29
  it "should handle css" do
30
30
  item = GEPUB::Item.new('id', 'img/foo.css')
31
- item.mediatype.should == 'text/css'
31
+ expect(item.mediatype).to eq('text/css')
32
32
  end
33
33
 
34
34
  it "should handle javascript" do
35
35
  item = GEPUB::Item.new('id', 'js/jQuery.js')
36
- item.mediatype.should == 'text/javascript'
36
+ expect(item.mediatype).to eq('text/javascript')
37
37
  end
38
38
 
39
39
  end
@@ -53,7 +53,7 @@ describe GEPUB::Book do
53
53
  @book.spine.push(item1)
54
54
 
55
55
  item2 = @book.add_ordered_item('text/barbar.xhtml',
56
- StringIO.new('<html xmlns="http://www.w3.org/1999/xhtml"><head><title>c2</title></head><body><p>second page, whith is test chapter.</p></body></html>'),
56
+ StringIO.new('<html xmlns="http://www.w3.org/1999/xhtml"><head><title>c2</title></head><body><p>second page, whith is test chapter.</p></body></html>'),
57
57
  'c2')
58
58
  item2.toc_text 'test chapter'
59
59
 
@@ -82,57 +82,57 @@ EOF
82
82
  end
83
83
 
84
84
  it "should have titile" do
85
- @book.title.to_s.should == 'thetitle'
85
+ expect(@book.title.to_s).to eq('thetitle')
86
86
  end
87
87
 
88
88
  it "should generate correct ncx" do
89
89
  ncx = Nokogiri::XML.parse(@book.ncx_xml).root
90
- ncx.name.should == 'ncx'
91
- ncx.attributes['version'].value.should == '2005-1'
90
+ expect(ncx.name).to eq('ncx')
91
+ expect(ncx.attributes['version'].value).to eq('2005-1')
92
92
  ncx.namespaces['xmlns'] == 'http://www.daisy.org/z3986/2005/ncx/'
93
93
  end
94
94
 
95
95
  it "should have correct head in ncx" do
96
96
  head = Nokogiri::XML.parse(@book.ncx_xml).at_xpath('/xmlns:ncx/xmlns:head')
97
- head.should_not be_nil
98
- head.at_xpath("xmlns:meta[@name='dtb:uid']")['content'].should == "http://example.jp/foobar/"
99
- head.xpath("xmlns:meta[@name='dtb:depth']").size.should > 0
100
- head.xpath("xmlns:meta[@name='dtb:totalPageCount']").size.should > 0
101
- head.xpath("xmlns:meta[@name='dtb:maxPageNumber']").size.should > 0
97
+ expect(head).not_to be_nil
98
+ expect(head.at_xpath("xmlns:meta[@name='dtb:uid']")['content']).to eq("http://example.jp/foobar/")
99
+ expect(head.xpath("xmlns:meta[@name='dtb:depth']").size).to be > 0
100
+ expect(head.xpath("xmlns:meta[@name='dtb:totalPageCount']").size).to be > 0
101
+ expect(head.xpath("xmlns:meta[@name='dtb:maxPageNumber']").size).to be > 0
102
102
  end
103
103
 
104
104
  it "should have correct ncx doctitle" do
105
105
  doctitle = Nokogiri::XML.parse(@book.ncx_xml).root
106
106
 
107
- doctitle.xpath('xmlns:docTitle').size.should > 0
108
- doctitle.at_xpath('xmlns:docTitle/xmlns:text').text.should == 'thetitle'
107
+ expect(doctitle.xpath('xmlns:docTitle').size).to be > 0
108
+ expect(doctitle.at_xpath('xmlns:docTitle/xmlns:text').text).to eq('thetitle')
109
109
  end
110
110
 
111
111
  it "should correct ncx navmap" do
112
112
  ncx = Nokogiri::XML::parse(@book.ncx_xml).root
113
113
 
114
- ncx.xpath('xmlns:navMap').size.should > 0
114
+ expect(ncx.xpath('xmlns:navMap').size).to be > 0
115
115
  nav_point = ncx.at_xpath('xmlns:navMap/xmlns:navPoint')
116
- nav_point['id'].should == 'c2'
117
- nav_point['playOrder'].should == '1'
116
+ expect(nav_point['id']).to eq('c2')
117
+ expect(nav_point['playOrder']).to eq('1')
118
118
 
119
- nav_point.at_xpath('xmlns:navLabel/xmlns:text').content.should == 'test chapter'
119
+ expect(nav_point.at_xpath('xmlns:navLabel/xmlns:text').content).to eq('test chapter')
120
120
  nav_point.at_xpath('xmlns:content')['src'] == 'foobar2.html'
121
121
 
122
122
  end
123
123
 
124
124
  it "should create correct opf" do
125
125
  opf = Nokogiri::XML.parse(@book.opf_xml).root
126
- opf.name.should == 'package'
127
- opf.namespaces['xmlns'].should == 'http://www.idpf.org/2007/opf'
128
- opf['version'].should == '3.0'
129
- opf['unique-identifier'].should == 'BookId'
126
+ expect(opf.name).to eq('package')
127
+ expect(opf.namespaces['xmlns']).to eq('http://www.idpf.org/2007/opf')
128
+ expect(opf['version']).to eq('3.0')
129
+ expect(opf['unique-identifier']).to eq('BookId')
130
130
  end
131
131
 
132
132
  it "should have correct metadata in opf" do
133
133
  opf = Nokogiri::XML.parse(@book.opf_xml).root
134
134
  metadata = opf.xpath('xmlns:metadata').first
135
- metadata.at_xpath('dc:language', metadata.namespaces).content.should == 'ja'
135
+ expect(metadata.at_xpath('dc:language', metadata.namespaces).content).to eq('ja')
136
136
  #TODO: check metadata
137
137
  end
138
138
 
@@ -140,19 +140,19 @@ EOF
140
140
  opf = Nokogiri::XML.parse(@book.opf_xml).root
141
141
 
142
142
  manifest = opf.at_xpath('xmlns:manifest')
143
- manifest.at_xpath('xmlns:item[@id="c1"]')['href'].should == 'text/foobar.xhtml'
144
- manifest.at_xpath('xmlns:item[@id="c1"]')['media-type'].should == 'application/xhtml+xml'
143
+ expect(manifest.at_xpath('xmlns:item[@id="c1"]')['href']).to eq('text/foobar.xhtml')
144
+ expect(manifest.at_xpath('xmlns:item[@id="c1"]')['media-type']).to eq('application/xhtml+xml')
145
145
 
146
146
  spine = opf.at_xpath('xmlns:spine')
147
- spine['toc'].should == 'ncx'
148
- spine.at_xpath('xmlns:itemref')['idref'].should == 'c1'
147
+ expect(spine['toc']).to eq('ncx')
148
+ expect(spine.at_xpath('xmlns:itemref')['idref']).to eq('c1')
149
149
  end
150
150
 
151
151
  it "should have correct bindings in opf" do
152
152
  opf = Nokogiri::XML.parse(@book.opf_xml).root
153
153
  bindings = opf.at_xpath('xmlns:bindings')
154
- bindings.at_xpath('xmlns:mediaType')['handler'].should == @item3_id
155
- bindings.at_xpath('xmlns:mediaType')['media-type'].should == 'application/x-some-media-type'
154
+ expect(bindings.at_xpath('xmlns:mediaType')['handler']).to eq(@item3_id)
155
+ expect(bindings.at_xpath('xmlns:mediaType')['media-type']).to eq('application/x-some-media-type')
156
156
  end
157
157
 
158
158
  it "should have correct cover image id" do
@@ -162,24 +162,31 @@ EOF
162
162
 
163
163
  metadata = opf.at_xpath('xmlns:metadata')
164
164
  meta = metadata.at_xpath("xmlns:meta[@name='cover']")
165
- meta['content'].should == item.itemid
165
+ expect(meta['content']).to eq(item.itemid)
166
166
  end
167
167
 
168
168
  it "should generate correct epub" do
169
169
  epubname = File.join(File.dirname(__FILE__), 'testepub.epub')
170
170
  @book.generate_epub(epubname)
171
- jar = File.join(File.dirname(__FILE__), 'fixtures/epubcheck-3.0b4/epubcheck-3.0b4.jar')
172
- system 'java', '-jar', jar, epubname
173
- end
171
+ jar = File.join(File.dirname(__FILE__), 'fixtures/epubcheck-3.0.1/epubcheck-3.0.1.jar')
172
+ @stdout = capture(:stdout) do
173
+ puts %x(java -jar #{jar} #{epubname})
174
+ end
175
+ expect(@stdout).to include("No errors or warnings detected.")
174
176
 
177
+ end
175
178
  it "should generate correct epub with buffer" do
176
179
  epubname = File.join(File.dirname(__FILE__), 'testepub_buf.epub')
177
180
  File.open(epubname, 'wb') {
178
181
  |io|
179
182
  io.write @book.generate_epub_stream.string
180
183
  }
181
- jar = File.join(File.dirname(__FILE__), 'fixtures/epubcheck-3.0b4/epubcheck-3.0b4.jar')
182
- system 'java', '-jar', jar, epubname
184
+ jar = File.join(File.dirname(__FILE__), 'fixtures/epubcheck-3.0.1/epubcheck-3.0.1.jar')
185
+ @stdout = capture(:stdout) do
186
+ puts %x(java -jar #{jar} #{epubname})
187
+ end
188
+ expect(@stdout).to include("No errors or warnings detected.")
189
+
183
190
  end
184
191
 
185
192
  it "should generate correct epub2.0" do
@@ -196,19 +203,25 @@ EOF
196
203
  item1.add_content(StringIO.new('<html xmlns="http://www.w3.org/1999/xhtml"><head><title>c1</title></head><body><p>the first page</p></body></html>'))
197
204
  @book.spine.push(item1)
198
205
  item2 = @book.add_ordered_item('text/barbar.xhtml',
199
- StringIO.new('<html xmlns="http://www.w3.org/1999/xhtml"><head><title>c2</title></head><body><p>second page, whith is test chapter.</p></body></html>'),
200
- 'c2')
206
+ StringIO.new('<html xmlns="http://www.w3.org/1999/xhtml"><head><title>c2</title></head><body><p>second page, whith is test chapter.</p></body></html>'),
207
+ 'c2')
201
208
  item2.toc_text 'test chapter'
202
209
  @book.generate_epub(epubname)
203
- jar = File.join(File.dirname(__FILE__), 'fixtures/epubcheck-3.0b4/epubcheck-3.0b4.jar')
204
- system 'java', '-jar', jar, epubname
210
+ jar = File.join(File.dirname(__FILE__), 'fixtures/epubcheck-3.0.1/epubcheck-3.0.1.jar')
211
+ @stdout = capture(:stdout) do
212
+ puts %x(java -jar #{jar} #{epubname})
213
+ end
214
+ expect(@stdout).to include("No errors or warnings detected.")
215
+
205
216
  end
206
217
  it 'should generate epub with extra file' do
207
218
  epubname = File.join(File.dirname(__FILE__), 'testepub3.epub')
208
219
  @book.add_optional_file('META-INF/foobar.xml', StringIO.new('<foo></foo>'))
209
220
  @book.generate_epub(epubname)
210
- jar = File.join(File.dirname(__FILE__), 'fixtures/epubcheck-3.0b4/epubcheck-3.0b4.jar')
211
- system 'java', '-jar', jar, epubname
221
+ jar = File.join(File.dirname(__FILE__), 'fixtures/epubcheck-3.0.1/epubcheck-3.0.1.jar')
222
+ @stdout = capture(:stdout) do
223
+ puts %x(java -jar #{jar} #{epubname})
224
+ end
225
+ expect(@stdout).to include("No errors or warnings detected.")
212
226
  end
213
-
214
227
  end