Sha256: 39592c922681f2f605244abd6f2dbfa397dcfffed50038640f058bc6edcb1bd7

Contents?: true

Size: 757 Bytes

Versions: 4

Compression:

Stored size: 757 Bytes

Contents

require "jekyll-books/book_writer"

module Jekyll
  module Commands
    class Book < Command
      def self.init_with_program(prog)
        prog.command(:book) do |c|
          c.syntax "book [options]"
          c.description 'Create a new book.'
  
          add_options(c)
  
          c.action do |args, options|
            configs = Jekyll.configuration()
            BookWriter.new(
              options["name"],
              File.join(configs["source"], "_books"),
              options
            ).run
          end
        end
      end
  
      def self.add_options(cmd)
        cmd.option "name", "-n", "--name NAME"
        cmd.option "title", "-t", "--title TITLE"
        cmd.option "forced", "-f", "--forced"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jekyll-books-0.3.1 lib/jekyll/commands/book.rb
jekyll-books-0.3.0 lib/jekyll/commands/book.rb
jekyll-books-0.2.1 lib/jekyll/commands/book.rb
jekyll-books-0.2.0 lib/jekyll/commands/book.rb