Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Build static Github Pages with all the tools in Rails

branch: master
Octocat-spinner-32 gh-pages-app gh-pages-app September 17, 2011
Octocat-spinner-32 heroku-app first commit September 16, 2011
Octocat-spinner-32 spec-app first commit September 16, 2011
Octocat-spinner-32 .gitignore first commit September 16, 2011
Octocat-spinner-32 README.md spec app September 17, 2011
Octocat-spinner-32 _config.yml gh-pages-app September 17, 2011
Octocat-spinner-32 gh-pages.rb gh-pages-app September 17, 2011
Octocat-spinner-32 heroku.rb first commit September 16, 2011
Octocat-spinner-32 spec.rb gh-pages-app September 17, 2011
README.md

Rails Pages

Usage

These are just 3 apps I create a lot, and you should use a lot too. When you create your new ruby gem or jquery plugin, just run:

git branch gh-pages
git checkout gh-pages
rails new . -m https://github.com/viatropos/rails-pages/raw/master/spec.rb
rails server

Then start building your pages. Most of the HTML architecture has been standardized, so the header/footer/sidebar/navigation/etc are all defaulted in and easy to customize. It's all Haml too, so everything gets perfectly printed. It's filled out data-wise too, so you'll have a super "semantic" site from the get-go.

Development Tips

Sometimes when you're building your static site, it's just a lot easier to have everything dynamic, and even to be using mongodb (via Mongoid) to store models. That's the main reason I put this together: we're all really used to Rails, so dealing with models doesn't scare us, it's actually easier than having to learn a new templating language and file structure.

So, you can tell it to use mongoid, and redis, no problem. If you do, it will create a base Page model for you, which will allow you to do full-on blogging. With this setup, every time you save a document (in app/docs/my-doc.md), it'll do what github-pages does to it: syntax highlight with pygments. Then it'll save it to mongo. When you're ready to push to gh-pages, you can run rake compile and it'll compile a static version with the correct file structure for GithubPages.

But if you all of a sudden realize you want to add some dynamic functionality, and you'll actually be needing the database, well then you can just push to heroku, no changes necessary.

Testing Tips

When you want to test views, just create a Rails app using this template:

cd spec
rails new spec_environment -t https://github.com/viatropos/rails-pages/spec
cd ..

Then you can run view tests, and render partials, no problem.

Something went wrong with that request. Please try again.