Sha256: a6eef4b264336bbdc4003873a2b7f5dde24cb822893f62ccbdde0ac5e7adde26

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

usage 'live [options]'
summary 'start the web server, and recompile the site when changed'
description <<-EOS
Start the static web server (like `nanoc view` would), and watch for changes
in the background (like `guard start` would). See the documentation of those
two commands for details. The options are forwarded to `nanoc view` only.
EOS

required :H, :handler, 'specify the handler to use (webrick/mongrel/...)'
required :o, :host,    'specify the host to listen on (default: 0.0.0.0)'
required :p, :port,    'specify the port to listen on (default: 3000)'

module Nanoc::CLI::Commands
  class Live < ::Nanoc::CLI::CommandRunner
    def run
      require 'guard'
      require 'guard/commander'

      Thread.new do
        # Crash the entire process if the viewer dies for some reason (e.g.
        # the port is already bound).
        Thread.current.abort_on_exception = true
        Nanoc::CLI::Commands::View.new(options, arguments, command).run
      end

      Guard.start(no_interactions: true)
    end
  end
end

runner Nanoc::CLI::Commands::Live

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
guard-nanoc-2.1.2 lib/nanoc/cli/commands/live.rb
guard-nanoc-2.1.1 lib/nanoc/cli/commands/live.rb
guard-nanoc-2.1.0 lib/nanoc/cli/commands/live.rb