Class: Jekyll::Commands::Docs

Inherits:
Jekyll::Command show all
Defined in:
lib/jekyll/commands/docs.rb

Class Method Summary collapse

Methods inherited from Jekyll::Command

add_build_options, configuration_from_options, inherited, process_site, subclasses

Class Method Details

.init_with_program(prog) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/jekyll/commands/docs.rb', line 7

def init_with_program(prog)
  prog.command(:docs) do |c|
    c.syntax 'docs'
    c.description "Launch local server with docs for Jekyll v#{Jekyll::VERSION}"

    c.option 'port', '-P', '--port [PORT]', 'Port to listen on'
    c.option 'host', '-H', '--host [HOST]', 'Host to bind to'

    c.action do |args, options|
      options.merge!({
        'source'      => File.expand_path("../../../site", File.dirname(__FILE__)),
        'destination' => File.expand_path("../../../site/_site", File.dirname(__FILE__))
      })
      Jekyll::Commands::Build.process(options)
      Jekyll::Commands::Serve.process(options)
    end
  end
end