public
Rubygem
Description: Jekyll is a blog-aware, static site generator in Ruby
Homepage: http://jekyllrb.com
Clone URL: git://github.com/mojombo/jekyll.git
Added --server option to start a simple WEBrick server on destination directory
johnreilly (author)
Fri Dec 19 15:49:57 -0800 2008
commit  9ecbfb2253e11f5cb0364e24d4f13595efdd20b6
tree    69953ec36305b2cae7304428531baacd568470cc
parent  ed60ad6f7203e7bd663d8948ebf958864b05d766
...
25
26
27
 
 
 
 
28
29
30
...
78
79
80
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
82
83
...
25
26
27
28
29
30
31
32
33
34
...
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
0
@@ -25,6 +25,10 @@ opts = OptionParser.new do |opts|
0
     options[:auto] = true
0
   end
0
   
0
+  opts.on("--server", "Run a WEBrick server on destination directory") do
0
+    options[:server] = true
0
+  end
0
+  
0
   opts.on("--lsi", "Use LSI for better related posts") do
0
     Jekyll.lsi = true
0
   end
0
@@ -78,6 +82,24 @@ case ARGV.size
0
     exit(1)
0
 end
0
 
0
+if options[:server]
0
+  require 'webrick'
0
+  include WEBrick
0
+
0
+  s = HTTPServer.new(
0
+    :Port            => 4000,
0
+    :DocumentRoot    => destination
0
+  )
0
+  t = Thread.new {
0
+    s.start
0
+  }
0
+  
0
+  unless options[:auto]
0
+    trap("INT") { s.shutdown }
0
+    t.join()
0
+  end
0
+end
0
+
0
 if options[:auto]
0
   require 'directory_watcher'
0
 

Comments