Skip to content

Instantly share code, notes, and snippets.

@DirtyF
Created September 19, 2016 12:44
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 DirtyF/2eacfb7ecec18b3b738af1c3c8d1fe5e to your computer and use it in GitHub Desktop.
Save DirtyF/2eacfb7ecec18b3b738af1c3c8d1fe5e to your computer and use it in GitHub Desktop.
Jekyll Rakefile to build and deploy to GitHub Pages (Project version)
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 git@github.com:#{GITHUB_REPONAME}.git"
system "git push origin master:refs/heads/gh-pages --force"
Dir.chdir pwd
end
end
end
@andilabs
Copy link

couldy you add readme how to use it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment