Skip to content

Commit

Permalink
Added --server option to start a simple WEBrick server on destination…
Browse files Browse the repository at this point in the history
… directory
  • Loading branch information
John Reilly committed Dec 19, 2008
1 parent ed60ad6 commit 9ecbfb2
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions bin/jekyll
Expand Up @@ -25,6 +25,10 @@ opts = OptionParser.new do |opts|
options[:auto] = true
end

opts.on("--server", "Run a WEBrick server on destination directory") do
options[:server] = true
end

opts.on("--lsi", "Use LSI for better related posts") do
Jekyll.lsi = true
end
Expand Down Expand Up @@ -78,6 +82,24 @@ case ARGV.size
exit(1)
end

if options[:server]
require 'webrick'
include WEBrick

s = HTTPServer.new(
:Port => 4000,
:DocumentRoot => destination
)
t = Thread.new {
s.start
}

unless options[:auto]
trap("INT") { s.shutdown }
t.join()
end
end

if options[:auto]
require 'directory_watcher'

Expand Down

0 comments on commit 9ecbfb2

Please sign in to comment.