Created
September 19, 2016 12:44
-
-
Save DirtyF/2eacfb7ecec18b3b738af1c3c8d1fe5e to your computer and use it in GitHub Desktop.
Jekyll Rakefile to build and deploy to GitHub Pages (Project version)
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 "rubygems" | |
require "tmpdir" | |
require "bundler/setup" | |
require "jekyll" | |
# Indiquez le nom de votre dépôt | |
GITHUB_REPONAME = "USERNAME/REPO" | |
namespace :site do | |
desc "Génération des fichiers du site" | |
task :generate do | |
Jekyll::Site.new(Jekyll.configuration({ | |
"source" => ".", | |
"destination" => "_site" | |
})).process | |
end | |
desc "Génération et publication des fichiers sur GitHub" | |
task :publish => [:generate] do | |
Dir.mktmpdir do |tmp| | |
cp_r "_site/.", tmp | |
pwd = Dir.pwd | |
Dir.chdir tmp | |
File.open(".nojekyll", "wb") { |f| f.puts("Site généré localement.") } | |
system "git init" | |
system "git add ." | |
message = "Site mis à jour le #{Time.now.utc}" | |
system "git commit -m #{message.inspect}" | |
system "git remote add origin [email protected]:#{GITHUB_REPONAME}.git" | |
system "git push origin master:refs/heads/gh-pages --force" | |
Dir.chdir pwd | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ok. Found it https://blog.sorryapp.com/blogging-with-jekyll/2014/01/31/using-jekyll-plugins-on-github-pages.html