Module: EBPS::Conversion::MobiPocket

Defined in:
lib/ebps/conversion/mobi_pocket.rb

Class Method Summary collapse

Class Method Details

.compile_azw(target, tmpdir, opf) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/ebps/conversion/mobi_pocket.rb', line 8

def self.compile_azw target, tmpdir, opf
  current_dir = Dir.pwd
  Dir.chdir tmpdir
  opfpath = File.join tmpdir, opf
  config = EBPS.config
  command = "#{config.kindlegen_path} #{opfpath} #{config.kindlegen_args} -o mobipocket.azw"
  # kindlegen returns status -1 if a warning has been issued, so system's
  # return value is no indication of success.
  system command
  FileUtils.cp File.join(tmpdir, 'mobipocket.azw'), target
ensure
  Dir.chdir current_dir
end

.export(docs, target, override_tmpdir = nil) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/ebps/conversion/mobi_pocket.rb', line 21

def self.export docs, target, override_tmpdir=nil
  ## kindlegen depends on the somewhat obscure kindle_quirks options. 
  EBPS.config.kindle_quirks = true
  Oebps.export docs, target, override_tmpdir do |tmpdir, name|
    compile_azw target, tmpdir, name
  end
end