From d40bdcf0c3e9df0f772c30d86ca6135402ec1fd0 Mon Sep 17 00:00:00 2001 From: Mike He Date: Tue, 23 Dec 2014 03:34:42 +0000 Subject: [PATCH] Add host configuration for preview server. --- Rakefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 099f5644774..d8c18711ae4 100644 --- a/Rakefile +++ b/Rakefile @@ -25,7 +25,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 = "localhost" # host for preview server eg. localhost +server_port = "4000" # port for preview server eg. 4000 if (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil puts '## Set the codepage to 65001 for Windows machines' @@ -83,7 +84,7 @@ task :preview do system "compass compile --css-dir #{source_dir}/stylesheets" unless File.exist?("#{source_dir}/stylesheets/screen.css") jekyllPid = Process.spawn({"OCTOPRESS_ENV"=>"preview"}, "jekyll build --watch") 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 }