epub_tools 0.4.0 → 0.4.1
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/.gitignore +1 -1
- data/.tool-versions +1 -0
- data/Gemfile.lock +25 -23
- data/README.md +10 -6
- data/lib/epub_tools/add_chapters.rb +1 -1
- data/lib/epub_tools/cli/runner.rb +2 -2
- data/lib/epub_tools/cli.rb +1 -1
- data/lib/epub_tools/version.rb +1 -1
- data/test/add_chapters_test.rb +1 -1
- data/test/cli/runner_test.rb +1 -1
- data/test/cli_commands_test.rb +1 -1
- metadata +3 -3
- data/.ruby-version +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3920ca32a1d5595866904c273c561dceec0021c259708317938e6ee6825adb3f
|
4
|
+
data.tar.gz: '0490275853356243b7b9ba25367439e6cb2fbee44ac43c71984a9b91f06e2464'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c0dfa04ad854e968f2e0ecb1ef3572f598269fedd91278602e0dd3bf524efc2358bab95b800966df175add2b9357ca4d0de366b4d21b30400d599946d299a72
|
7
|
+
data.tar.gz: df4bfb3cc82a0271ec320d523d41fcb8f36dd2b93d39419d5b719ea1bd24bf089163d80cd408dd6da16482e374567baf003e1e06e2eeee24cff844fcbbf06eaf
|
data/.gitignore
CHANGED
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 3.4.5
|
data/Gemfile.lock
CHANGED
@@ -4,41 +4,43 @@ GEM
|
|
4
4
|
ast (2.4.3)
|
5
5
|
date (3.4.1)
|
6
6
|
docile (1.4.1)
|
7
|
-
|
8
|
-
|
7
|
+
erb (5.0.2)
|
8
|
+
json (2.13.2)
|
9
|
+
language_server-protocol (3.17.0.5)
|
9
10
|
lint_roller (1.1.0)
|
10
11
|
minitest (5.25.5)
|
11
|
-
nokogiri (1.18.
|
12
|
+
nokogiri (1.18.9-aarch64-linux-gnu)
|
12
13
|
racc (~> 1.4)
|
13
|
-
nokogiri (1.18.
|
14
|
+
nokogiri (1.18.9-aarch64-linux-musl)
|
14
15
|
racc (~> 1.4)
|
15
|
-
nokogiri (1.18.
|
16
|
+
nokogiri (1.18.9-arm-linux-gnu)
|
16
17
|
racc (~> 1.4)
|
17
|
-
nokogiri (1.18.
|
18
|
+
nokogiri (1.18.9-arm-linux-musl)
|
18
19
|
racc (~> 1.4)
|
19
|
-
nokogiri (1.18.
|
20
|
+
nokogiri (1.18.9-arm64-darwin)
|
20
21
|
racc (~> 1.4)
|
21
|
-
nokogiri (1.18.
|
22
|
+
nokogiri (1.18.9-x86_64-darwin)
|
22
23
|
racc (~> 1.4)
|
23
|
-
nokogiri (1.18.
|
24
|
+
nokogiri (1.18.9-x86_64-linux-gnu)
|
24
25
|
racc (~> 1.4)
|
25
|
-
nokogiri (1.18.
|
26
|
+
nokogiri (1.18.9-x86_64-linux-musl)
|
26
27
|
racc (~> 1.4)
|
27
28
|
parallel (1.27.0)
|
28
|
-
parser (3.3.
|
29
|
+
parser (3.3.9.0)
|
29
30
|
ast (~> 2.4.1)
|
30
31
|
racc
|
31
32
|
prism (1.4.0)
|
32
|
-
psych (5.2.
|
33
|
+
psych (5.2.6)
|
33
34
|
date
|
34
35
|
stringio
|
35
36
|
racc (1.8.1)
|
36
37
|
rainbow (3.1.1)
|
37
|
-
rake (13.
|
38
|
-
rdoc (6.
|
38
|
+
rake (13.3.0)
|
39
|
+
rdoc (6.14.2)
|
40
|
+
erb
|
39
41
|
psych (>= 4.0.0)
|
40
|
-
regexp_parser (2.
|
41
|
-
rubocop (1.
|
42
|
+
regexp_parser (2.11.2)
|
43
|
+
rubocop (1.79.2)
|
42
44
|
json (~> 2.3)
|
43
45
|
language_server-protocol (~> 3.17.0.2)
|
44
46
|
lint_roller (~> 1.1.0)
|
@@ -46,13 +48,13 @@ GEM
|
|
46
48
|
parser (>= 3.3.0.2)
|
47
49
|
rainbow (>= 2.2.2, < 4.0)
|
48
50
|
regexp_parser (>= 2.9.3, < 3.0)
|
49
|
-
rubocop-ast (>= 1.
|
51
|
+
rubocop-ast (>= 1.46.0, < 2.0)
|
50
52
|
ruby-progressbar (~> 1.7)
|
51
53
|
unicode-display_width (>= 2.4.0, < 4.0)
|
52
|
-
rubocop-ast (1.
|
54
|
+
rubocop-ast (1.46.0)
|
53
55
|
parser (>= 3.3.7.2)
|
54
56
|
prism (~> 1.4)
|
55
|
-
rubocop-minitest (0.38.
|
57
|
+
rubocop-minitest (0.38.1)
|
56
58
|
lint_roller (~> 1.1)
|
57
59
|
rubocop (>= 1.75.0, < 2.0)
|
58
60
|
rubocop-ast (>= 1.38.0, < 2.0)
|
@@ -65,10 +67,10 @@ GEM
|
|
65
67
|
docile (~> 1.1)
|
66
68
|
simplecov-html (~> 0.11)
|
67
69
|
simplecov_json_formatter (~> 0.1)
|
68
|
-
simplecov-html (0.13.
|
70
|
+
simplecov-html (0.13.2)
|
69
71
|
simplecov_json_formatter (0.1.4)
|
70
72
|
stringio (3.1.7)
|
71
|
-
unicode-display_width (3.1.
|
73
|
+
unicode-display_width (3.1.5)
|
72
74
|
unicode-emoji (~> 4.0, >= 4.0.4)
|
73
75
|
unicode-emoji (4.0.4)
|
74
76
|
webrick (1.9.1)
|
@@ -98,7 +100,7 @@ DEPENDENCIES
|
|
98
100
|
yard (~> 0.9.37)
|
99
101
|
|
100
102
|
RUBY VERSION
|
101
|
-
ruby 3.4.
|
103
|
+
ruby 3.4.5p51
|
102
104
|
|
103
105
|
BUNDLED WITH
|
104
|
-
2.
|
106
|
+
2.7.0
|
data/README.md
CHANGED
@@ -1,16 +1,20 @@
|
|
1
1
|
# EPUB Tools
|
2
2
|
|
3
|
-
[](https://github.com/jaimerodas/epub_tools/actions) [](LICENSE)
|
3
|
+
[](https://github.com/jaimerodas/epub_tools/actions) [](LICENSE) [](https://badge.fury.io/rb/epub_tools)
|
4
4
|
|
5
5
|
**TL;DR:** A Ruby gem and CLI for working with EPUB files: extract, split, initialize, add chapters, pack, and unpack EPUB books.
|
6
6
|
|
7
7
|
## Installation
|
8
|
-
|
8
|
+
|
9
|
+
### Requirements
|
10
|
+
- Ruby 3.2 or higher
|
11
|
+
|
12
|
+
### Install from RubyGems
|
9
13
|
```bash
|
10
14
|
gem install epub_tools
|
11
15
|
```
|
12
16
|
|
13
|
-
|
17
|
+
### Build and install locally
|
14
18
|
```bash
|
15
19
|
bundle install
|
16
20
|
gem build epub_tools.gemspec
|
@@ -101,7 +105,7 @@ EpubTools::UnpackEbook.new('MyBook.epub', 'unpacked_dir').run
|
|
101
105
|
## Development & Testing
|
102
106
|
Clone the repo and install dependencies:
|
103
107
|
```bash
|
104
|
-
git clone
|
108
|
+
git clone https://github.com/jaimerodas/epub_tools.git
|
105
109
|
cd epub_tools
|
106
110
|
bundle install
|
107
111
|
```
|
@@ -111,9 +115,9 @@ Run tests:
|
|
111
115
|
bundle exec rake test
|
112
116
|
```
|
113
117
|
|
114
|
-
|
118
|
+
Run linting (RuboCop):
|
115
119
|
```bash
|
116
|
-
|
120
|
+
bundle exec rubocop
|
117
121
|
```
|
118
122
|
## Documentation
|
119
123
|
|
@@ -18,7 +18,7 @@ module EpubTools
|
|
18
18
|
# @option options [Boolean] :verbose Whether to log progress to STDOUT (default: false)
|
19
19
|
def initialize(options = {})
|
20
20
|
@chapters_dir = File.expand_path(options[:chapters_dir] || './chapters')
|
21
|
-
@epub_dir = File.expand_path(options[:
|
21
|
+
@epub_dir = File.expand_path(options[:oebps_dir] || './epub/OEBPS')
|
22
22
|
@opf_file = File.join(@epub_dir, 'package.opf')
|
23
23
|
@nav_file = File.join(@epub_dir, 'nav.xhtml')
|
24
24
|
@verbose = options[:verbose] || false
|
@@ -86,8 +86,8 @@ module EpubTools
|
|
86
86
|
when 'add'
|
87
87
|
builder.with_custom_options do |opts, options|
|
88
88
|
opts.on('-c DIR', '--chapters-dir DIR', 'Chapters directory (required)') { |v| options[:chapters_dir] = v }
|
89
|
-
opts.on('-e DIR', '--
|
90
|
-
options[:
|
89
|
+
opts.on('-e DIR', '--oebps-dir DIR', 'EPUB OEBPS directory (required)') do |v|
|
90
|
+
options[:oebps_dir] = v
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
data/lib/epub_tools/cli.rb
CHANGED
@@ -13,7 +13,7 @@ module EpubTools
|
|
13
13
|
|
14
14
|
# Register all commands
|
15
15
|
runner.registry.register('add', EpubTools::AddChapters,
|
16
|
-
%i[chapters_dir
|
16
|
+
%i[chapters_dir oebps_dir])
|
17
17
|
|
18
18
|
runner.registry.register('extract', EpubTools::XHTMLExtractor,
|
19
19
|
%i[source_dir target_dir],
|
data/lib/epub_tools/version.rb
CHANGED
data/test/add_chapters_test.rb
CHANGED
@@ -54,7 +54,7 @@ class AddChaptersTest < Minitest::Test
|
|
54
54
|
|
55
55
|
def test_run_moves_files_and_updates_opf_and_nav
|
56
56
|
# Run the add chapters task
|
57
|
-
result = EpubTools::AddChapters.new(chapters_dir: @chapters_dir,
|
57
|
+
result = EpubTools::AddChapters.new(chapters_dir: @chapters_dir, oebps_dir: @epub_dir).run
|
58
58
|
|
59
59
|
# Check return value is an array of moved file basenames
|
60
60
|
assert_instance_of Array, result
|
data/test/cli/runner_test.rb
CHANGED
@@ -80,7 +80,7 @@ class RunnerTest < Minitest::Test
|
|
80
80
|
|
81
81
|
# Check add command options were added
|
82
82
|
assert_includes builder.parser.to_s, '--chapters-dir DIR'
|
83
|
-
assert_includes builder.parser.to_s, '--
|
83
|
+
assert_includes builder.parser.to_s, '--oebps-dir DIR'
|
84
84
|
end
|
85
85
|
|
86
86
|
def test_run_with_unknown_command
|
data/test/cli_commands_test.rb
CHANGED
@@ -79,7 +79,7 @@ class CLICommandsTest < Minitest::Test
|
|
79
79
|
|
80
80
|
assert_match(/Usage: epub-tools add \[options\]/, output)
|
81
81
|
assert_includes output, '--chapters-dir DIR'
|
82
|
-
assert_includes output, '--
|
82
|
+
assert_includes output, '--oebps-dir DIR'
|
83
83
|
end
|
84
84
|
|
85
85
|
def test_pack_command
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epub_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jaime Rodas
|
@@ -63,7 +63,7 @@ files:
|
|
63
63
|
- ".gitignore"
|
64
64
|
- ".nova/Configuration.json"
|
65
65
|
- ".rubocop.yml"
|
66
|
-
- ".
|
66
|
+
- ".tool-versions"
|
67
67
|
- Gemfile
|
68
68
|
- Gemfile.lock
|
69
69
|
- LICENSE
|
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
|
-
rubygems_version: 3.
|
128
|
+
rubygems_version: 3.7.0
|
129
129
|
specification_version: 4
|
130
130
|
summary: Tools to extract, split, and compile EPUB books
|
131
131
|
test_files: []
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
3.4.3
|