diff --git a/Rakefile b/Rakefile index d98244db570..a2555af077d 100644 --- a/Rakefile +++ b/Rakefile @@ -77,13 +77,14 @@ task :watch do end desc "preview the site in a web browser" -task :preview do +task :preview, :listen do |t, args| + listen_addr = args[:listen] || '127.0.0.1' raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir) puts "Starting to watch source with Jekyll and Compass. Starting Rack on port #{server_port}" 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 --incremental") compassPid = Process.spawn("compass watch") - rackupPid = Process.spawn("rackup --port #{server_port}") + rackupPid = Process.spawn("rackup --port #{server_port} --host #{listen_addr}") trap("INT") { [jekyllPid, compassPid, rackupPid].each { |pid| Process.kill(9, pid) rescue Errno::ESRCH }