Last active
December 19, 2015 22:19
-
-
Save thedeerchild/6026543 to your computer and use it in GitHub Desktop.
Rakefile for deploying locally built Jekyll sites to GitHub. Taken shamelessly from http://ixti.net/software/2013/01/28/using-jekyll-plugins-on-github-pages.html
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 'jekyll' | |
# Change your GitHub reponame | |
GITHUB_REPONAME = "elm232/elm232.github.io" | |
desc "Generate blog files" | |
task :generate do | |
Jekyll::Site.new(Jekyll.configuration({ | |
"source" => ".", | |
"destination" => "_site" | |
})).process | |
end | |
desc "Generate and publish blog to gh-pages" | |
task :publish => [:generate] do | |
Dir.mktmpdir do |tmp| | |
cp_r "_site/.", tmp | |
Dir.chdir tmp | |
system "git init" | |
system "git add ." | |
message = "Site updated at #{Time.now.utc}" | |
system "git commit -m #{message.shellescape}" | |
system "git remote add origin git@github.com:#{GITHUB_REPONAME}.git" | |
system "git push origin master --force" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment