diff options
author | B Mathis <brandon@imathis.com> | 2009-10-18 19:07:36 -0500 |
---|---|---|
committer | B Mathis <brandon@imathis.com> | 2009-10-18 19:07:36 -0500 |
commit | 82d0251da120186c27791b7c073aa103d73c2b31 (patch) | |
tree | ed8c90ca49e21c160ed119ab6a297c614d9c5e73 /Rakefile | |
parent | 2b4c5948b36ed1054dab270444df51fd4c38196f (diff) | |
download | my_new_personal_website-82d0251da120186c27791b7c073aa103d73c2b31.tar.xz my_new_personal_website-82d0251da120186c27791b7c073aa103d73c2b31.zip |
improved starting point
Diffstat (limited to '')
-rw-r--r-- | Rakefile | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/Rakefile b/Rakefile new file mode 100644 index 00000000..75f89b94 --- /dev/null +++ b/Rakefile @@ -0,0 +1,63 @@ +require 'active_support' + +def ok_failed(condition) + if (condition) + puts "OK" + else + puts "FAILED" + end +end + +port = "4000" +site = "site" + +desc "list tasks" +task :default do + puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:default]]).to_sentence}" + puts "(type rake -T for more detail)\n\n" +end + +desc "remove files in output directory" +task :clean do + puts "Removing output..." + Dir["#{site}/*"].each { |f| rm_rf(f) } +end + +desc "generate website in output directory" +task :generate => :clean do + puts "Generating website..." + system "compass" + system "jekyll" + Dir["#{site}/stylesheets/*.sass"].each { |f| rm_rf(f) } + system "mv #{site}/atom.html #{site}/blog/atom.xml" +end + +desc "generate and deploy website" +task :deploy => :generate do + print "Deploying website..." + ok_failed system("rsync -avz --delete #{site}/ user@host.com:~/document_root/") +end + +desc "start up an instance of serve on the output files" +task :start_serve => :stop_serve do + cd "#{site}" do + print "Starting serve..." + ok_failed system("serve #{port} > /dev/null 2>&1 &") + end +end + +desc "stop all instances of serve" +task :stop_serve do + pid = `ps auxw | awk '/bin\\/serve\\ #{port}/ { print $2 }'`.strip + if pid.empty? + puts "Serve is not running" + else + print "Stoping serve..." + ok_failed system("kill -9 #{pid}") + end +end + +desc "preview the site in a web browser" +multitask :preview => [:generate, :start_serve] do + system "open http://localhost:#{port}" +end
\ No newline at end of file |