Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

A rake task to update the github pages branch

  • Loading branch information...
commit 12f9479fbc5538993762bc65b8f3f262da14c5c1 1 parent 901938b
@chriseppstein authored
Showing with 34 additions and 2 deletions.
  1. +10 −1 README.markdown
  2. +24 −1 Rakefile
11 README.markdown
@@ -12,4 +12,13 @@ Think of this as a wiki that you can check out.
Generally useful recipes might be added to compass.
## Building
-You can (re-)build the recipes by running `rake`.
+You can (re-)build the recipes by running `rake`.
+## Adding Recipes to the Live Demo
+After committing and pushing your changes to the master branch,
+all html and css files will be transferred to/updated on the
+github pages branch when you run:
+ rake pages
+Afterwards, you'll be on the `gh-pages` branch where you can edit the index.html file to add links, etc and then push the update.
25 Rakefile
@@ -4,4 +4,27 @@ task :default do
puts "Compiling #{file} to html"
sh "haml #{file} #{file.sub(/haml/,'html')}"
+task :pages do
+ require 'git'
+ require 'fileutils'
+ repo ='.')
+ FileUtils.rm_rf "tmp"
+ FileUtils.mkdir("tmp")
+ ('**/*.html')'**/*.css')).each do |file|
+ FileUtils.mkdir_p(File.dirname("tmp/#{file}"))
+ FileUtils.cp(file, "tmp/#{file}")
+ end
+ repo.branch("gh-pages").checkout
+ FileUtils.rm_rf "recipes/*"
+ ('tmp/**/*.html')'tmp/**/*.css')).each do |file|
+ FileUtils.mkdir_p(File.dirname("recipes/#{file[4..-1]}"))
+ FileUtils.cp(file, "recipes/#{file[4..-1]}")
+ end
+ FileUtils.rm_rf("tmp")
+ Dir["recipes/**/*"].each {|f| repo.add(f) }
+ repo.status.deleted.each {|f, s| repo.remove(f)}
+ message = ENV["MESSAGE"] || "Updated at #{}"
+ repo.commit(message)
Please sign in to comment.
Something went wrong with that request. Please try again.