class NcodeSyosetu::Builder::Mobi
Public Class Methods
write(novel, mobi_path)
click to toggle source
# File lib/ncode_syosetu/builder/mobi.rb, line 7 def self.write(novel, mobi_path) mobi_pathname = Pathname.new(mobi_path) mobi_basename = mobi_pathname.basename.to_s Dir.mktmpdir do |tmpdir| epub_path = File.join(tmpdir, "#{mobi_basename}.epub") NcodeSyosetu::Builder::Epub3.write(novel, epub_path) STDERR.puts Kindlegen.run(epub_path, "-verbose", "-locale", "ja", "-o", mobi_basename) File.rename(File.join(tmpdir, mobi_basename), mobi_path) end end