Os templates do Rails podem fazer para você várias configurações iniciais para sua aplicação (configurar gems, iniciar repositório git...).
Abaixo segue o template que eu criei:
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
# ignoring files | |
file ".gitignore", <<-TXT | |
log/*.log | |
tmp/**/* | |
db/*.sqlite3 | |
.DS_Store | |
Thumbs.db | |
TXT | |
# download pt-br i18n and configure environment | |
file "config/locales/pt-BR.yml", open("http://github.com/svenfuchs/rails-i18n/raw/master/rails/locale/pt-BR.yml").read | |
gsub_file "config/environment.rb", | |
'# config.i18n.default_locale = :de', 'config.i18n.default_locale = "pt-BR"' | |
# add authlogic i18n to locale | |
append_file "config/locales/pt-BR.yml", <<-TXT | |
# Authlogic | |
authlogic: | |
error_messages: | |
login_blank: "não pode ficar em branco" | |
login_not_found: "não é válido" | |
login_invalid: "deve usar somente letras, números, espaços e .-_@" | |
consecutive_failed_logins_limit_exceeded: "Consecutivos logins que falharam limite excedido, a conta está desativada." | |
email_invalid: "deve ser semelhante a um endereço de email." | |
password_blank: "não pode ficar em branco" | |
password_invalid: "não é válido" | |
not_active: "Sua conta não está ativa" | |
not_confirmed: "Sua conta não está confirmada" | |
not_approved: "Sua conta não foi aprovada" | |
no_authentication_details: "Você não forneceu nenhum detalhe para autenticação." | |
models: | |
user_session: "SessãoUsuário" | |
attributes: | |
user_session: | |
login: "Usuário" | |
email: "Email" | |
password: "Senha" | |
remember_me: "Lembrar me" | |
TXT | |
# configure gems | |
gem "authlogic" | |
gem "searchlogic" | |
gem "mislav-will_paginate", :lib => 'will_paginate', :source => 'http://gems.github.com' | |
gem "josevalim-inherited_resources", :lib => "inherited_resources", :source => "http://gems.github.com" | |
gem "justinfrench-formtastic", :lib => 'formtastic', :source => 'http://gems.github.com' | |
gem "rails-footnotes", :source => "http://gemcutter.org" | |
# configure plugins | |
plugin "validation_reflection", :git => "git://github.com/redinger/validation_reflection.git" | |
# configure gems manifest (for Heroku) | |
file ".gems", <<-TXT | |
authlogic | |
searchlogic | |
mislav-will_paginate --source 'http://gems.github.com' | |
josevalim-inherited_resources --source "http://gems.github.com" | |
justinfrench-formtastic --source 'http://gems.github.com' | |
rails-footnotes --source "http://gemcutter.org" | |
TXT | |
# create base populator | |
rakefile "populate.rake" do | |
<<-TXT | |
namespace :db do | |
desc "Erase database data and fill with sample data" | |
task :populate => :environment do | |
require 'populator' | |
require 'faker' | |
# do your populator tasks here | |
end | |
end | |
TXT | |
end | |
# initializing repository | |
git :init | |
git :add => "." | |
git :commit => %(-m "initial commit") |
Para quem quizer utilizar para testar basta executar o seguinte comando:
rails NOME_APP -m http://gist.github.com/raw/227656/f64ca46032c6e83f92000c9c33ce078b65beafdd/rails_template.rb