Sha256: 73b0e908957148d0d3946833f0abfa2960669bd0a031ffa290402d17bfc1fde4

Contents?: true

Size: 1.01 KB

Versions: 6

Compression:

Stored size: 1.01 KB

Contents

require 'rubygems'
require 'jekyll'
require 'tmpdir'

module JekyllDocs
  class DocsCommand < Jekyll::Command
    class << self
      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 to listen on."

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

      def process(opts)
        Dir.mktmpdir do |dest_dir|
          options = opts.merge({
            "serving"     => true,
            "watch"       => false,
            "config"      => File.expand_path("../../site/_config.yml", __FILE__),
            "source"      => File.expand_path("../../site", __FILE__),
            "destination" => dest_dir
          })
          Jekyll::Commands::Build.process(options)
          Jekyll::Commands::Serve.process(options)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
jekyll-docs-3.1.6 lib/jekyll-docs.rb
jekyll-docs-3.1.5 lib/jekyll-docs.rb
jekyll-docs-3.1.4 lib/jekyll-docs.rb
jekyll-docs-3.1.3 lib/jekyll-docs.rb
jekyll-docs-3.1.2 lib/jekyll-docs.rb
jekyll-docs-3.0.3 lib/jekyll-docs.rb