Skip to content

Instantly share code, notes, and snippets.

@plessl
Created June 2, 2011 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plessl/1004414 to your computer and use it in GitHub Desktop.
Save plessl/1004414 to your computer and use it in GitHub Desktop.
Publishing a website generated by nanoc to Github
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