epubinfo_with_toc 0.5.6 → 0.5.7
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.
- checksums.yaml +8 -8
- data/.document +5 -0
- data/.gitignore +55 -0
- data/.travis.yml +18 -0
- data/Gemfile +4 -0
- data/README.md +5 -0
- data/Rakefile +9 -0
- data/epubinfo_with_toc.gemspec +27 -0
- data/lib/epubinfo/models/cover.rb +5 -5
- data/lib/epubinfo/version.rb +3 -0
- data/spec/lib/epubinfo/models/book_spec.rb +178 -0
- data/spec/lib/epubinfo/models/cover_spec.rb +107 -0
- data/spec/lib/epubinfo/models/date_spec.rb +19 -0
- data/spec/lib/epubinfo/models/identifier_spec.rb +27 -0
- data/spec/lib/epubinfo/models/person_spec.rb +31 -0
- data/spec/lib/epubinfo/models/table_of_contents_spec.rb +115 -0
- data/spec/lib/epubinfo/parser_spec.rb +51 -0
- data/spec/lib/epubinfo/utils_spec.rb +18 -0
- data/spec/lib/epubinfo_spec.rb +23 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/support/binary/Verne_20000_West_pg11393.epub +0 -0
- data/spec/support/binary/cover.jpg +0 -0
- data/spec/support/binary/coverinroot_epub2.epub +0 -0
- data/spec/support/binary/illustrations_epub2.epub +0 -0
- data/spec/support/binary/metamorphosis_epub2.epub +0 -0
- data/spec/support/binary/metamorphosis_epub2_drm.epub +0 -0
- data/spec/support/binary/missingcoverfile_epub2.epub +0 -0
- data/spec/support/binary/nocover_epub2.epub +0 -0
- data/spec/support/binary/wasteland_epub3.epub +0 -0
- data/spec/support/binary/zip_file.zip +0 -0
- data/spec/support/xml/metamorphosis_metadata_epub2.opf +32 -0
- data/spec/support/xml/wasteland_metadata_epub3.opf +36 -0
- metadata +76 -40
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ODA5YjQzNTIyMjg5ZTg2MjkzODNkZTVhN2M3ZmYyYzIwNmFmZWI1NA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NWI2YjE1MDJlOTY3ZGE4NzQzODg2OWU1YWMzODNkNzBjMWY5NTUwYQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDE1NDVhYzA2OGRlOThhYzgxNzUxMGQxODAxNGVkMzA5MTY0MTU4YjFhMWRh
|
10
|
+
MTAyNTNjY2NlNjIyOTU3NmM4MzQyNDAzN2IxNDg4OWJjYjA2ZGQ0YWJhNjky
|
11
|
+
NGQ4OGVhZjNhMTNmNzcyM2M4MWYwN2EyMmNjMzc5OTZjZmQ5NzA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZDkwYTg4NmY1YzA5M2EzZGFmNDNhMmZkYTBlYTRhYTE2N2ExNWNjZGIxMjI2
|
14
|
+
YjQ2MzdlYzJjMDBkM2NlZWUwNmZiMTA5ZWY2MzMwNTFkMzI5Yjg2NWYzNzU5
|
15
|
+
MTI1MzA5ODFhNjljMGE3ZTc0N2IwMjc3ZDRiZTExMjAyNjQyMzc=
|
data/.document
ADDED
data/.gitignore
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# rcov generated
|
2
|
+
coverage
|
3
|
+
coverage.data
|
4
|
+
|
5
|
+
# rdoc generated
|
6
|
+
rdoc
|
7
|
+
|
8
|
+
# yard generated
|
9
|
+
doc
|
10
|
+
.yardoc
|
11
|
+
|
12
|
+
# bundler
|
13
|
+
.bundle
|
14
|
+
|
15
|
+
# jeweler generated
|
16
|
+
pkg
|
17
|
+
|
18
|
+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
19
|
+
#
|
20
|
+
# * Create a file at ~/.gitignore
|
21
|
+
# * Include files you want ignored
|
22
|
+
# * Run: git config --global core.excludesfile ~/.gitignore
|
23
|
+
#
|
24
|
+
# After doing this, these files will be ignored in all your git projects,
|
25
|
+
# saving you from having to 'pollute' every project you touch with them
|
26
|
+
#
|
27
|
+
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
28
|
+
#
|
29
|
+
# For MacOS:
|
30
|
+
#
|
31
|
+
#.DS_Store
|
32
|
+
|
33
|
+
# For TextMate
|
34
|
+
#*.tmproj
|
35
|
+
#tmtags
|
36
|
+
|
37
|
+
# For emacs:
|
38
|
+
#*~
|
39
|
+
#\#*
|
40
|
+
#.\#*
|
41
|
+
|
42
|
+
# For vim:
|
43
|
+
#*.swp
|
44
|
+
|
45
|
+
# For redcar:
|
46
|
+
#.redcar
|
47
|
+
|
48
|
+
# For rubinius:
|
49
|
+
#*.rbc
|
50
|
+
|
51
|
+
# For RubyMine
|
52
|
+
.idea
|
53
|
+
|
54
|
+
Gemfile.lock
|
55
|
+
.DS_Store
|
data/.travis.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# ----------------------------------------------------------------
|
2
|
+
# Configuration file for http://travis-ci.org/#!/chdorner/epubinfo
|
3
|
+
# ----------------------------------------------------------------
|
4
|
+
|
5
|
+
language: ruby
|
6
|
+
script: "bundle exec rake spec"
|
7
|
+
rvm:
|
8
|
+
- 1.9.3
|
9
|
+
- 2.0.0
|
10
|
+
- ruby-head
|
11
|
+
|
12
|
+
matrix:
|
13
|
+
allow_failures:
|
14
|
+
- rvm: ruby-head
|
15
|
+
|
16
|
+
before_install:
|
17
|
+
- gem install bundler
|
18
|
+
|
data/Gemfile
ADDED
data/README.md
CHANGED
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'epubinfo/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "epubinfo_with_toc"
|
8
|
+
spec.version = EpubinfoWithToc::VERSION
|
9
|
+
spec.authors = ["Christof Dorner", "Mehmet Celik"]
|
10
|
+
spec.email = ["christof@chdorner.com"]
|
11
|
+
spec.description = "Supports EPUB2 and EPUB3 formats."
|
12
|
+
spec.summary = "Supports EPUB2 and EPUB3 formats."
|
13
|
+
spec.homepage = "https://github.com/mehmetc/epubinfo/tree/table_of_contents"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "rspec", "~> 2.14.1"
|
24
|
+
|
25
|
+
spec.add_dependency "nokogiri"
|
26
|
+
spec.add_dependency "rubyzip"
|
27
|
+
end
|
@@ -75,14 +75,14 @@ module EPUBInfo
|
|
75
75
|
def epub_cover_item
|
76
76
|
@epub_cover_item ||= begin
|
77
77
|
metadata = @parser.metadata_document.css('metadata')
|
78
|
-
cover_id = (metadata.css('meta
|
78
|
+
cover_id = (metadata.css('meta[name=cover]').attr('content').value rescue nil) || 'cover-image'
|
79
79
|
|
80
80
|
manifest = @parser.metadata_document.css('manifest')
|
81
81
|
|
82
|
-
(manifest.css("item
|
83
|
-
(manifest.css("item
|
84
|
-
(manifest.css("item
|
85
|
-
(manifest.css("item
|
82
|
+
(manifest.css("item[id = \"#{cover_id}\"]").first rescue nil) ||
|
83
|
+
(manifest.css("item[properties = \"#{cover_id}\"]").first rescue nil) ||
|
84
|
+
(manifest.css("item[property = \"#{cover_id}\"]").first rescue nil) ||
|
85
|
+
(manifest.css("item[id = img-bookcover-jpeg]").first rescue nil)
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
@@ -0,0 +1,178 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe EPUBInfo::Models::Book do
|
4
|
+
describe '#initialize' do
|
5
|
+
context 'EPUB2' do
|
6
|
+
subject do
|
7
|
+
parser = EPUBInfo::Parser.parse('spec/support/binary/metamorphosis_epub2.epub')
|
8
|
+
EPUBInfo::Models::Book.new(parser)
|
9
|
+
end
|
10
|
+
|
11
|
+
its(:titles) { should == ['Metamorphosis'] }
|
12
|
+
its(:subjects) { should == ['Psychological fiction', 'Metamorphosis -- Fiction'] }
|
13
|
+
its(:description) { should == 'Classic story of self-discovery, told in a unique manner by Kafka.' }
|
14
|
+
its(:publisher) { should == 'Random House' }
|
15
|
+
its(:source) { should == 'http://www.gutenberg.org/files/5200/5200-h/5200-h.htm' }
|
16
|
+
its(:languages) { should == ['en'] }
|
17
|
+
its(:rights) { should == 'Copyrighted. Read the copyright notice inside this book for details.' }
|
18
|
+
its(:drm_protected?) { should be_false }
|
19
|
+
its(:cover) { should be_kind_of EPUBInfo::Models::Cover }
|
20
|
+
its(:table_of_contents) { should be_kind_of EPUBInfo::Models::TableOfContents }
|
21
|
+
its(:type) {should == ''}
|
22
|
+
its(:version) { should == '2.0' }
|
23
|
+
|
24
|
+
context 'creators' do
|
25
|
+
it 'count is 1' do
|
26
|
+
subject.creators.count.should == 1
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'values are of type Person' do
|
30
|
+
subject.creators.each do |creator|
|
31
|
+
creator.should be_kind_of EPUBInfo::Models::Person
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'contributors' do
|
37
|
+
it 'count is 1' do
|
38
|
+
subject.contributors.count.should == 1
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'values are of type Person' do
|
42
|
+
subject.contributors.each do |contributor|
|
43
|
+
contributor.should be_kind_of EPUBInfo::Models::Person
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context 'dates' do
|
49
|
+
it 'count is 2' do
|
50
|
+
subject.dates.count.should == 2
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'values are of type Date' do
|
54
|
+
subject.dates.each do |date|
|
55
|
+
date.should be_kind_of EPUBInfo::Models::Date
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
context 'identifiers' do
|
61
|
+
it 'count is 1' do
|
62
|
+
subject.identifiers.count.should == 1
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'values are of type Identifier' do
|
66
|
+
subject.identifiers.each do |identifier|
|
67
|
+
identifier.should be_kind_of EPUBInfo::Models::Identifier
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
context 'type' do
|
73
|
+
it 'count is 1' do
|
74
|
+
subject.type.size.should == 0
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
context 'EPUB3' do
|
80
|
+
subject do
|
81
|
+
parser = EPUBInfo::Parser.parse('spec/support/binary/wasteland_epub3.epub')
|
82
|
+
EPUBInfo::Models::Book.new(parser)
|
83
|
+
end
|
84
|
+
|
85
|
+
its(:titles) { should == ['The Waste Land'] }
|
86
|
+
its(:subjects) { should == ['Fiction'] }
|
87
|
+
its(:description) { should == 'Each facsimile page of the original manuscript is accompanied here by a typeset transcript on the facing page' }
|
88
|
+
its(:publisher) { should == 'Some Publisher' }
|
89
|
+
its(:source) { should == 'http://code.google.com/p/epub-samples/downloads/detail?name=wasteland-20120118.epub' }
|
90
|
+
its(:languages) { should == ['en-US'] }
|
91
|
+
its(:rights) { should == 'This work is shared with the public using the Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) license.' }
|
92
|
+
its(:cover) { should be_kind_of EPUBInfo::Models::Cover }
|
93
|
+
its(:table_of_contents) { should be_kind_of EPUBInfo::Models::TableOfContents }
|
94
|
+
its(:version) { should == '3.0' }
|
95
|
+
|
96
|
+
context 'creators' do
|
97
|
+
it 'count is 1' do
|
98
|
+
subject.creators.count.should == 1
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'values are of type Person' do
|
102
|
+
subject.creators.each do |creator|
|
103
|
+
creator.should be_kind_of EPUBInfo::Models::Person
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
context 'contributors' do
|
109
|
+
it 'count is 0' do
|
110
|
+
subject.contributors.count.should == 0
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
context 'dates' do
|
115
|
+
it 'count is 2' do
|
116
|
+
subject.dates.count.should == 2
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
context 'identifiers' do
|
121
|
+
it 'count is 1' do
|
122
|
+
subject.identifiers.count.should == 1
|
123
|
+
end
|
124
|
+
|
125
|
+
it 'values are of type Identifier' do
|
126
|
+
subject.identifiers.each do |identifier|
|
127
|
+
identifier.should be_kind_of EPUBInfo::Models::Identifier
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
context 'default values' do
|
136
|
+
subject { EPUBInfo::Models::Book.new(double(:metadata_document => nil)) }
|
137
|
+
|
138
|
+
its(:titles) { should == [] }
|
139
|
+
its(:creators) { should == [] }
|
140
|
+
its(:subjects) { should == [] }
|
141
|
+
its(:contributors) { should == [] }
|
142
|
+
its(:dates) { should == [] }
|
143
|
+
its(:identifiers) { should == [] }
|
144
|
+
its(:languages) { should == [] }
|
145
|
+
its(:cover) { should be_nil }
|
146
|
+
its(:table_of_contents) { should be_nil }
|
147
|
+
its(:type) { should be_nil }
|
148
|
+
end
|
149
|
+
|
150
|
+
describe '#to_hash' do
|
151
|
+
context 'keys' do
|
152
|
+
subject { EPUBInfo::Models::Book.new(EPUBInfo::Parser.parse('spec/support/binary/metamorphosis_epub2.epub')).to_hash.keys }
|
153
|
+
it { should include :titles }
|
154
|
+
it { should include :creators }
|
155
|
+
it { should include :subjects }
|
156
|
+
it { should include :description }
|
157
|
+
it { should include :publisher }
|
158
|
+
it { should include :contributors }
|
159
|
+
it { should include :dates }
|
160
|
+
it { should include :identifiers }
|
161
|
+
it { should include :source }
|
162
|
+
it { should include :languages }
|
163
|
+
it { should include :rights }
|
164
|
+
it { should include :cover }
|
165
|
+
it { should include :table_of_contents }
|
166
|
+
it { should include :type }
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
describe "read file from an IO object" do
|
171
|
+
context "from IO" do
|
172
|
+
it "should return an eBook object" do
|
173
|
+
EPUBInfo.get(File.open('spec/support/binary/coverinroot_epub2.epub')).should be_kind_of EPUBInfo::Models::Book
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
@@ -0,0 +1,107 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe EPUBInfo::Models::Cover do
|
4
|
+
describe '#new' do
|
5
|
+
context 'EPUB2' do
|
6
|
+
context 'without cover' do
|
7
|
+
it 'should return nil' do
|
8
|
+
path = 'spec/support/binary/nocover_epub2.epub'
|
9
|
+
parser = EPUBInfo::Parser.parse(path)
|
10
|
+
EPUBInfo::Models::Cover.new(parser).should be_nil
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'with missing cover image file' do
|
15
|
+
it 'should return nil' do
|
16
|
+
path = 'spec/support/binary/missingcoverfile_epub2.epub'
|
17
|
+
parser = EPUBInfo::Parser.parse(path)
|
18
|
+
EPUBInfo::Models::Cover.new(parser).should be_nil
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'with cover' do
|
23
|
+
subject do
|
24
|
+
path = 'spec/support/binary/metamorphosis_epub2.epub'
|
25
|
+
parser = EPUBInfo::Parser.parse(path)
|
26
|
+
EPUBInfo::Models::Cover.new(parser)
|
27
|
+
end
|
28
|
+
|
29
|
+
its(:content_type) { should == 'image/jpeg' }
|
30
|
+
its(:original_file_name) { should == 'cover.jpg' }
|
31
|
+
|
32
|
+
it 'should be correct File' do
|
33
|
+
subject.tempfile.should be_kind_of Tempfile
|
34
|
+
subject.tempfile.size.should == 19263
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'file should take block' do
|
38
|
+
subject.tempfile do |file|
|
39
|
+
file.should be_kind_of Tempfile
|
40
|
+
file.size.should == 19263
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'with cover in root' do
|
46
|
+
subject do
|
47
|
+
path = 'spec/support/binary/coverinroot_epub2.epub'
|
48
|
+
parser = EPUBInfo::Parser.parse(path)
|
49
|
+
EPUBInfo::Models::Cover.new(parser)
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'should have correct File' do
|
53
|
+
subject.tempfile do |file|
|
54
|
+
file.should be_kind_of Tempfile
|
55
|
+
file.size.should == 1908
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
context 'with "img-bookcover-jpeg" cover id' do
|
62
|
+
subject do
|
63
|
+
path = 'spec/support/binary/illustrations_epub2.epub'
|
64
|
+
parser = EPUBInfo::Parser.parse(path)
|
65
|
+
EPUBInfo::Models::Cover.new(parser)
|
66
|
+
end
|
67
|
+
|
68
|
+
its(:content_type) { should == 'image/jpeg' }
|
69
|
+
its(:original_file_name) { should == 'bookcover.jpg' }
|
70
|
+
|
71
|
+
it 'file should be correct File' do
|
72
|
+
subject.tempfile.should be_kind_of Tempfile
|
73
|
+
subject.tempfile.size.should == 50242
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'file should take block' do
|
77
|
+
subject.tempfile do |file|
|
78
|
+
file.should be_kind_of Tempfile
|
79
|
+
file.size.should == 50242
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
context 'EPUB3 with cover' do
|
85
|
+
subject do
|
86
|
+
path = 'spec/support/binary/wasteland_epub3.epub'
|
87
|
+
parser = EPUBInfo::Parser.parse(path)
|
88
|
+
EPUBInfo::Models::Cover.new(parser)
|
89
|
+
end
|
90
|
+
|
91
|
+
its(:content_type) { should == 'image/jpeg' }
|
92
|
+
its(:original_file_name) { should == 'wasteland-cover.jpg' }
|
93
|
+
|
94
|
+
it 'file should be correct File' do
|
95
|
+
subject.tempfile.should be_kind_of Tempfile
|
96
|
+
subject.tempfile.size.should == 103477
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'file should take block' do
|
100
|
+
subject.tempfile do |file|
|
101
|
+
file.should be_kind_of Tempfile
|
102
|
+
file.size.should == 103477
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe EPUBInfo::Models::Date do
|
4
|
+
describe '#initialize' do
|
5
|
+
subject { EPUBInfo::Models::Date.new(Nokogiri::XML(File.new('spec/support/xml/metamorphosis_metadata_epub2.opf')).remove_namespaces!.css('metadata').xpath('.//date').first) }
|
6
|
+
|
7
|
+
its(:date) { should == Date.new(2005, 8, 17) }
|
8
|
+
its(:date_str) { should == '2005-08-17' }
|
9
|
+
its(:event) { should == 'publication' }
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '#to_hash' do
|
13
|
+
context 'keys' do
|
14
|
+
subject { EPUBInfo::Models::Date.new(Nokogiri::XML(File.new('spec/support/xml/metamorphosis_metadata_epub2.opf')).remove_namespaces!.css('metadata').xpath('.//date').first).to_hash.keys }
|
15
|
+
it { should include :time }
|
16
|
+
it { should include :event }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe EPUBInfo::Models::Identifier do
|
4
|
+
describe '#initialize' do
|
5
|
+
context 'EPUB2' do
|
6
|
+
subject { EPUBInfo::Models::Identifier.new(Nokogiri::XML(File.new('spec/support/xml/metamorphosis_metadata_epub2.opf')).remove_namespaces!.css('metadata').xpath('.//identifier').first) }
|
7
|
+
|
8
|
+
its(:identifier) { should == 'http://www.gutenberg.org/ebooks/5200' }
|
9
|
+
its(:scheme) { should == 'URI' }
|
10
|
+
end
|
11
|
+
|
12
|
+
context 'EPUB3' do
|
13
|
+
subject { EPUBInfo::Models::Identifier.new(Nokogiri::XML(File.new('spec/support/xml/wasteland_metadata_epub3.opf')).remove_namespaces!.css('metadata').xpath('.//identifier').first) }
|
14
|
+
|
15
|
+
its(:identifier) { should == 'code.google.com.epub-samples.wasteland-basic' }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe '#to_hash' do
|
20
|
+
context 'keys' do
|
21
|
+
subject { EPUBInfo::Models::Identifier.new(Nokogiri::XML(File.new('spec/support/xml/metamorphosis_metadata_epub2.opf')).remove_namespaces!.css('metadata').xpath('.//identifier').first).to_hash.keys }
|
22
|
+
it { should include :identifier }
|
23
|
+
it { should include :scheme }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe EPUBInfo::Models::Person do
|
4
|
+
describe '#initialize' do
|
5
|
+
context 'creator' do
|
6
|
+
subject { EPUBInfo::Models::Person.new(Nokogiri::XML(File.new('spec/support/xml/metamorphosis_metadata_epub2.opf')).remove_namespaces!.css('metadata').xpath('.//creator').first) }
|
7
|
+
|
8
|
+
its(:name) { should == 'Franz Kafka' }
|
9
|
+
its(:file_as) { should == 'Kafka, Franz' }
|
10
|
+
its(:role) { should be_nil }
|
11
|
+
end
|
12
|
+
|
13
|
+
context 'contributor' do
|
14
|
+
subject { EPUBInfo::Models::Person.new(Nokogiri::XML(File.new('spec/support/xml/metamorphosis_metadata_epub2.opf')).remove_namespaces!.css('metadata').xpath('.//contributor').first) }
|
15
|
+
|
16
|
+
its(:name) { should == 'David Wyllie' }
|
17
|
+
its(:file_as) { should == 'Wyllie, David' }
|
18
|
+
its(:role) { should == 'trl' }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '#initialize' do
|
23
|
+
context 'keys' do
|
24
|
+
subject { EPUBInfo::Models::Person.new(Nokogiri::XML(File.new('spec/support/xml/metamorphosis_metadata_epub2.opf')).remove_namespaces!.css('metadata').xpath('.//creator').first).to_hash.keys }
|
25
|
+
it { should include :name }
|
26
|
+
it { should include :file_as }
|
27
|
+
it { should include :role }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
@@ -0,0 +1,115 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe EPUBInfo::Models::TableOfContents do
|
4
|
+
describe "#new" do
|
5
|
+
context "EPUB2" do
|
6
|
+
subject do
|
7
|
+
path = 'spec/support/binary/coverinroot_epub2.epub'
|
8
|
+
parser = EPUBInfo::Parser.parse(path)
|
9
|
+
EPUBInfo::Models::TableOfContents.new(parser)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should have a type" do
|
13
|
+
subject.type.should == 'ncx'
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should point to the TOC file" do
|
17
|
+
subject.path.should == 'epb.ncx'
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should be possible to get the raw TOC" do
|
21
|
+
subject.document.should be_kind_of Nokogiri::XML::Document
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should return the parsed TOC as a list or resources" do
|
25
|
+
subject.resources.should be_kind_of Resource
|
26
|
+
subject.resources.count.should == 4
|
27
|
+
subject.resources.spine.count.should == 1
|
28
|
+
subject.resources.images.count.should == 1
|
29
|
+
subject.resources.fonts.count.should == 0
|
30
|
+
subject.resources.videos.count.should == 0
|
31
|
+
subject.resources.types.should be_kind_of Array
|
32
|
+
subject.resources.types.count.should == 4
|
33
|
+
subject.resources.types.select {|i| i =~ /image/}.first.should eql('image/png')
|
34
|
+
subject.resources.first[:text].should.eql?('Section 1')
|
35
|
+
subject.resources[0..1].should be_kind_of Array
|
36
|
+
subject.resources[0..1].map{|m| m[:uri]}.should == ["chapter-1.xhtml", "cover-image.png"]
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'EPUB2 extended' do
|
42
|
+
subject do
|
43
|
+
path = 'spec/support/binary/Verne_20000_West_pg11393.epub'
|
44
|
+
parser = EPUBInfo::Parser.parse(path)
|
45
|
+
EPUBInfo::Models::TableOfContents.new(parser)
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should have a type" do
|
49
|
+
subject.type.should == 'ncx'
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should point to the TOC file" do
|
53
|
+
subject.path.should == 'OEBPS/toc.ncx'
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should be possible to get the raw TOC" do
|
57
|
+
subject.document.should be_kind_of Nokogiri::XML::Document
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should return the parsed TOC as a list or resources" do
|
61
|
+
subject.resources.should be_kind_of Resource
|
62
|
+
subject.resources.count.should == 6
|
63
|
+
subject.resources.spine.count.should == 3
|
64
|
+
subject.resources.images.count.should == 1
|
65
|
+
subject.resources.fonts.count.should == 0
|
66
|
+
subject.resources.videos.count.should == 0
|
67
|
+
subject.resources.types.should be_kind_of Array
|
68
|
+
subject.resources.types.count.should == 4
|
69
|
+
subject.resources.types.select {|i| i =~ /image/}.first.should eql('image/jpeg')
|
70
|
+
subject.resources.first[:text].should.eql?('Section 1')
|
71
|
+
subject.resources[0..1].should be_kind_of Array
|
72
|
+
subject.resources[0..1].map{|m| m[:uri]}.should == ["OEBPS/Styles/pgepub.css", "OEBPS/Text/www.gutenberg.org@files@11393@11393-8-0.html"]
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
context "EPUB3" do
|
80
|
+
subject do
|
81
|
+
path = 'spec/support/binary/wasteland_epub3.epub'
|
82
|
+
parser = EPUBInfo::Parser.parse(path)
|
83
|
+
EPUBInfo::Models::TableOfContents.new(parser)
|
84
|
+
end
|
85
|
+
|
86
|
+
it "should have a type" do
|
87
|
+
subject.type.should == 'ncx'
|
88
|
+
end
|
89
|
+
|
90
|
+
it "should point to the TOC file" do
|
91
|
+
subject.path.should == 'EPUB/wasteland.ncx'
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should be possible to get the raw TOC" do
|
95
|
+
subject.document.should be_kind_of Nokogiri::XML::Document
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should return the parsed TOC as a list or resources" do
|
99
|
+
subject.resources.should be_kind_of Resource
|
100
|
+
subject.resources.count.should == 6
|
101
|
+
subject.resources.spine.count.should == 1
|
102
|
+
subject.resources.images.count.should == 1
|
103
|
+
subject.resources.fonts.count.should == 0
|
104
|
+
subject.resources.videos.count.should == 0
|
105
|
+
subject.resources.types.should be_kind_of Array
|
106
|
+
subject.resources.types.count.should == 4
|
107
|
+
subject.resources.types.select {|i| i =~ /image\/jpeg/}.first.should eql('image/jpeg')
|
108
|
+
subject.resources.first[:text].should.eql?('Section 1')
|
109
|
+
subject.resources[0..1].should be_kind_of Array
|
110
|
+
subject.resources[0..1].map{|m| m[:uri]}.should == ["EPUB/wasteland-content.xhtml", "EPUB/wasteland-nav.xhtml"]
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe EPUBInfo::Parser do
|
4
|
+
let(:epub_path) { File.expand_path('spec/support/binary/metamorphosis_epub2.epub') }
|
5
|
+
subject { EPUBInfo::Parser.parse(epub_path) }
|
6
|
+
|
7
|
+
it 'exposes the path' do
|
8
|
+
subject.path.should == epub_path
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'exposes the correct metadata document' do
|
12
|
+
subject.metadata_document.should be_kind_of Nokogiri::XML::Document
|
13
|
+
id_node = subject.metadata_document.xpath('//dc:identifier').first
|
14
|
+
id_node.content.should == 'http://www.gutenberg.org/ebooks/5200'
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'exposes the metadata type' do
|
18
|
+
subject.metadata_type.should == "application/oebps-package+xml"
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'returns true for drm protected files' do
|
22
|
+
drm_path = 'spec/support/binary/metamorphosis_epub2_drm.epub'
|
23
|
+
parser = EPUBInfo::Parser.parse(drm_path)
|
24
|
+
parser.drm_protected?.should be_true
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'returns false for non-drm protected files' do
|
28
|
+
non_drm_path = 'spec/support/binary/metamorphosis_epub2.epub'
|
29
|
+
parser = EPUBInfo::Parser.parse(non_drm_path)
|
30
|
+
parser.drm_protected?.should be_false
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'unsupported file types' do
|
34
|
+
it 'raises NotAnEPUBFileError when zip but no epub file' do
|
35
|
+
lambda do
|
36
|
+
zip_path = 'spec/support/binary/zip_file.zip'
|
37
|
+
parser = EPUBInfo::Parser.parse(zip_path)
|
38
|
+
parser.metadata_document
|
39
|
+
end.should raise_error(EPUBInfo::NotAnEPUBFileError)
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'raises NotAnEPUBFileError when not even zip file' do
|
43
|
+
lambda do
|
44
|
+
image_path = 'spec/support/binary/cover.jpg'
|
45
|
+
parser = EPUBInfo::Parser.parse(image_path)
|
46
|
+
parser.metadata_document
|
47
|
+
end.should raise_error(EPUBInfo::NotAnEPUBFileError)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe EPUBInfo::Utils do
|
4
|
+
describe '#parse_iso_8601_date' do
|
5
|
+
it 'parses only year' do
|
6
|
+
EPUBInfo::Utils.parse_iso_8601_date('2012').should == Date.new(2012, 1, 1)
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'parses only year, and month' do
|
10
|
+
EPUBInfo::Utils.parse_iso_8601_date('2012-02').should == Date.new(2012, 2, 1)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'parses year, month, and day' do
|
14
|
+
EPUBInfo::Utils.parse_iso_8601_date('2012-02-03').should == Date.new(2012, 2, 3)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe EPUBInfo do
|
4
|
+
let(:epub_path) { File.expand_path('spec/support/binary/metamorphosis_epub2.epub') }
|
5
|
+
|
6
|
+
describe '#get' do
|
7
|
+
it 'calls parser' do
|
8
|
+
document = EPUBInfo::Parser.parse(epub_path).metadata_document
|
9
|
+
parser = double
|
10
|
+
parser.stub(:metadata_document)
|
11
|
+
parser.stub(:drm_protected?)
|
12
|
+
EPUBInfo::Parser.should_receive(:parse) { parser }
|
13
|
+
EPUBInfo.get(epub_path)
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'instanstiates a book model and returns it' do
|
17
|
+
book_mock = double
|
18
|
+
EPUBInfo::Models::Book.should_receive(:new) { book_mock }
|
19
|
+
EPUBInfo.get(epub_path).should == book_mock
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
begin
|
3
|
+
Bundler.setup(:default, :development)
|
4
|
+
rescue Bundler::BundlerError => e
|
5
|
+
$stderr.puts e.message
|
6
|
+
$stderr.puts 'Run `bundle install` to install missing gems'
|
7
|
+
exit e.status_code
|
8
|
+
end
|
9
|
+
|
10
|
+
require 'epubinfo'
|
11
|
+
|
12
|
+
RSpec.configure do |config|
|
13
|
+
config.filter_run :focus => true
|
14
|
+
config.run_all_when_everything_filtered = true
|
15
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
16
|
+
end
|
17
|
+
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<?xml version='1.0' encoding='UTF-8'?>
|
2
|
+
|
3
|
+
<package xmlns:opf="http://www.idpf.org/2007/opf" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="id">
|
4
|
+
<metadata>
|
5
|
+
<dc:rights>Copyrighted. Read the copyright notice inside this book for details.</dc:rights>
|
6
|
+
<dc:identifier id="id" opf:scheme="URI">http://www.gutenberg.org/ebooks/5200</dc:identifier>
|
7
|
+
<dc:contributor opf:file-as="Wyllie, David" opf:role="trl">David Wyllie</dc:contributor>
|
8
|
+
<dc:creator opf:file-as="Kafka, Franz">Franz Kafka</dc:creator>
|
9
|
+
<dc:title>Metamorphosis</dc:title>
|
10
|
+
<dc:language xsi:type="dcterms:RFC4646">en</dc:language>
|
11
|
+
<dc:subject>Psychological fiction</dc:subject>
|
12
|
+
<dc:subject>Metamorphosis -- Fiction</dc:subject>
|
13
|
+
<dc:date opf:event="publication">2005-08-17</dc:date>
|
14
|
+
<dc:date opf:event="conversion">2010-02-15T04:42:48.107119+00:00</dc:date>
|
15
|
+
<dc:source>http://www.gutenberg.org/files/5200/5200-h/5200-h.htm</dc:source>
|
16
|
+
<dc:description>Classic story of self-discovery, told in a unique manner by Kafka.</dc:description>
|
17
|
+
<dc:publisher>Random House</dc:publisher>
|
18
|
+
<meta content="item3" name="cover"/>
|
19
|
+
</metadata>
|
20
|
+
<manifest>
|
21
|
+
<item href="pgepub.css" id="item1" media-type="text/css"/>
|
22
|
+
<item href="www.gutenberg.org@files@5200@5200-h@5200-h-0.htm" id="item2" media-type="application/xhtml+xml"/>
|
23
|
+
<item href="cover.jpg" id="item3" media-type="image/jpeg"/>
|
24
|
+
<item href="toc.ncx" id="ncx" media-type="application/x-dtbncx+xml"/>
|
25
|
+
</manifest>
|
26
|
+
<spine toc="ncx">
|
27
|
+
<itemref idref="item2" linear="yes"/>
|
28
|
+
</spine>
|
29
|
+
<guide>
|
30
|
+
<reference href="cover.jpg" type="cover" title="Cover Image"/>
|
31
|
+
</guide>
|
32
|
+
</package>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<package xmlns="http://www.idpf.org/2007/opf" version="3.0" unique-identifier="uid" xml:lang="en-US" prefix="cc: http://creativecommons.org/ns#">
|
3
|
+
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/">
|
4
|
+
<dc:identifier id="uid">code.google.com.epub-samples.wasteland-basic</dc:identifier>
|
5
|
+
<dc:title>The Waste Land</dc:title>
|
6
|
+
<dc:creator>T.S. Eliot</dc:creator>
|
7
|
+
<dc:language>en-US</dc:language>
|
8
|
+
<dc:date>2011-09-01</dc:date>
|
9
|
+
<dc:subject>Fiction</dc:subject>
|
10
|
+
<dc:description>Each facsimile page of the original manuscript is accompanied here by a typeset transcript on the facing page</dc:description>
|
11
|
+
<dc:publisher>Some Publisher</dc:publisher>
|
12
|
+
<dc:source>http://code.google.com/p/epub-samples/downloads/detail?name=wasteland-20120118.epub</dc:source>
|
13
|
+
<meta property="dcterms:modified">2012-01-18T12:47:00Z</meta>
|
14
|
+
<!-- rights expressions for the work as a whole -->
|
15
|
+
<dc:rights>This work is shared with the public using the Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) license.</dc:rights>
|
16
|
+
<link rel="cc:license" href="http://creativecommons.org/licenses/by-sa/3.0/"/>
|
17
|
+
<meta property="cc:attributionURL">http://code.google.com/p/epub-samples/</meta>
|
18
|
+
<!-- rights expression for the cover image -->
|
19
|
+
<link rel="cc:license" refines="#cover" href="http://creativecommons.org/licenses/by-sa/3.0/" />
|
20
|
+
<link rel="cc:attributionURL" refines="#cover" href="http://en.wikipedia.org/wiki/Simon_Fieldhouse" />
|
21
|
+
<!-- cover meta element included for 2.0 reading system compatibility: -->
|
22
|
+
<meta name="cover" content="cover"/>
|
23
|
+
</metadata>
|
24
|
+
<manifest>
|
25
|
+
<item id="t1" href="wasteland-content.xhtml" media-type="application/xhtml+xml" />
|
26
|
+
<item id="nav" href="wasteland-nav.xhtml" properties="nav" media-type="application/xhtml+xml" />
|
27
|
+
<item id="cover" href="wasteland-cover.jpg" media-type="image/jpeg" properties="cover-image" />
|
28
|
+
<item id="css" href="wasteland.css" media-type="text/css" />
|
29
|
+
<item id="css-night" href="wasteland-night.css" media-type="text/css" />
|
30
|
+
<!-- ncx included for 2.0 reading system compatibility: -->
|
31
|
+
<item id="ncx" href="wasteland.ncx" media-type="application/x-dtbncx+xml" />
|
32
|
+
</manifest>
|
33
|
+
<spine toc="ncx">
|
34
|
+
<itemref idref="t1" />
|
35
|
+
</spine>
|
36
|
+
</package>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epubinfo_with_toc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christof Dorner
|
@@ -9,86 +9,72 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-12-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: bundler
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
18
|
- - ~>
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 1.
|
21
|
-
type: :
|
20
|
+
version: '1.7'
|
21
|
+
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ~>
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 1.
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: nokogiri
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - ! '>='
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: 1.4.2
|
35
|
-
type: :runtime
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ! '>='
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: 1.4.2
|
27
|
+
version: '1.7'
|
42
28
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
29
|
+
name: rake
|
44
30
|
requirement: !ruby/object:Gem::Requirement
|
45
31
|
requirements:
|
46
32
|
- - ~>
|
47
33
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
34
|
+
version: '10.0'
|
49
35
|
type: :development
|
50
36
|
prerelease: false
|
51
37
|
version_requirements: !ruby/object:Gem::Requirement
|
52
38
|
requirements:
|
53
39
|
- - ~>
|
54
40
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
41
|
+
version: '10.0'
|
56
42
|
- !ruby/object:Gem::Dependency
|
57
|
-
name:
|
43
|
+
name: rspec
|
58
44
|
requirement: !ruby/object:Gem::Requirement
|
59
45
|
requirements:
|
60
46
|
- - ~>
|
61
47
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
48
|
+
version: 2.14.1
|
63
49
|
type: :development
|
64
50
|
prerelease: false
|
65
51
|
version_requirements: !ruby/object:Gem::Requirement
|
66
52
|
requirements:
|
67
53
|
- - ~>
|
68
54
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
55
|
+
version: 2.14.1
|
70
56
|
- !ruby/object:Gem::Dependency
|
71
|
-
name:
|
57
|
+
name: nokogiri
|
72
58
|
requirement: !ruby/object:Gem::Requirement
|
73
59
|
requirements:
|
74
|
-
- -
|
60
|
+
- - ! '>='
|
75
61
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
77
|
-
type: :
|
62
|
+
version: '0'
|
63
|
+
type: :runtime
|
78
64
|
prerelease: false
|
79
65
|
version_requirements: !ruby/object:Gem::Requirement
|
80
66
|
requirements:
|
81
|
-
- -
|
67
|
+
- - ! '>='
|
82
68
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
69
|
+
version: '0'
|
84
70
|
- !ruby/object:Gem::Dependency
|
85
|
-
name:
|
71
|
+
name: rubyzip
|
86
72
|
requirement: !ruby/object:Gem::Requirement
|
87
73
|
requirements:
|
88
74
|
- - ! '>='
|
89
75
|
- !ruby/object:Gem::Version
|
90
76
|
version: '0'
|
91
|
-
type: :
|
77
|
+
type: :runtime
|
92
78
|
prerelease: false
|
93
79
|
version_requirements: !ruby/object:Gem::Requirement
|
94
80
|
requirements:
|
@@ -96,15 +82,20 @@ dependencies:
|
|
96
82
|
- !ruby/object:Gem::Version
|
97
83
|
version: '0'
|
98
84
|
description: Supports EPUB2 and EPUB3 formats.
|
99
|
-
email:
|
85
|
+
email:
|
86
|
+
- christof@chdorner.com
|
100
87
|
executables: []
|
101
88
|
extensions: []
|
102
|
-
extra_rdoc_files:
|
103
|
-
- LICENSE.txt
|
104
|
-
- README.md
|
89
|
+
extra_rdoc_files: []
|
105
90
|
files:
|
91
|
+
- .document
|
92
|
+
- .gitignore
|
93
|
+
- .travis.yml
|
94
|
+
- Gemfile
|
106
95
|
- LICENSE.txt
|
107
96
|
- README.md
|
97
|
+
- Rakefile
|
98
|
+
- epubinfo_with_toc.gemspec
|
108
99
|
- lib/epubinfo.rb
|
109
100
|
- lib/epubinfo/models/book.rb
|
110
101
|
- lib/epubinfo/models/cover.rb
|
@@ -116,6 +107,29 @@ files:
|
|
116
107
|
- lib/epubinfo/models/table_of_contents/resource.rb
|
117
108
|
- lib/epubinfo/parser.rb
|
118
109
|
- lib/epubinfo/utils.rb
|
110
|
+
- lib/epubinfo/version.rb
|
111
|
+
- spec/lib/epubinfo/models/book_spec.rb
|
112
|
+
- spec/lib/epubinfo/models/cover_spec.rb
|
113
|
+
- spec/lib/epubinfo/models/date_spec.rb
|
114
|
+
- spec/lib/epubinfo/models/identifier_spec.rb
|
115
|
+
- spec/lib/epubinfo/models/person_spec.rb
|
116
|
+
- spec/lib/epubinfo/models/table_of_contents_spec.rb
|
117
|
+
- spec/lib/epubinfo/parser_spec.rb
|
118
|
+
- spec/lib/epubinfo/utils_spec.rb
|
119
|
+
- spec/lib/epubinfo_spec.rb
|
120
|
+
- spec/spec_helper.rb
|
121
|
+
- spec/support/binary/Verne_20000_West_pg11393.epub
|
122
|
+
- spec/support/binary/cover.jpg
|
123
|
+
- spec/support/binary/coverinroot_epub2.epub
|
124
|
+
- spec/support/binary/illustrations_epub2.epub
|
125
|
+
- spec/support/binary/metamorphosis_epub2.epub
|
126
|
+
- spec/support/binary/metamorphosis_epub2_drm.epub
|
127
|
+
- spec/support/binary/missingcoverfile_epub2.epub
|
128
|
+
- spec/support/binary/nocover_epub2.epub
|
129
|
+
- spec/support/binary/wasteland_epub3.epub
|
130
|
+
- spec/support/binary/zip_file.zip
|
131
|
+
- spec/support/xml/metamorphosis_metadata_epub2.opf
|
132
|
+
- spec/support/xml/wasteland_metadata_epub3.opf
|
119
133
|
homepage: https://github.com/mehmetc/epubinfo/tree/table_of_contents
|
120
134
|
licenses:
|
121
135
|
- MIT
|
@@ -139,5 +153,27 @@ rubyforge_project:
|
|
139
153
|
rubygems_version: 2.2.2
|
140
154
|
signing_key:
|
141
155
|
specification_version: 4
|
142
|
-
summary:
|
143
|
-
test_files:
|
156
|
+
summary: Supports EPUB2 and EPUB3 formats.
|
157
|
+
test_files:
|
158
|
+
- spec/lib/epubinfo/models/book_spec.rb
|
159
|
+
- spec/lib/epubinfo/models/cover_spec.rb
|
160
|
+
- spec/lib/epubinfo/models/date_spec.rb
|
161
|
+
- spec/lib/epubinfo/models/identifier_spec.rb
|
162
|
+
- spec/lib/epubinfo/models/person_spec.rb
|
163
|
+
- spec/lib/epubinfo/models/table_of_contents_spec.rb
|
164
|
+
- spec/lib/epubinfo/parser_spec.rb
|
165
|
+
- spec/lib/epubinfo/utils_spec.rb
|
166
|
+
- spec/lib/epubinfo_spec.rb
|
167
|
+
- spec/spec_helper.rb
|
168
|
+
- spec/support/binary/Verne_20000_West_pg11393.epub
|
169
|
+
- spec/support/binary/cover.jpg
|
170
|
+
- spec/support/binary/coverinroot_epub2.epub
|
171
|
+
- spec/support/binary/illustrations_epub2.epub
|
172
|
+
- spec/support/binary/metamorphosis_epub2.epub
|
173
|
+
- spec/support/binary/metamorphosis_epub2_drm.epub
|
174
|
+
- spec/support/binary/missingcoverfile_epub2.epub
|
175
|
+
- spec/support/binary/nocover_epub2.epub
|
176
|
+
- spec/support/binary/wasteland_epub3.epub
|
177
|
+
- spec/support/binary/zip_file.zip
|
178
|
+
- spec/support/xml/metamorphosis_metadata_epub2.opf
|
179
|
+
- spec/support/xml/wasteland_metadata_epub3.opf
|