Created
January 14, 2011 20:01
-
-
Save adamesque/780139 to your computer and use it in GitHub Desktop.
Custom nanoc Rakefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nanoc3/tasks' | |
require 'rubygems' | |
def rebuild_site(relative) | |
begin | |
puts ">>> Change Detected to: #{relative} >> Update Complete " | |
sh 'nanoc co' | |
rescue StandardError => e | |
puts e | |
end | |
end | |
desc "Watch the site and regenerate when it changes" | |
task :watch do | |
require 'em-dir-watcher' | |
puts ">>> Watching for Changes <<<" | |
EM.run { | |
EMDirWatcher.watch File.dirname(__FILE__), | |
:include_only => ['Rules', '/content', '/layouts', '/lib'], | |
:grace_period => 0.2 do |paths| | |
rebuild_site paths | |
end | |
} | |
end | |
desc "Completely empty /output" | |
task :clobber do | |
sh "rm -rf output/* output/.[Dh]*" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is my custom Rakefile for use with nanoc. Features include: