#!/usr/bin/env ruby # encoding: utf-8 # # Copyright (c) 2010-2013 Kenshi Muto and Masayoshi Takahashi # # This program is free software. # You can distribute or modify this program under the terms of # the GNU LGPL, Lesser General Public License version 2.1. # For details of the GNU LGPL, see the file "COPYING". # require 'pathname' require 'optparse' bindir = Pathname.new(__FILE__).realpath.dirname $LOAD_PATH.unshift((bindir + '../lib').realpath) require 'review/epubmaker' require 'review/version' rv = ReVIEW::EPUBMaker.new opts = OptionParser.new opts.version = ReVIEW::VERSION opts.banner = "Usage: #{File.basename($0)} [options] YAML_filename [export_filename]" opts.on('--help', 'Prints this message and quit.') do puts opts.help exit 0 end begin opts.parse! rescue OptionParser::ParseError => err $stderr.puts err.message $stderr.puts opts.help exit 1 end if ARGV.size < 1 || !File.exist?(ARGV[0]) puts opts.help exit 1 end yaml_file = ARGV[0] bookname = ARGV[1] rv.produce(yaml_file, bookname)