Created
December 5, 2009 17:19
-
-
Save hotgazpacho/249767 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
git :init | |
# 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/* | |
END | |
gem 'cucumber' | |
gem 'rspec' | |
gem 'rspec-rails' | |
gem 'factory_girl' | |
gem 'authlogic' | |
gem 'cancan' | |
gem 'formtastic' | |
gem 'validation_reflection' | |
gem 'inherited_resources' | |
gem 'jrails' | |
gem 'will_paginate' | |
gem 'aasm' | |
rake "gems:install" | |
plugin 'jrails', :git => 'git://github.com/aaronchi/jrails.git' | |
plugin 'exception_notifier', :git => 'git://github.com/rails/exception_notification.git' | |
plugin 'ssl_requirement', :git => 'git://github.com/rails/ssl_requirement.git' | |
git :submodule => "init" | |
# Copy database.yml for distribution use | |
run "cp config/database.yml config/database.yml.example" | |
run "rm public/index.html" | |
# Set up sessions, RSpec, user model, OpenID, etc, and run migrations | |
generate("cucumber") | |
generate("rspec") | |
rake "jrails:scrub" | |
rake "jrails:js:install" | |
generate("rspec_model", "user", "email:string", "crypted_password:string", "password_salt:string", "persistence_token:string") | |
file "app/models/user.rb", <<-END | |
class User < ActiveRecord::Base | |
acts_as_authentic | |
end | |
END | |
generate("session", "user_session") | |
generate("rspec_controller", "user_sessions") | |
file 'app/controllers/application.rb', <<-CODE | |
class ApplicationController < ActionController::Base | |
include SslRequirement | |
helper :all # include all helpers, all the time | |
protect_from_forgery # See ActionController::RequestForgeryProtection for details | |
# Scrub sensitive parameters from your log | |
filter_parameter_logging :password, :password_confirmation | |
helper_method :current_user_session, :current_user | |
private | |
def current_user_session | |
return @current_user_session if defined?(@current_user_session) | |
@current_user_session = UserSession.find | |
end | |
def current_user | |
return @current_user if defined?(@current_user) | |
@current_user = current_user_session && current_user_session.user | |
end | |
end | |
CODE | |
file 'app/models/ability.rb', <<-CODE | |
class Ability | |
include CanCan::Ability | |
def initialize(user) | |
if user.admin? | |
can :manage, :all | |
else | |
can :read, :all | |
end | |
end | |
end | |
CODE | |
route("map.resource :user_session") | |
route('map.root :controller => "user_sessions", :action => "new"') | |
route('map.resource :account, :controller => "users"') | |
route('map.resources :users') | |
rake "db:migrate" | |
generate("formtastic") | |
# reset.css | |
run "curl -L http://meyerweb.com/eric/tools/css/reset/reset.css > public/stylesheets/reset.css" | |
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