Skip to content

Instantly share code, notes, and snippets.

@joshchernoff joshchernoff/Rakefile
Last active Dec 19, 2015

Embed
What would you like to do?
Publish your jeykll _site files to master so that you can build out your jekyll plugins for uses with github pages. Source from http://ixti.net/software/2013/01/28/using-jekyll-plugins-on-github-pages.html
require "jekyll"
require 'tmpdir'
GITHUB_REPONAME = "digitalcake/digitalcake.github.com"
SOURCE = "."
CONFIG = {
'layouts' => File.join(SOURCE, "_layouts"),
'posts' => File.join(SOURCE, "_posts")
}
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
You can’t perform that action at this time.