Skip to content

Instantly share code, notes, and snippets.

@rrichards
Created April 7, 2009 23:47
Show Gist options
  • Save rrichards/91539 to your computer and use it in GitHub Desktop.
Save rrichards/91539 to your computer and use it in GitHub Desktop.
rails template for skeleton app, haml, sass, shoulda, factory_girl, jquery
# Set up git repository
git :init
# Copy database.yml for distribution use
run "cp config/database.yml config/database.yml.example"
# Set up .gitignore files
run %{find . -type d -empty | xargs -I xxx touch xxx/.gitignore}
file '.gitignore', <<-END
.DS_Store
coverage/*
log/*.log
db/*.db
db/*.sqlite3
db/schema.rb
tmp/**/*
doc/api
doc/app
config/database.yml
coverage/*
public/stylesheets/*.css
END
# get jquery and plugins
run "curl -L http://jqueryjs.googlecode.com/files/jquery-1.3.2.js > public/javascripts/jquery.js"
run "curl -L http://jqueryjs.googlecode.com/svn/trunk/plugins/form/jquery.form.js > public/javascripts/jquery.form.js"
# 960.gs
run "curl -L http://github.com/nathansmith/960-grid-system/tree/master/code/css/uncompressed/960.css > public/stylesheets/960.css"
run "curl -L http://github.com/nathansmith/960-grid-system/tree/master/code/css/uncompressed/reset.css > public/stylesheets/reset.css"
run "curl -L http://github.com/nathansmith/960-grid-system/tree/master/code/css/uncompressed/text.css > public/stylesheets/text.css"
# SASS
run "mkdir public/stylesheets/sass"
run "css2sass public/stylesheets/960.css public/stylesheets/sass/960.sass"
run "css2sass public/stylesheets/text.css public/stylesheets/sass/text60.sass"
run "css2sass public/stylesheets/reset.css public/stylesheets/sass/reset.sass"
run 'rm -rf public/stylesheets/*.css'
# application layout
file 'app/views/layouts/application.html.haml', <<-FILE
!!!
%html{ "xml:lang" => "en", :lang => "en", :xmlns => "http://www.w3.org/1999/xhtml" }
%head
%meta{ :content => "text/html; charset=utf-8", "http-equiv" => "Content-type" }
%title
\#{app_name}
= stylesheet_link_tag 'screen', 'datePicker', :media => 'screen, projection'
= stylesheet_link_tag 'print', :media => 'print'
/
[if IE]>
= stylesheet_link_tag 'ie', :media => 'all'
<![endif]
= javascript_include_tag 'jquery', 'jquery.form.js', 'date', 'jquery.datePicker.js', :cache => true
= yield(:head)
%script{ :type => "text/javascript" }
$(function() {
= yield(:jquery)
});
%body
#navigation
#content
- if flash[:notice]
#flash
= flash[:notice]
= yield
FILE
# Install plugins as git submodules
plugin 'query_reviewer', :git => 'git://github.com/dsboulder/query_reviewer.git', :submodule => true
plugin 'asset_packager', :git => 'git://github.com/sbecker/asset_packager.git', :submodule => true
plugin 'shoulda', :git => 'git://github.com/thoughtbot/shoulda.git', :submodule => true
plugin 'factory_girl', :git => 'git://github.com/thoughtbot/factory_girl.git', :submodule => true
plugin 'jrails', :git => 'git://github.com/aaronchi/jrails.git', :submodule => true
plugin 'haml', :git => 'git://github.com/nex3/haml.git', :submodule => true
plugin 'acts-as-taggable-on', :git => 'git://github.com/mbleigh/acts-as-taggable-on.git', :submodule => true
plugin 'authlogic', :git => 'git://github.com/binarylogic/authlogic.git vendor/plugins/authlogic', :submodule => true
plugin 'authlogic_generator', :git => 'git://github.com/masone/authlogic_generator.git', :submodule => true
plugin 'will_paginate', :git => 'git://github.com/mislav/will_paginate.git', :submodule => true
plugin 'paperclip', :git => 'git://github.com/thoughtbot/paperclip.git', :submodule => true
plugin 'thinking-sphinx', :git => 'git://github.com/freelancing-god/thinking-sphinx.git', :submodule => true
# Initialize submodules
git :submodule => "init"
# Setup HAML
run %{haml --rails .}
gem 'jscruggs-metric_fu', :lib => 'metric_fu', :source => 'http://gems.github.com'
rake('gems:install', :sudo => true)
rake('db:sessions:create')
generate :acts_as_taggable_on_migration
generate :authlogic
run 'capify .'
rake('db:migrate')
# Commit all work so far to the repository
git :add => '.'
git :commit => "-a -m 'Initial commit'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment