Skip to content

Commit

Permalink
resolves asciidoctor#363: reenable dependency on kindlegen gem
Browse files Browse the repository at this point in the history
This commit also drops support for Ruby < 2.4

This reverts commit 33e27ee.
  • Loading branch information
slonopotamus committed Apr 28, 2021
1 parent 76bc372 commit d2b76c2
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ jobs:
needs: activate
strategy:
matrix:
ruby: [jruby, '2.3', '2.4', '2.5', '2.6', '2.7', '3.0']
# TODO: Use 'jruby-9.2' when https://github.com/jruby/jruby/issues/6648 is fixed
ruby: ['jruby-9.2.16', '2.4', '2.5', '2.6', '2.7', '3.0']
os: [ubuntu-latest, windows-latest]
asciidoctor: ['']
include:
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ For a detailed view of what has changed, refer to the {uri-repo}/commits/master[
== Unreleased

* update Font Awesome Solid to 5.15.1
* use CSS for image size scaling instead of `width` attribute. #382
* use CSS for image size scaling instead of `width` attribute (#382)
* use pygments.rb 2.0.0 in CI
* add support for `:back-cover-image:` document attribute (#396)
* reenable Kindlegen support (#363)
* drop support for Ruby 2.3

== 1.5.0.alpha.19 (2020-10-21) - @slonopotamus

Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ end
group :optional do
# epubcheck-ruby might be safe to be converted into runtime dependency, but could have issues when packaged into asciidoctorj-epub3
gem 'epubcheck-ruby', '~> 4.2.5.0'
# Kindlegen is unavailable neither for 64-bit MacOS nor for ARM
gem 'kindlegen', '~> 3.1.0' unless RbConfig::CONFIG['host_os'] =~ /darwin/
end
2 changes: 1 addition & 1 deletion asciidoctor-epub3.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ An extension for Asciidoctor that converts AsciiDoc documents to EPUB3 and KF8/M
s.homepage = 'https://github.com/asciidoctor/asciidoctor-epub3'
s.license = 'MIT'

s.required_ruby_version = '>= 2.3.0'
s.required_ruby_version = '>= 2.4.0'

files = begin
(result = Open3.popen3('git ls-files -z') {|_, out| out.read }.split %(\0)).empty? ? Dir['**/*'] : result
Expand Down
11 changes: 9 additions & 2 deletions lib/asciidoctor-epub3/converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1658,8 +1658,15 @@ def get_kindlegen_command
return [result]
end

logger.debug 'Using KindleGen from PATH'
[%(kindlegen#{::Gem.win_platform? ? '.exe' : ''})]
begin
require 'kindlegen' unless defined? ::Kindlegen
result = ::Kindlegen.command.to_s
logger.debug %(Using KindleGen from gem: #{result})
[result]
rescue LoadError => e
logger.debug %(#{e}; Using KindleGen from PATH)
[%(kindlegen#{::Gem.win_platform? ? '.exe' : ''})]
end
end

def distill_epub_to_mobi epub_file, target, compress
Expand Down
4 changes: 3 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ def skip_unless_has_logger
end

def skip_unless_has_kindlegen
skip 'KindleGen is gone: https://github.com/asciidoctor/asciidoctor-epub3/issues/363'
require 'kindlegen'
rescue LoadError
skip 'kindlegen gem is unavailable'
end

def convert input, opts = {}
Expand Down

0 comments on commit d2b76c2

Please sign in to comment.