#!/usr/bin/env ruby # PublishR -- Fast publishing for ebooks and paper # Copyright (C) 2012 Michael Franzl # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'publishr' if ARGV[0].nil? puts '' puts 'PublishR -- Fast publishing for ebooks and paper' puts 'Copyright (C) 2012 Michael Franzl' puts '' puts '' puts "USAGE: publishr [name] [path_to_source_dir] [format] [path_to_converters]" puts '' puts " [name] is an unique string that identifies your project. Rendered files will be named after this." puts " [path_to_source_dir] directory must minimally contain: [cover.jpg, covertext.txt, frontmatter.txt, toc.txt, metadata.yml]" puts " [format] must be {kindle, pdf}" puts " [path_to_converters] directory must contain `kindlegen` and `jpg2ps`. They cannot be shipped with this program due to legal reasons." puts '' puts 'EXAMPLE: publishr mybook1 my/files/mybook epub path/to/converters' puts '' puts 'This program is free software: you can redistribute it and/or modify' puts 'it under the terms of the GNU Affero General Public License as' puts 'published by the Free Software Foundation, either version 3 of the' puts 'License, or (at your option) any later version.' puts '' puts '' Process.exit end project = Publishr::Project.new(ARGV[0], File.join(Dir.pwd,ARGV[1]), File.join(Dir.pwd,ARGV[3])) case ARGV[2] when 'kindle' then project.make_kindle when 'pdf' then project.make_pdf end #project.make_images_local("abc ![alt](http://www.sott.net/image/image/s1/33868/medium/sott_6percent_sm.jpg) \n ;lkjsdflk \n xxx ![alt](http://billgastro.com/images/header-en.png)")