Sha256: 7d71ac112c64e001bbbf9e3c64600eaf57d261fdfb3a539bf9cc52f3f0c07fdd
Contents?: true
Size: 803 Bytes
Versions: 13
Compression:
Stored size: 803 Bytes
Contents
require "kindlegen" require "tempfile" module NcodeSyosetu module Builder class Mobi 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 end end NcodeSyosetu::Model::Novel.class_eval do def write_mobi(file) NcodeSyosetu::Builder::Mobi.write(self, file) end end end
Version data entries
13 entries across 13 versions & 2 rubygems