Sha256: 18d15838e5d9e48769df99ba7ce830c1fdc84cf4289662c01c2bf20055e8aeeb
Contents?: true
Size: 1.43 KB
Versions: 2
Compression:
Stored size: 1.43 KB
Contents
require 'thor/group' module Bookshop module Commands # Define build commands for bookshop command line class Build < Thor::Group include Thor::Actions ARGV << '--help' if ARGV.empty? aliases = { "p" => "pdf" } build = ARGV.shift build = aliases[build] || build # Define arguments and options argument :type, :type => :string # Define source root of application def self.source_root File.dirname(__FILE__) end case build when 'pdf' puts "Deleting any old builds" File.delete("builds/pdf/book.pdf") if File::exists?( "builds/pdf/book.pdf" ) puts "File Deleted" puts "Building new pdf at builds/pdf/book.pdf" cmd = %x[wkhtmltopdf book/book.html builds/pdf/book.pdf] # cmd = %x[wkhtmltopdf #{SRC_FILE} #{OUT_FILE}] else puts "Error: Command not recognized" unless %w(-h --help).include?(build) puts <<-EOT Usage: bookshop build [ARGS] The most common build commands are: pdf Builds a new pdf at /builds/pdf/book.pdf epub Builds a new epub at /builds/epub/book.epub html Builds a new html at /builds/html/book.html all Builds all possible builds in their respective locations All commands can be run with -h for more information. EOT end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bookshop-0.0.14 | lib/bookshop/commands/build.rb |
bookshop-0.0.13 | lib/bookshop/commands/build.rb |