Merge commit '6bfaa6'

This commit is contained in:
Tom Preston-Werner 2008-12-21 18:08:14 -08:00
commit a90f9cd8b0
2 changed files with 29 additions and 0 deletions

View File

@ -138,6 +138,13 @@ have it used instead:
$ jekyll --rdiscount $ jekyll --rdiscount
When previewing complex sites locally, simply opening the site in a web
browser (using file://) can cause problems with links that are relative to
the site root (e.g., "/stylesheets/style.css"). To get around this, Jekyll
can launch a simple WEBrick server (works well in conjunction with --auto):
$ jekyll --server
h2. Data h2. Data
Jekyll traverses your site looking for files to process. Any files with YAML Jekyll traverses your site looking for files to process. Any files with YAML

View File

@ -25,6 +25,10 @@ opts = OptionParser.new do |opts|
options[:auto] = true options[:auto] = true
end 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 opts.on("--lsi", "Use LSI for better related posts") do
Jekyll.lsi = true Jekyll.lsi = true
end end
@ -78,6 +82,24 @@ case ARGV.size
exit(1) exit(1)
end 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] if options[:auto]
require 'directory_watcher' require 'directory_watcher'