Skip to content

Instantly share code, notes, and snippets.

@dkln
Forked from finalist/gist:72684
Created March 2, 2009 15:06
Show Gist options
  • Save dkln/72786 to your computer and use it in GitHub Desktop.
Save dkln/72786 to your computer and use it in GitHub Desktop.
Ruby on Rails 2.3 template
require 'open-uri'
require 'erb'
# Build seperate config files for each db type
CONFIG_URLS = [:mysql, :oracle, :sqlite2, :sqlite3, :postgresql, :frontbase, :ibm_db]
BASE_URL = "http://github.com/rails/rails.git/railties/configs/databases/"
app_name = "app"
socket = false
CONFIG_URLS.each do |c|
file("config/database.#{c}.yml", ERB.new(open("#{BASE_URL}#{c}.yml").read, nil, '-').result(binding))
end
# Docs
run "rm README"
file "README.rdoc", "TODO add readme content"
run "rm public/index.html"
# RSpec as plugin, because it won't freeze easily as gem
plugin "rspec", :git => "git://github.com/dchelimsky/rspec.git"
plugin "rspec-rails", :git => "git://github.com/dchelimsky/rspec-rails.git"
generate :rspec
run "rm -r test/"
# Sphinx?
if yes?('Do you want to use Sphinx?')
plugin "thinking-sphinx", :git => "git://github.com/freelancing-god/thinking-sphinx.git"
end
# XML
if yes?('Are you going to use XML?')
gem 'hpricot'
end
# Gems
gem 'authlogic'
gem 'haml'
gem 'faker'
gem 'cucumber'
gem 'RedCloth', :lib => 'redcloth'
gem 'mislav-will_paginate', :lib => 'will_paginate', :source => 'http://gems.github.com'
gem 'thoughtbot-factory_girl', :lib => 'factory_girl', :source => 'http://gems.github.com'
gem 'brynary-webrat', :lib => 'webrat', :source => 'http://gems.github.com'
rake "gems:unpack"
rake "rails:freeze:gems"
# Run cucumber initialization script
generate :cucumber
generate :rspec
# Plugins
plugin "mr.-t", :git => "git://github.com/iain/mr.-t.git"
plugin "acts_as_translatable_model", :git => "git://github.com/iain/acts_as_translatable_model.git"
plugin "i18n_label", :git => "git://github.com/iain/i18n_label.git"
# Version management
if yes?("Do you need to use subversion?")
puts "Poor soul!"
plugin "rake_svn", :git => "git://github.com/iain/rake_svn.git"
rake "svn:init_rails" if system("svn info")
else
run "touch tmp/.gitignore log/.gitignore vendor/.gitignore"
file ".gitignore", <<-END
log/*.log
tmp/**/*
config/database.yml
db/*.sqlite3
END
git :init
git :add => '.', :commit => '-m "Initial Commit"'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment