Created
June 2, 2011 13:24
-
-
Save plessl/1004414 to your computer and use it in GitHub Desktop.
Publishing a website generated by nanoc to Github
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' | |
desc "Publish site to Github" | |
task :publish do | |
src = 'output/' | |
dst = 'username.github.com/' | |
puts '==== Syncing working directory...' | |
sh("rsync -arv --delete --exclude '.git' #{src} #{dst}") | |
puts '==== Commiting changed files' | |
sh("cd #{dst}; git add -A") | |
commit_message = "Update website: " + Time.now | |
sh("cd #{dst}; git commit -m '#{commit_message}'") | |
puts '==== Pushing changes to Github' | |
sh("cd #{dst}; git push") | |
puts '==== Published website to Github' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment