Skip to content

Instantly share code, notes, and snippets.

@yitsushi
Created March 12, 2014 13:24
Show Gist options
  • Save yitsushi/9506856 to your computer and use it in GitHub Desktop.
Save yitsushi/9506856 to your computer and use it in GitHub Desktop.
diff --git a/Rakefile b/Rakefile
index 471b227..06aa580 100644
--- a/Rakefile
+++ b/Rakefile
@@ -25,7 +25,9 @@ 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_port = "4000" # port for preview server eg. localhost:4000
+server_host = ENV["IP"] ||= "0.0.0.0"
+server_port = ENV["port"] ||= ENV["C9_PORT"] ||= "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]"
@@ -79,7 +81,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 --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 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment