lib/verku/cli.rb in verku-0.15.0 vs lib/verku/cli.rb in verku-0.16.0
- old
+ new
@@ -3,30 +3,30 @@
require 'verku/version'
module Verku
class Cli < Thor
FORMATS = %w[pdf draft proof html epub mobi txt]
check_unknown_options!
-
+
def self.exit_on_failure?
true
end
def initialize(args = [], options = {}, config = {})
if (config[:current_task] || config[:current_command]).name == "new" && args.empty?
raise Error, "The e-Book path is required. For details run: verku help new"
end
super
end
-
+
desc "create", "Start new work"
map %w(create new) => :create
def create(path)
- puts "Verku -- A Million Monkeys Writing Your Masterpiece."
+ say "Verku -- A Million Monkeys Writing Your Masterpiece."
generator = Generator.new
generator.destination_root = path.squish.gsub(' ','-')
generator.invoke_all
end
-
+
desc "compile [OPTIONS]", "Export e-book"
map %w(compile export build) => :export
method_option :only, :type => :string, :desc => "Can be one of: #{FORMATS.join(", ")}"
method_option :open, :type => :boolean, :desc => "Automatically open PDF (Preview.app for Mac OS X and xdg-open for Linux)"
def export
@@ -34,22 +34,22 @@
if options[:only] && !FORMATS.include?(options[:only])
raise Error, "The --only option need to be one of: #{FORMATS.join(", ")}"
end
Verku::Exporter.run(root_dir, options)
end
-
+
desc "pdf", "Export PDF only"
def pdf
inside_ebook!
Verku::Exporter.run(root_dir, {:only => 'pdf'})
end
-
+
desc "version", "Prints the Verku's version information"
map %w(-v --version) => :version
def version
say "Verku version #{Verku::VERSION}"
end
-
+
desc "stats", "Display some stats about your e-book"
def stats
inside_ebook!
stats = Verku::Stats.new(root_dir)