kindlegen 3.0.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.github/workflows/ci.yml +19 -0
- data/.gitignore +1 -0
- data/README.md +7 -4
- data/ext/Rakefile +30 -17
- data/kindlegen.gemspec +2 -2
- data/lib/kindlegen/version.rb +1 -1
- metadata +6 -7
- data/.travis.yml +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: aa25bd7075e56327aa57252627e4a6942304a962119ccf1dcc6b60db0d6e468c
|
4
|
+
data.tar.gz: 91d23647cfbb87f27343e961d656eac991d8384b7873bc9fdd784ad3d5dc96ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72280f6dae8e5082161340c186d27946149f3236fd65b00d5c7e016efd9844e203ed649db55c8021608b0c44c089ce638bee7ffd2e4622f394b90b25e55ba772
|
7
|
+
data.tar.gz: c24c8be58fd34494fe4d4b0b80e5caec846053ff604e7d9fa693ca0af8fae798d4e532e11b9a3c355b210cc64b36bc0f564afba577c5b4a47903acef31acdbe7
|
@@ -0,0 +1,19 @@
|
|
1
|
+
name: CI
|
2
|
+
on: [push, pull_request]
|
3
|
+
|
4
|
+
jobs:
|
5
|
+
build:
|
6
|
+
strategy:
|
7
|
+
matrix:
|
8
|
+
ruby: [2.4, 2.5, 2.6, 2.7]
|
9
|
+
# TODO: https://github.com/tdtds/kindlegen/issues/36
|
10
|
+
# Add macos-latest when kindlegen is fixed to work on Catalina
|
11
|
+
platform: [ubuntu-latest, windows-latest]
|
12
|
+
runs-on: ${{ matrix.platform }}
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v2
|
15
|
+
- uses: ruby/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
ruby-version: ${{ matrix.ruby }}
|
18
|
+
- run: bundle install --jobs 4 --retry 3
|
19
|
+
- run: bundle exec rake build test
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -12,12 +12,15 @@ Require `kindlegen`, then run kindlegen commands.
|
|
12
12
|
|
13
13
|
Returns the path of the kindlegen command.
|
14
14
|
|
15
|
-
### Kindlegen.run(
|
15
|
+
### Kindlegen.run(*args)
|
16
16
|
|
17
17
|
Runs the kindlegen command with specified parameters.
|
18
18
|
|
19
19
|
### Example
|
20
20
|
require 'kindlegen'
|
21
|
-
Kindlegen.run("sample.opf", "-o", "sample.mobi")
|
22
|
-
|
23
|
-
|
21
|
+
stdout, stderr, status = Kindlegen.run("sample.opf", "-o", "sample.mobi")
|
22
|
+
if status == 0
|
23
|
+
puts stdout
|
24
|
+
else
|
25
|
+
$stderr.puts stderr
|
26
|
+
end
|
data/ext/Rakefile
CHANGED
@@ -4,8 +4,8 @@
|
|
4
4
|
#
|
5
5
|
require 'rbconfig'
|
6
6
|
require 'fileutils'
|
7
|
+
require 'open-uri'
|
7
8
|
|
8
|
-
AMAZON = 'http://kindlegen.s3.amazonaws.com'
|
9
9
|
BINDIR = '../bin'
|
10
10
|
|
11
11
|
def create_default_task(target)
|
@@ -18,29 +18,42 @@ def create_default_task(target)
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def create_task_for_unix(config)
|
21
|
+
require 'rubygems/package'
|
22
|
+
require 'zlib'
|
23
|
+
|
21
24
|
tarball = config[:tarball]
|
22
|
-
unzip = config[:unzip]
|
23
25
|
target = config[:target]
|
24
|
-
url =
|
26
|
+
url = ENV['KINDLEGEN_TARBALL_URL'] || config[:url]
|
25
27
|
|
26
28
|
create_default_task(target)
|
27
29
|
|
28
30
|
file target => tarball do
|
29
|
-
|
30
|
-
|
31
|
+
Gem::Package::TarReader.new(Zlib::GzipReader.open(tarball)) do |tar|
|
32
|
+
tar.each do |entry|
|
33
|
+
next unless entry.file?
|
34
|
+
next if File.exist?(entry.full_name)
|
35
|
+
|
36
|
+
dir = File.dirname(entry.full_name)
|
37
|
+
FileUtils.mkpath(dir) if dir != '.' && !File.exist?(dir)
|
38
|
+
File.open(entry.full_name, 'wb') do |f|
|
39
|
+
f.write(entry.read)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
File.chmod(0o755, target)
|
31
44
|
end
|
32
45
|
|
33
46
|
file tarball do
|
34
|
-
|
47
|
+
curl(url, tarball)
|
35
48
|
end
|
36
49
|
end
|
37
50
|
|
38
|
-
# curl for windows
|
39
51
|
def curl(url, tarball)
|
40
52
|
puts "open(#{url})"
|
41
53
|
puts "save to #{tarball}"
|
42
|
-
|
43
|
-
|
54
|
+
open(url) do |file|
|
55
|
+
IO.copy_stream(file, tarball)
|
56
|
+
end
|
44
57
|
end
|
45
58
|
|
46
59
|
# unzip for windows
|
@@ -49,17 +62,16 @@ def unzip(tarball)
|
|
49
62
|
Zip::File.open(tarball).each do |entry|
|
50
63
|
dir = File.dirname(entry.name)
|
51
64
|
FileUtils.mkpath(dir) if dir != '.' && !File.exist?(dir)
|
52
|
-
entry.extract unless File.exist?(entry.name)
|
65
|
+
entry.extract(dest_path=entry.name) unless File.exist?(entry.name)
|
53
66
|
end
|
54
67
|
end
|
55
68
|
|
56
69
|
def create_task_for_windows(config)
|
57
|
-
require 'open-uri'
|
58
70
|
require 'zip'
|
59
71
|
|
60
72
|
tarball = config[:tarball]
|
61
73
|
target = config[:target]
|
62
|
-
url =
|
74
|
+
url = ENV['KINDLEGEN_TARBALL_URL'] || config[:url]
|
63
75
|
|
64
76
|
create_default_task(target)
|
65
77
|
|
@@ -76,17 +88,18 @@ case RbConfig::CONFIG['host_os']
|
|
76
88
|
when /mac|darwin/i
|
77
89
|
create_task_for_unix(
|
78
90
|
{ tarball: 'KindleGen_Mac_i386_v2_9.zip',
|
79
|
-
|
80
|
-
|
91
|
+
target: 'kindlegen',
|
92
|
+
url: 'https://web.archive.org/web/20200814013519/https://kindlegen.s3.amazonaws.com/KindleGen_Mac_i386_v2_9.zip' })
|
81
93
|
when /linux|cygwin/i
|
82
94
|
create_task_for_unix(
|
83
95
|
{ tarball: 'kindlegen_linux_2.6_i386_v2_9.tar.gz',
|
84
|
-
|
85
|
-
|
96
|
+
target: 'kindlegen',
|
97
|
+
url: 'https://web.archive.org/web/20150803131026/https://kindlegen.s3.amazonaws.com/kindlegen_linux_2.6_i386_v2_9.tar.gz' })
|
86
98
|
when /mingw32|mswin32/i
|
87
99
|
create_task_for_windows(
|
88
100
|
{ tarball: 'kindlegen_win32_v2_9.zip',
|
89
|
-
target: 'kindlegen.exe'
|
101
|
+
target: 'kindlegen.exe',
|
102
|
+
url: 'http://web.archive.org/web/20150407060917/http://kindlegen.s3.amazonaws.com/kindlegen_win32_v2_9.zip' })
|
90
103
|
else
|
91
104
|
STDERR.puts "Host OS unsupported!"
|
92
105
|
exit(1)
|
data/kindlegen.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.name = "kindlegen"
|
7
7
|
s.version = Kindlegen::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
|
-
s.required_ruby_version = '>= 2.
|
9
|
+
s.required_ruby_version = '>= 2.4.0'
|
10
10
|
|
11
11
|
s.authors = ["TADA Tadashi"]
|
12
12
|
s.email = ["t@tdtds.jp"]
|
@@ -23,9 +23,9 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.extensions = ['ext/Rakefile']
|
24
24
|
|
25
25
|
s.add_dependency 'rubyzip'
|
26
|
+
s.add_dependency "rake"
|
26
27
|
|
27
28
|
# specify any dependencies here; for example:
|
28
|
-
s.add_development_dependency "rake"
|
29
29
|
s.add_development_dependency "pry"
|
30
30
|
s.add_development_dependency "test-unit"
|
31
31
|
end
|
data/lib/kindlegen/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kindlegen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TADA Tadashi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -31,7 +31,7 @@ dependencies:
|
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
|
-
type: :
|
34
|
+
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
@@ -76,9 +76,9 @@ extensions:
|
|
76
76
|
- ext/Rakefile
|
77
77
|
extra_rdoc_files: []
|
78
78
|
files:
|
79
|
+
- ".github/workflows/ci.yml"
|
79
80
|
- ".gitignore"
|
80
81
|
- ".tachikoma.yml"
|
81
|
-
- ".travis.yml"
|
82
82
|
- Gemfile
|
83
83
|
- LICENSE
|
84
84
|
- README.md
|
@@ -101,15 +101,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
101
|
requirements:
|
102
102
|
- - ">="
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version: 2.
|
104
|
+
version: 2.4.0
|
105
105
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - ">="
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
110
|
requirements: []
|
111
|
-
|
112
|
-
rubygems_version: 2.6.8
|
111
|
+
rubygems_version: 3.1.6
|
113
112
|
signing_key:
|
114
113
|
specification_version: 4
|
115
114
|
summary: Installing kindlegen command.
|