Class: JekyllDocs::DocsCommand

Inherits:
Jekyll::Command
  • Object
show all
Defined in:
lib/jekyll-docs.rb

Class Method Summary collapse

Class Method Details

.init_with_program(prog) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/jekyll-docs.rb', line 8

def init_with_program(prog)
  prog.command(:docs) do |cmd|
    cmd.description "Start a local server for the Jekyll documentation"
    cmd.syntax "docs [options]"
    cmd.alias :d

    cmd.option "port", "-P [PORT]", "--port [PORT]", "Port to listen on."

    cmd.action do |_, opts|
      JekyllDocs::DocsCommand.process(opts)
    end
  end
end

.process(opts) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/jekyll-docs.rb', line 22

def process(opts)
  options = opts.merge(
    "serving"            => true,
    "watch"              => false,
    "destination"        => File.expand_path("../site", __dir__),
    "skip_initial_build" => true
  )
  Jekyll::Commands::Serve.process(options)
end