Class: Bowtie::Commands::Serve

Inherits:
Bowtie::Command show all
Defined in:
lib/bowtie/commands/serve.rb

Class Method Summary collapse

Methods inherited from Bowtie::Command

inherited, subclasses

Class Method Details

.init_with_program(prog) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/bowtie/commands/serve.rb', line 5

def init_with_program(prog)
  command = Jekyll::Commands::Serve.init_with_program(prog)
  command.description 'Development server'
  command.actions.clear

  command.action do |args, options|
    options['serving'] = true
    options['watch'] = true unless options.key?('watch')

    Jekyll::Commands::Build.process(options)
    Bowtie::Commands::Serve.process(options)
  end
end

.process(options) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/bowtie/commands/serve.rb', line 19

def process(options)
  Bowtie::Middleware::PolicyCheck.watch!

  Rack::Server.start(app: application(options),
                     Port: options['port'] || 4000,
                     Host: options['host'],
                     daemonize: options['detach'])
end