epub-parser 0.4.7 → 0.4.8
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 +4 -4
- data/.gitlab-ci.yml +15 -28
- data/CHANGELOG.adoc +4 -0
- data/README.adoc +4 -20
- data/epub-parser.gemspec +1 -0
- data/lib/epub/ocf/physical_container/rubyzip.rb +38 -0
- data/lib/epub/parser/version.rb +1 -1
- data/test/test_ocf_physical_container.rb +11 -0
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33ec17f68d55ead850d39f0df0ec73f0d9cda4901cdc4ee83612ebd95c0b1927
|
4
|
+
data.tar.gz: 580741918f923319e665203b8334725e48afb1c69bdb2fe7ca412cefed3477d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7683c526bc654bf55556db4d2be9efeccebc25ad29524ab14f264c85513649c0741b6b281eaa100e0cdbf93706ab1115ffca4522408299964cf1ef36136bc3be
|
7
|
+
data.tar.gz: 7522670e7f7126a33a1ea19a89577382b5f25d0555974cf1b014184d30a44be5a475467b95772f2d5386ac76f2ab4fc6720cea91f68c7ae07e562a1c3229e186
|
data/.gitlab-ci.yml
CHANGED
@@ -5,66 +5,53 @@ before_script:
|
|
5
5
|
- bundle install --jobs=$(nproc) --path=deps "${FLAGS[@]}"
|
6
6
|
- bundle clean
|
7
7
|
|
8
|
-
test:2.
|
9
|
-
image: ruby:2.
|
8
|
+
test:2.6:
|
9
|
+
image: ruby:2.6
|
10
10
|
script: bundle exec rake test XML_BACKEND=REXML 2>/dev/null && bundle exec rake test XML_BACKEND=Oga 2>/dev/null && bundle exec rake test XML_BACKEND=Nokogiri 2>/dev/null
|
11
11
|
except:
|
12
12
|
- tags
|
13
13
|
cache:
|
14
|
-
key: ruby:2.
|
14
|
+
key: ruby:2.6
|
15
15
|
paths:
|
16
16
|
- deps
|
17
17
|
|
18
|
-
test:2.
|
19
|
-
image: ruby:2.
|
18
|
+
test:2.7:
|
19
|
+
image: ruby:2.7
|
20
20
|
script: bundle exec rake test XML_BACKEND=REXML 2>/dev/null && bundle exec rake test XML_BACKEND=Oga 2>/dev/null && bundle exec rake test XML_BACKEND=Nokogiri 2>/dev/null
|
21
21
|
except:
|
22
22
|
- tags
|
23
23
|
cache:
|
24
|
-
key: ruby:2.
|
25
|
-
paths:
|
26
|
-
- deps
|
27
|
-
|
28
|
-
test:2.5:
|
29
|
-
image: ruby:2.5
|
30
|
-
script: bundle exec rake test XML_BACKEND=REXML 2>/dev/null && bundle exec rake test XML_BACKEND=Oga 2>/dev/null && bundle exec rake test XML_BACKEND=Nokogiri 2>/dev/null
|
31
|
-
except:
|
32
|
-
- tags
|
33
|
-
artifacts:
|
34
|
-
paths:
|
35
|
-
- coverage
|
36
|
-
cache:
|
37
|
-
key: ruby:2.5
|
24
|
+
key: ruby:2.7
|
38
25
|
paths:
|
39
26
|
- deps
|
40
27
|
|
41
|
-
test:
|
42
|
-
image: ruby:
|
28
|
+
test:3.0:
|
29
|
+
image: ruby:3.0
|
43
30
|
script: bundle exec rake test XML_BACKEND=REXML 2>/dev/null && bundle exec rake test XML_BACKEND=Oga 2>/dev/null && bundle exec rake test XML_BACKEND=Nokogiri 2>/dev/null
|
44
31
|
except:
|
45
32
|
- tags
|
46
33
|
cache:
|
47
|
-
key: ruby:
|
34
|
+
key: ruby:3.0
|
48
35
|
paths:
|
49
36
|
- deps
|
50
37
|
|
51
|
-
test:
|
52
|
-
image: ruby:
|
38
|
+
test:3.1:
|
39
|
+
image: ruby:3.1
|
53
40
|
script: bundle exec rake test XML_BACKEND=REXML 2>/dev/null && bundle exec rake test XML_BACKEND=Oga 2>/dev/null && bundle exec rake test XML_BACKEND=Nokogiri 2>/dev/null
|
54
41
|
except:
|
55
42
|
- tags
|
56
43
|
cache:
|
57
|
-
key: ruby:
|
44
|
+
key: ruby:3.1
|
58
45
|
paths:
|
59
46
|
- deps
|
60
47
|
|
61
|
-
test:3.
|
62
|
-
image: ruby:3.
|
48
|
+
test:3.2:
|
49
|
+
image: ruby:3.2
|
63
50
|
script: bundle exec rake test XML_BACKEND=REXML 2>/dev/null && bundle exec rake test XML_BACKEND=Oga 2>/dev/null && bundle exec rake test XML_BACKEND=Nokogiri 2>/dev/null
|
64
51
|
except:
|
65
52
|
- tags
|
66
53
|
cache:
|
67
|
-
key: ruby:3.
|
54
|
+
key: ruby:3.2
|
68
55
|
paths:
|
69
56
|
- deps
|
70
57
|
|
data/CHANGELOG.adoc
CHANGED
data/README.adoc
CHANGED
@@ -176,6 +176,10 @@ If you find other gems, please tell me or request a pull request.
|
|
176
176
|
|
177
177
|
== RECENT CHANGES
|
178
178
|
|
179
|
+
=== 0.4.8
|
180
|
+
|
181
|
+
* Add Rubyzip adapter
|
182
|
+
|
179
183
|
=== 0.4.7
|
180
184
|
|
181
185
|
* [BUG FIX]Fix a bug that epubinfo doesn't handle navigation properly
|
@@ -186,26 +190,6 @@ If you find other gems, please tell me or request a pull request.
|
|
186
190
|
* Tiny modifcation on Zip archive manipulation
|
187
191
|
* Remove version specification from Nokogiri to migrate to Ruby 3.1
|
188
192
|
|
189
|
-
=== 0.4.5
|
190
|
-
|
191
|
-
* [BUG FIX]Handle the case EPUB path is a Pathname
|
192
|
-
|
193
|
-
=== 0.4.4
|
194
|
-
|
195
|
-
* [BUG FIX]Fix navigation type check bug
|
196
|
-
* Add feature to show navigations to `epubinfo` command-line tool
|
197
|
-
|
198
|
-
=== 0.4.3
|
199
|
-
|
200
|
-
* Encode file name passed from file system on Unix
|
201
|
-
|
202
|
-
=== 0.4.2
|
203
|
-
|
204
|
-
* [BUG FIX]Fix a bug that epub-cover refers out of scope variable
|
205
|
-
|
206
|
-
* [BUG FIX]Fix a bug that `epubinfo` command with `--words` or `--chars` option causes load error if there is not Nokogiri in environment
|
207
|
-
* [BUG FIX]Fix a bug that REXML::Element#content ignores descendant nodes
|
208
|
-
|
209
193
|
See {file:CHANGELOG.adoc} for older changelogs and details.
|
210
194
|
|
211
195
|
== TODOS
|
data/epub-parser.gemspec
CHANGED
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.add_development_dependency 'rake'
|
29
29
|
s.add_development_dependency 'rubygems-tasks'
|
30
30
|
s.add_development_dependency 'zipruby' unless RUBY_PLATFORM.match /mingw|arm64-darwin/
|
31
|
+
s.add_development_dependency 'rubyzip', '>= 3.0.0.alpha'
|
31
32
|
s.add_development_dependency 'pry'
|
32
33
|
s.add_development_dependency 'pry-doc'
|
33
34
|
s.add_development_dependency 'test-unit'
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require "zip"
|
2
|
+
|
3
|
+
module EPUB
|
4
|
+
class OCF
|
5
|
+
class PhysicalContainer
|
6
|
+
class Rubyzip < self
|
7
|
+
def open
|
8
|
+
orig_encoding = Zip.force_entry_names_encoding
|
9
|
+
begin
|
10
|
+
Zip.force_entry_names_encoding = "UTF-8"
|
11
|
+
Zip::File.open @container_path do |archive|
|
12
|
+
@monitor.synchronize do
|
13
|
+
@archive = archive
|
14
|
+
begin
|
15
|
+
yield self
|
16
|
+
ensure
|
17
|
+
@archive = nil
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
ensure
|
22
|
+
Zip.force_entry_names_encoding = orig_encoding
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def read(path_name)
|
27
|
+
if @archive
|
28
|
+
@archive.read(path_name)
|
29
|
+
else
|
30
|
+
open {|container| container.read(path_name)}
|
31
|
+
end
|
32
|
+
rescue Errno::ENOENT => error
|
33
|
+
raise NoEntry.from_error(error)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/epub/parser/version.rb
CHANGED
@@ -86,6 +86,17 @@ class TestOCFPhysicalContainer < Test::Unit::TestCase
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
+
require "epub/ocf/physical_container/rubyzip"
|
90
|
+
class TestRubyzip < self
|
91
|
+
include ConcreteContainer
|
92
|
+
|
93
|
+
def setup
|
94
|
+
super
|
95
|
+
@class = EPUB::OCF::PhysicalContainer::Rubyzip
|
96
|
+
@container = @class.new(@container_path)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
89
100
|
class TestUnpackedURI < self
|
90
101
|
def setup
|
91
102
|
super
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epub-parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- KITAITI Makoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubyzip
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.0.0.alpha
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.0.0.alpha
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: pry
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -378,6 +392,7 @@ files:
|
|
378
392
|
- lib/epub/ocf/metadata.rb
|
379
393
|
- lib/epub/ocf/physical_container.rb
|
380
394
|
- lib/epub/ocf/physical_container/archive_zip.rb
|
395
|
+
- lib/epub/ocf/physical_container/rubyzip.rb
|
381
396
|
- lib/epub/ocf/physical_container/unpacked_directory.rb
|
382
397
|
- lib/epub/ocf/physical_container/unpacked_uri.rb
|
383
398
|
- lib/epub/ocf/physical_container/zipruby.rb
|
@@ -460,7 +475,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
460
475
|
- !ruby/object:Gem::Version
|
461
476
|
version: '0'
|
462
477
|
requirements: []
|
463
|
-
rubygems_version: 3.4.
|
478
|
+
rubygems_version: 3.4.22
|
464
479
|
signing_key:
|
465
480
|
specification_version: 4
|
466
481
|
summary: EPUB 3 Parser
|