Skip to content

Instantly share code, notes, and snippets.

Created August 3, 2009 09:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/160441 to your computer and use it in GitHub Desktop.
Save anonymous/160441 to your computer and use it in GitHub Desktop.
# Usage:
# rails -m ~/template.rb -d mysql foo
#
# For more templates (that this depends on), see ~/templates/
# After creating the rails app via template:
#
# ./script/generate rspec_controller Foo
# ./script/generate rspec_model Baz --skip-migration --skip-fixture
# Git pre-setup
run "rm -rf log/*"
run "touch log/.gitignore"
run "touch tmp/.gitignore"
run "cp -f ~/template/.gitignore ."
run "rm -rf test/*"
run "rm public/index.html"
run "rm README"
run "touch README"
git :init
git :add => "."
git :commit => "-a -m 'initial commit'"
plugin 'rspec', :git => 'git://github.com/dchelimsky/rspec.git', :submodule => true
plugin 'rspec-rails', :git => 'git://github.com/dchelimsky/rspec-rails.git', :submodule => true
plugin 'backup_fu', :git => 'git://github.com/gravelpup/backup_fu.git', :submodule => true
plugin 'will_paginate', :git => 'git://github.com/mislav/will_paginate.git', :submodule => true
plugin 'libmemcached_store', :git => 'git://github.com/cheald/libmemcached_store.git', :submodule => true
plugin 'machinist', :git => 'git://github.com/notahat/machinist.git', :submodule => true
plugin 'hoptoad_notifier', :git => 'git://github.com/pzingg/hoptoad_notifier.git', :submodule => true
plugin 'authlogic', :git => 'git://github.com/binarylogic/authlogic.git', :submodule => true
generate :rspec
generate :session, 'user_session'
generate :controller, 'home', 'index'
#generate :rspec_controller, 'home', 'index'
#generate :rspec_controller, 'UserSessions', 'new', 'create', 'destroy'
run 'echo "Rake::Task[:default].prerequisites.clear" > lib/tasks/default.rake'
# Authlogic Setup
run "cp -f ~/template/user_sessions_controller.rb app/controllers/"
run "cp -f ~/template/application_controller.rb app/controllers/"
run "cp -f ~/template/user.rb app/models"
run "mkdir app/views/user_sessions/"
run "cp -f ~/template/new.rhtml app/views/user_sessions/"
run "cp -f ~/template/users_controller.rb app/controllers/"
run "mkdir app/views/users/"
run "cp -R -f ~/template/user_views/* app/views/users/"
run "mkdir db/migrate/"
run "cp ~/template/001_initial.rb db/migrate/"
# Routing
route "map.resource :user_session"
route "map.root :controller => 'home'"
run "rake db:create:all"
# Cleanup
run "rm -rf test/*"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment