Skip to content

Commit

Permalink
resolves asciidoctor#268 provide a human-readable error message when …
Browse files Browse the repository at this point in the history
…we fail to find Kindlegen
  • Loading branch information
slonopotamus committed Jan 26, 2020
1 parent 2c48ffd commit 71e0815
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ For a detailed view of what has changed, refer to the {uri-repo}/commits/master[
== Unreleased

* make `KINDLEGEN` env var work again (#269)
* provide a human-readable error message when we fail to find Kindlegen (#268)

== 1.5.0.alpha.11 (2020-01-26) - @slonopotamus

Expand Down
6 changes: 5 additions & 1 deletion lib/asciidoctor-epub3/packager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,11 @@ def distill_epub_to_mobi epub_file, target, compress
if !(kindlegen_cmd = ENV['KINDLEGEN']).nil?
argv = [kindlegen_cmd]
else
require 'kindlegen' unless defined? ::Kindlegen
begin
require 'kindlegen' unless defined? ::Kindlegen
rescue LoadError => e
raise 'Unable to find Kindlegen. Either do "gem install kindlegen" or set KINDLEGEN environment variable with path to Kindlegen executable', cause: e
end
argv = [::Kindlegen.command.to_s]
end
mobi_file = ::File.basename target.sub(EpubExtensionRx, '.mobi')
Expand Down

0 comments on commit 71e0815

Please sign in to comment.