Skip to content

Commit

Permalink
see #363: drop dependency on kindlegen gem to unblock CI (#364)
Browse files Browse the repository at this point in the history
  • Loading branch information
slonopotamus authored Aug 25, 2020
1 parent 0532307 commit 33e27ee
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 22 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ jobs:
ruby: [jruby, 2.3, 2.4, 2.5, 2.6, 2.7]
platform: [ubuntu-latest, macos-latest, windows-latest]
asciidoctor: [1.5.6, '']
exclude:
# kindlegen fails to install on 2.3 on Windows. See https://github.com/asciidoctor/asciidoctor-epub3/pull/213
- ruby: 2.3
platform: windows-latest
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout
Expand Down
3 changes: 0 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,4 @@ 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.4.0'
# We would like to make kindlegen a runtime dependency, but can't because of the way asciidoctorj-epub3 packaging works
# See https://github.com/asciidoctor/asciidoctor-epub3/issues/288
gem 'kindlegen', '~> 3.0.3'
end
11 changes: 2 additions & 9 deletions lib/asciidoctor-epub3/converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1638,15 +1638,8 @@ def get_kindlegen_command kindlegen_path
return [result]
end

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
logger.debug 'Using KindleGen from PATH'
[%(kindlegen#{::Gem.win_platform? ? '.exe' : ''})]
end

def distill_epub_to_mobi epub_file, target, compress, kindlegen_path
Expand Down
7 changes: 1 addition & 6 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,8 @@ def skip_unless_has_logger
skip 'Logger is unavailable on Asciidoctor < 1.5.7' unless has_logger?
end

def darwin_platform?
RbConfig::CONFIG['host_os'] =~ /darwin/
end

def skip_unless_has_kindlegen
# TODO: https://github.com/asciidoctor/asciidoctor-epub3/issues/236
skip '#236: Kindlegen is unavailable for 64-bit MacOS' if darwin_platform?
skip 'KindleGen is gone: https://github.com/asciidoctor/asciidoctor-epub3/issues/363'
end

def convert input, opts = {}
Expand Down

0 comments on commit 33e27ee

Please sign in to comment.