Grab IP and PORT env vars and bind rack to both

This commit is contained in:
Max Lincoln 2012-12-17 13:51:33 -05:00 committed by Parker Moore
parent 2cebdb91db
commit 329d2c5bda

View File

@ -28,8 +28,8 @@ posts_dir = "_posts" # directory for blog files
themes_dir = ".themes" # directory for blog files
new_post_ext = "markdown" # default new post file extension when using the new_post task
new_page_ext = "markdown" # default new page file extension when using the new_page task
server_port = "4000" # port for preview server eg. localhost:4000
server_host = ENV['IP'] ||= '0.0.0.0' # host ip address for preview server
server_port = ENV['PORT'] ||= "4000" # port for preview server eg. localhost:4000
desc "Initial setup for Octopress: copies the default theme into the path of Jekyll's generator. Rake install defaults to rake install[classic] to install a different theme run rake install[some_theme_name]"
task :install, :theme do |t, args|
@ -116,7 +116,7 @@ task :preview do
system "compass compile --css-dir #{source_dir}/stylesheets"
jekyllPid = Process.spawn("jekyll --auto")
compassPid = Process.spawn("compass watch")
rackupPid = Process.spawn("rackup --port #{server_port}")
rackupPid = Process.spawn("rackup --host #{server_host} --port #{server_port}")
trap("INT") {
[jekyllPid, compassPid, rackupPid].each { |pid| Process.kill(9, pid) rescue Errno::ESRCH }