Use Launchy for cross platform site:preview. Thx @ixti.

This commit is contained in:
Tom Preston-Werner 2012-12-29 15:29:56 -08:00
parent 88bdb15338
commit 95b07a3c2b
2 changed files with 4 additions and 1 deletions

View File

@ -118,12 +118,14 @@ end
namespace :site do namespace :site do
desc "Generate and view the site locally" desc "Generate and view the site locally"
task :preview do task :preview do
require "launchy"
# Yep, it's a hack! Wait a few seconds for the Jekyll site to generate and # Yep, it's a hack! Wait a few seconds for the Jekyll site to generate and
# then open it in a browser. Someday we can do better than this, I hope. # then open it in a browser. Someday we can do better than this, I hope.
Thread.new do Thread.new do
sleep 4 sleep 4
puts "Opening in browser..." puts "Opening in browser..."
sh "open http://localhost:4000" Launchy.open("http://localhost:4000")
end end
# Generate the site in server mode. # Generate the site in server mode.

View File

@ -39,6 +39,7 @@ Gem::Specification.new do |s|
s.add_development_dependency('RedCloth', "~> 4.2") s.add_development_dependency('RedCloth', "~> 4.2")
s.add_development_dependency('rdiscount', "~> 1.6") s.add_development_dependency('rdiscount', "~> 1.6")
s.add_development_dependency('redcarpet', "~> 2.1.1") s.add_development_dependency('redcarpet', "~> 2.1.1")
s.add_development_dependency('launchy', "~> 2.1.2")
# = MANIFEST = # = MANIFEST =
s.files = %w[ s.files = %w[