Skip to content

Instantly share code, notes, and snippets.

@gom
Created February 8, 2009 13:19
Show Gist options
  • Save gom/60380 to your computer and use it in GitHub Desktop.
Save gom/60380 to your computer and use it in GitHub Desktop.
my rails application template
#template.rb
# Set up initializer
initializer 'myconfig.rb', <<-END
Rails::Initializer.run do |config|
config.action_controller.session = {
:key => '_myapp_session',
:secret => '#{(1..40).map { |x| (65 + rand(26)).chr }.join}'
}
config.action_controller.relative_url_root='/myapp'
config.time_zone = 'UTC'
config.i18n.default_locale = :ja
end
END
# Download JQuery
run "curl -L http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js > public/javascripts/jquery.js"
run "curl -L http://jqueryjs.googlecode.com/svn/trunk/plugins/form/jquery.form.js > public/javascripts/jquery.form.js"
# Plugins
plugin 'rspec', :git => 'git://github.com/dchelimsky/rspec.git'
plugin 'rspec-rails',:git => 'git://github.com/dchelimsky/rspec-rails.git'
plugin 'restful-authentication', :git => 'git://github.com/technoweenie/restful-authentication.git'
plugin 'open_id_authentication', :git => 'git://github.com/rails/open_id_authentication.git'
plugin 'selenium-on-rails', :git => 'git://github.com/paytonrules/selenium-on-rails.git'
plugin 'will_paginate', :git => 'git://github.com/mislav/will_paginate.git'
# Gems
#gem 'capistrano'
gem 'termios'
gem 'will_paginate'
gem 'rubyist-aasm'
gem 'ruby-openid'
gem 'mocha'
rake("gems:install", :sudo => true) if yes?("Install dependent gems ?")
rake("gems:unpack:dependencies") if yes?("Freeze gems?")
# Capify
capify!
current = Dir.pwd
file 'config/deploy.rb', <<-END
set :application, "APP_NAME"
set :scm, :git
set :repository, "#{current}/APP_NAME/.git"
set :branch, 'master'
set :deploy_to, "#{current}/dep/APP_NAME/"
set :deploy_via, :copy
role :app, "localhost"
role :web, "localhost"
role :db, "localhost", :primary => true
set :use_sudo, false
END
# Copy database.yml
run "cp config/database.yml config/database.yml.example"
# Set up .gitignore files
file '.gitignore', <<-END
.DS_Store
log/*.log
tmp/**/*
config/database.yml
db/*.sqlite3
END
# Set up RSpec, OpenID, etc, and run migrations
rake 'db:sessions:create'
generate "rspec"
generate "authenticated", "user session --stateful"
rake 'open_id_authentication:db:create'
rake 'db:migrate'
# git
git :init
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