Created
August 27, 2009 22:50
-
-
Save newtonapple/176639 to your computer and use it in GitHub Desktop.
A Rails Template: JQuery, Rspec, WillPaginate, BoilerPlate CSS, SQL Schema, NO Time Stamped Migration
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
## ENV | |
environment do | |
<<-ENV_CODE | |
config.active_record.timestamped_migrations = false | |
config.active_record.schema_format = :sql | |
# ENV['RAILS_ASSET_ID'] = '' # turn off assets timestamp | |
ENV_CODE | |
end | |
## GEMS | |
gem 'mislav-will_paginate', :lib => 'will_paginate' | |
rake "gems:unpack" | |
## TEST (don't freeze test libraries) | |
with_options :env => 'test' do |t| | |
t.with_options :lib => false do |tt| | |
tt.gem 'rspec' | |
tt.gem 'rspec-rails' | |
end | |
t.gem 'webrat' | |
end | |
generate 'rspec' | |
## File Cleanups | |
run "rm public/index.html" | |
run "rm public/images/rails.png" | |
## DB | |
if yes?('Drop ALL databases?') | |
rake 'db:drop:all' | |
end | |
if yes?('Create ALL databases?') | |
rake 'db:create:all' | |
end | |
## Home | |
if yes?('Generate Index Controller?') | |
generate 'rspec_controller index index' | |
route "map.root :controller => 'index'" | |
end | |
## Layouts | |
file("app/helpers/application_helper.rb") do | |
<<-APP_HELPER | |
module ApplicationHelper | |
def page_title | |
@page_title ||= site_title + " - Page Title" | |
end | |
def site_title | |
@site_title ||= 'Site Title' | |
end | |
end | |
APP_HELPER | |
end | |
file("app/views/layouts/application.html.erb") do | |
<<-APP_LAYOUT | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html> | |
<head> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> | |
<title><%= page_title %></title> | |
<%= stylesheet_link_tag 'site', :cache => true %> | |
<%= javascript_include_tag :all, :cache => true %> | |
</head> | |
<body> | |
<div id="wrapper"> | |
<div id="header"> | |
</div> | |
<div id="content"> | |
<%= yield %> | |
</div> | |
<div id="footer"> | |
</div> | |
</div> | |
</body> | |
</html> | |
APP_LAYOUT | |
end | |
## CSS | |
file("public/stylesheets/site.css") do | |
<<-CSS | |
/* -------------------------------------------------------------- | |
RESET (via Eric Meyer) | |
-------------------------------------------------------------- */ | |
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { margin: 0; padding: 0; border: 0; outline: 0; font-size: 100%; vertical-align: baseline; background: transparent; } | |
body { line-height: 1; } | |
ol, ul { list-style: none; } | |
blockquote, q { quotes: none; } | |
blockquote:before, blockquote:after, q:before, q:after { content: ''; content: none; } | |
:focus { outline: 0; } | |
ins { text-decoration: none; } | |
del { text-decoration: line-through; } | |
table { border-collapse: collapse; border-spacing: 0; } | |
/* -------------------------------------------------------------- | |
TYPOGRAPHY | |
-------------------------------------------------------------- */ | |
body,h1,h2,h3,h4,h5,h6,p,ul,ol,dl,input,textarea { font-family: Helvetica, Arial, FreeSans, sans-serif; } | |
/* HEADINGS */ | |
h1 { font-size: 40px; line-height: 50px; margin-bottom: 10px; } | |
h2 { font-size: 30px; line-height: 40px; margin-bottom: 10px; } | |
h3 { font-size: 20px; line-height: 30px; } | |
h4 { font-size: 14px; line-height: 20px; } | |
h5 { font-size: 14px; line-height: 20px; } | |
h6 { font-size: 14px; line-height: 20px; } | |
/* TEXT ELEMENTS */ | |
p, ul, ol, dl { margin-bottom: 20px; font-size: 14px; line-height: 20px; } | |
ul, ol { padding-left: 20px;} | |
ul { list-style-type: circle; } | |
ol { list-style-type: decimal; } | |
dl dt { font-weight: bold; } | |
dl dd { padding-left: 10px; } | |
abbr, acronym { text-decoration: underline; } | |
a { color: #009; text-decoration: none; } | |
a:hover { text-decoration: underline; } | |
blockquote { margin: 20px 0; padding-left: 10px; } | |
dfn { font-style: italic; font-weight: bold; } | |
pre, code { margin: 20px 0; white-space: pre; } | |
pre, code, tt { font: 10px monospace; line-height: 20px; } | |
tt { display: block; margin: 20px 0; line-height: 20px; } | |
/* TABLES */ | |
table { margin-bottom: 20px; } | |
th,td { padding: 5px 10px 5px 0; } | |
/* -------------------------------------------------------------- | |
FORMS | |
-------------------------------------------------------------- */ | |
label { font-weight: bold; } | |
fieldset { padding: 9px; margin-bottom: 20px; border: 1px solid #ddd; } | |
legend { padding: 0 10px; font-weight: bold; font-size: 14px; line-height: 20px; } | |
textarea { padding: 10px; } | |
/* -------------------------------------------------------------- | |
SITE | |
-------------------------------------------------------------- */ | |
#wrapper { | |
width: 80%; | |
max-width: 100em; | |
margin: 0 auto; | |
} | |
/* Clear float w/o extra markups */ | |
#header { display: inline-block; } | |
#header:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } | |
* html #header { height: 1%; } | |
#header { display: block; } | |
CSS | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment