summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorMarat Radchenko <marat@slonopotamus.org>2024-01-16 11:12:02 -0800
committerGitHub <noreply@github.com>2024-01-16 22:12:02 +0300
commit394ec4cd5283725f1e1c92fde8266524b26aebfd (patch)
tree6fd7745d1b254a75b3f95fc4691b368a0a77a0ef /spec
parentaec6be126965f622624f611070645fc1931bf18a (diff)
Drop MOBI support (#458)
Amazon is slowly killing it, it's just a question of time when it fully dies. References: * https://kdp.amazon.com/en_US/help/topic/GULSQMHU5MNH4EZM > Starting August 1, 2021, we will no longer support MOBI files for reflowable eBooks. Use EPUB, DOCX or KPF to publish new or update reflowable eBooks. * https://www.amazon.com/gp/help/customer/display.html?nodeId=G5WYD9SAF7PGXRNA > Beginning in late 2022, you'll no longer be able to send MOBI (.AZW, .MOBI) files to your Kindle library using Send to Kindle. This change won't affect any MOBI files already in your Kindle library. You can still read them with Kindle. MOBI is an older file format and won't support the newest Kindle features for documents. * https://www.reddit.com/r/kindle/comments/16rw6e3/amazon_announcement_about_mobi_support_timeline/ > We will end all Send to Kindle support for MOBI files by December 20, 2023. * https://www.mobileread.com/forums/showthread.php?t=336365 > Does anyone still have Kindle Previewer installer older than 3.49 that you could share? The reason I am looking for it is because newer versions no longer open .mobi files.
Diffstat (limited to 'spec')
-rw-r--r--spec/cli_spec.rb22
-rw-r--r--spec/converter_spec.rb4
-rw-r--r--spec/spec_helper.rb15
3 files changed, 0 insertions, 41 deletions
diff --git a/spec/cli_spec.rb b/spec/cli_spec.rb
index fd790a3..032dc29 100644
--- a/spec/cli_spec.rb
+++ b/spec/cli_spec.rb
@@ -37,17 +37,6 @@ describe 'asciidoctor-epub3' do
expect(File).to exist(out_file)
end
- it 'converts sample book to mobi' do
- in_file = example_file 'sample-book.adoc'
- out_file = temp_file 'sample-book.mobi'
-
- _, err, res = to_mobi in_file, out_file
- expect(res.exitstatus).to eq(0)
- expect(err).not_to include 'ERROR'
- expect(err).not_to include 'invalid reference'
- expect(File).to exist(out_file)
- end
-
it 'prints errors to stderr when converts invalid book to epub' do
_, err, res = to_epub fixture_file('invalid.adoc'), temp_file('invalid.epub')
expect(res.exitstatus).to eq(0)
@@ -57,17 +46,6 @@ describe 'asciidoctor-epub3' do
expect(err).to include 'EPUB validation failed'
end
- it 'prints errors to stderr when converts invalid book to mobi' do
- _, err, res = to_mobi fixture_file('invalid.adoc'), temp_file('invalid.mobi')
- expect(err).to include 'ERROR'
- expect(res.exitstatus).to eq(0)
- end
-
- def to_mobi(in_file, out_file)
- skip_unless_has_kindlegen
- run_command asciidoctor_epub3_bin, '-a', 'ebook-format=mobi', in_file.to_s, '-o', out_file.to_s
- end
-
def to_epub(in_file, out_file = nil)
argv = asciidoctor_epub3_bin + ['-a', 'ebook-validate', in_file.to_s]
argv += ['-o', out_file.to_s] unless out_file.nil?
diff --git a/spec/converter_spec.rb b/spec/converter_spec.rb
index 273cbd9..454f6f1 100644
--- a/spec/converter_spec.rb
+++ b/spec/converter_spec.rb
@@ -8,10 +8,6 @@ describe Asciidoctor::Epub3::Converter do
expect(to_epub(fixture_file('empty.adoc'))).not_to be_nil
end
- it 'converts empty file to mobi without exceptions' do
- expect(to_mobi(fixture_file('empty.adoc'))).not_to be_nil
- end
-
it 'converts empty heredoc document to epub without exceptions' do
expect(to_epub('')).not_to be_nil
end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 941c643..4d61d2f 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -61,12 +61,6 @@ RSpec.configure do |config|
examples_dir.join(*path)
end
- def skip_unless_has_kindlegen
- require 'kindlegen'
- rescue LoadError
- skip 'kindlegen gem is unavailable'
- end
-
def convert(input, opts = {})
opts[:backend] = 'epub3'
opts[:header_footer] = true
@@ -89,15 +83,6 @@ RSpec.configure do |config|
book = GEPUB::Book.parse output
[book, output]
end
-
- def to_mobi(input, opts = {})
- skip_unless_has_kindlegen
- (opts[:attributes] ||= {})['ebook-format'] = 'mobi'
- doc = convert input, opts
- output = Pathname.new(doc.attr('outfile')).sub_ext '.mobi'
- expect(output).to exist
- output
- end
end
RSpec::Matchers.define :have_size do |expected|