Created
March 11, 2009 04:57
-
-
Save intabulas/77322 to your computer and use it in GitHub Desktop.
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
project_name = `pwd`.split('/').last.strip | |
git :init | |
# =================================================================== | |
# Base database configuration using MySQL | |
# =================================================================== | |
file 'config/database.yml', <<-END | |
common: &common | |
adapter: mysql | |
encoding: utf8 | |
reconnect: false | |
pool: 5 | |
username: root | |
password: | |
socket: /tmp/mysql.sock | |
development: | |
database: #{project_name}_development | |
<<: *common | |
test: | |
database: #{project_name}_test | |
<<: *common | |
production: | |
database: #{project_name}_production | |
<<: *common | |
END | |
# =================================================================== | |
# Copy database.yml for distribution use | |
# =================================================================== | |
run "cp config/database.yml config/database.yml.example" | |
rake( "db:create" ) | |
# =================================================================== | |
# Delete unnecessary files | |
# =================================================================== | |
run "rm README" | |
run "rm public/index.html" | |
run "rm public/favicon.ico" | |
run "rm public/robots.txt" | |
run "rm public/images/rails.png" | |
run "rm -f public/javascripts/*" | |
file 'README.textile', <<-END | |
END | |
# =================================================================== | |
# Delete some directories we dont need anymore | |
# =================================================================== | |
["./tmp/pids", "./tmp/sessions", "./tmp/sockets", "./tmp/cache"].each do |f| | |
run("rmdir ./#{f}") | |
end | |
# =================================================================== | |
# GEMS | |
# =================================================================== | |
gem 'mislav-will_paginate', :lib => 'will_paginate', :source => 'http://gems.github.com' | |
gem 'authlogic' | |
rake('gems:install', :sudo => true) | |
# =================================================================== | |
# PLUGINS | |
# =================================================================== | |
plugin "paperclip", :git => "git://github.com/thoughtbot/paperclip.git" | |
# =================================================================== | |
# Download JQuery | |
# =================================================================== | |
run "curl -s -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" | |
run "curl -L http://jqueryjs.googlecode.com/svn/trunk/plugins/methods/date.js > public/javascripts/date.js" | |
run "curl -L http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/scripts/jquery.datePicker.js > public/javascripts/jquery.datePicker.js" | |
run "curl -L http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/styles/datePicker.css > public/stylesheets/datePicker.css" | |
# =================================================================== | |
# Set up .gitignore files | |
# =================================================================== | |
run "touch tmp/.gitignore log/.gitignore vendor/.gitignore" | |
run %{find . -type d -empty | grep -v "vendor" | grep -v ".git" | grep -v "tmp" | xargs -I xxx touch xxx/.gitignore} | |
file '.gitignore', <<-END | |
log/\\*.log | |
log/\\*.pid | |
db/\\*.db | |
db/\\*.sqlite3 | |
db/schema.rb | |
tmp/\\*\\*/\\* | |
.DS_Store | |
ToDo | |
tmp/**/* | |
sphinx/*.sp* | |
coverage | |
# Other useful tidbits | |
.DS_Store | |
doc/api | |
doc/app | |
# Config files | |
config/database.yml | |
# database schema | |
db/schema.rb | |
END | |
# =================================================================== | |
# Create empty application js file | |
# =================================================================== | |
file 'public/javascripts/application.js', %Q{// Place your javascript code here} | |
file 'public/stylesheets/application.css', %Q{/* Place your CSS code here */} | |
file 'public/stylesheets/print.css', %Q{/* Place your print CSS code here */} | |
# =================================================================== | |
# flash | |
# =================================================================== | |
file 'app/views/layouts/_flashes.html.erb', | |
%q{<div id="content"> | |
<%- if flash[:notice] -%> | |
<div id="flash"><%= flash[:notice] %></div> | |
<%- end -%> | |
<%= yield %> | |
</div> | |
} | |
# =================================================================== | |
# Create application layout | |
# =================================================================== | |
file 'app/views/layouts/application.html.erb', | |
%Q{<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | |
<title>Base Rails application using a reset</title> | |
<%= stylesheet_link_tag 'reset', 'application', 'datePicker', :media => 'all' %> | |
<%= stylesheet_link_tag 'print', :media => 'print' %> | |
<!--[if lte IE 6]> <link rel="stylesheet" href="/stylesheets/ie.css" type="text/css"><![endif]--> | |
<%= javascript_include_tag 'jquery', 'jquery.form.js', 'date', 'jquery.datePicker.js', 'application', :cache => true %> | |
</head> | |
<body> | |
<div id="container"> | |
<%= render :partial => 'layouts/flashes' -%> | |
<%= yield %> | |
</div> | |
</body> | |
</html> | |
} | |
# =================================================================== | |
# add reset stylesheet | |
# =================================================================== | |
file "public/stylesheets/reset.css", <<-END html,body,div,span,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,code,del,dfn,em,img,q,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline;border-width:0;border-style:none}body{line-height:1.5;background:#fff;margin:1.5em 0}table{border-collapse:separate;border-spacing:0}caption,th,td{text-align:left;font-weight:400}blockquote:before,blockquote:after,q:before,q:after{content:""}blockquote,q{quotes:""""}a img{border:none}table{border-collapse:collapse;border-spacing:0}ul{list-style-position:inside}.clearfix:after{content:".";display:block;clear:both;visibility:hidden;line-height:0;height:0}.clearfix{display:inline-block}html[xmlns] .clearfix{display:block}* html .clearfix{height:1%} | |
END | |
end | |
# =================================================================== | |
# Add an IE6 Hacks Stylesheet | |
# =================================================================== | |
file 'public/stylesheets/ie.css', <<-END | |
/* CSS fixes for IE */ | |
END | |
# =================================================================== | |
# Application Helper | |
# =================================================================== | |
file 'app/helpers/application_helper.rb', | |
%q{module ApplicationHelper | |
end | |
} | |
# =================================================================== | |
# Application Controller | |
# =================================================================== | |
file 'app/controllers/application_controller.rb', | |
%q{class ApplicationController < ActionController::Base | |
helper :all # include all helpers, all the time | |
protect_from_forgery # See ActionController::RequestForgeryProtection for details | |
protected | |
# Gracefully handle bad requests by serving a 404 page | |
def render_404 | |
respond_to do |format| | |
format.html { render :file => "#{RAILS_ROOT}/public/404.html", :status => '404 Not Found' } | |
format.xml { render :nothing => true, :status => '404 Not Found' } | |
end | |
true | |
end | |
end | |
} | |
# =================================================================== | |
# Final install steps | |
# =================================================================== | |
rake('gems:install', :sudo => true) | |
#rake("gems:unpack") | |
#rake('db:migrate') | |
# Set up git repository | |
commit_state "initial commit" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment