Created
April 8, 2010 17:51
-
-
Save marceloabib/360326 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
########################################################################## | |
# Arquivo: template.rb | |
# Descricao: Arquivo responsavel por executar os comandos emcima da sua | |
# aplicacao rails | |
# Autor: Marcelo Abib | |
# Email: [email protected] | |
#Versão: 1.1 | |
########################################################################## | |
# Removendo as paginas que nao iremos utilizar | |
run "rm README" | |
run "rm doc/README_FOR_APP" | |
run "rm public/index.html" | |
run "rm public/favicon.ico" | |
run "rm public/robots.txt" | |
#Colando a rota padrao | |
route %(map.root :controller => "dashboard") | |
#Gerando o controller para ficar de pagina padrao | |
generate :controller, "dashboard", "index" | |
# Instalando as Gems que precisaremos | |
gem "authlogic" | |
# Plugins que iremos utilizar | |
plugin "web-app-theme", :git => "http://github.com/pilu/web-app-theme" | |
plugin "will_paginate", :git => "git://github.com/mislav/will_paginate.git" | |
plugin "searchlogic", :git => "http://github.com/binarylogic/searchlogic" | |
plugin "live-validations", :git => "http://wiki.github.com/augustl/live-validations" | |
if yes?("Você vai usar o plugin foreigner?(yes ou no)") | |
plugin "foreigner", :git => "http://github.com/matthuhiggins/foreigner" | |
end | |
if yes?("Você vai usar o plugin jrails?(yes ou no)") | |
plugin "jrails", :git => "git://github.com/aaronchi/jrails.git" | |
end | |
plugin "i18n_label", :git => "git://github.com/iain/i18n_label.git" | |
plugin "activerecord_i18n_defaults", :git => "git://github.com/dcrec1/activerecord_i18n_defaults.git" | |
plugin "brazilian-rails", :git => "git://github.com/tapajos/brazilian-rails.git" | |
# Git | |
git :init | |
git :config => "color.branch auto" | |
git :config => "color.diff auto" | |
git :config => "color.interactive auto" | |
git :config => "color.status auto" | |
git :config => "color.ui true" | |
user_name = ask("Qual seu nome?") | |
git :config => "--global user.name '#{user_name}'" | |
email = ask("Qual seu email?") | |
git :config => "--global user.email '#{email}'" | |
git :add => "." | |
git :commit => "-a -m 'Instalndo os plugins basicos'" | |
# Criando o arquivo no locales do portugues e traduzindo. | |
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/, '\1' + "'pt-BR'" | |
gsub_file 'config/environment.rb', /(config.time_zone = ')UTC'/, '\1' + 'Brasilia' + '\'' | |
git :add => "." | |
git :commit => "-a -m 'Configurando o local e o idioma'" | |
#Gerando o tema da aplicacao | |
app_name = ask("Qual o nome da sua aplicacao?") | |
theme_name = ask("Qual o tema que voce gostaria de usar?") | |
run "script/generate theme --theme='#{theme_name}' --app_name='#{app_name}'" | |
#Verifica com o usuario se ele quer que instala os pacotes famfamfam | |
if yes?("Você quer instalar os pacotes famfamfam de icones?(yes ou no)") | |
run "wget -c http://www.famfamfam.com/lab/icons/silk/famfamfam_silk_icons_v013.zip" | |
run "unzip famfamfam_silk_icons_v013.zip" | |
run "mv icons/* public/images/web-app-theme/" | |
run "rm -r icons/" | |
run "rm readme.html" | |
run "rm readme.txt" | |
run "rm famfamfam_silk_icons_v013.zip" | |
end | |
git :add => "." | |
git :commit => "-a -m 'Gerando o tema da aplicacao'" | |
#Pergunto se executo o capistrano ou nao | |
capify! if yes?("Devo executar o capistrano? (yes or no)") | |
#Adicionando o conteudo abaixo para traduzir alguns comandos do web-app-theme e do will_paginate | |
append_file "config/locales/pt-BR.yml", <<-TXT | |
#will_paginate | |
next: Proximo | |
previous: Anterior | |
#web-app-theme | |
web-app-theme: | |
save: Gravar | |
cancel: Cancelar | |
list: Listagem | |
edit: Alterar | |
new: Novo | |
show: Exibir | |
delete: Excluir | |
confirm: Tem certeza? | |
created_at: Criado em | |
updated_at: Alterado em | |
all: Todos | |
TXT | |
git :add => "." | |
git :commit => "-a -m 'Adicionado o will_paginate e web-app-theme na traducao'" | |
#Adicionando o conteudo abaixo no application helper, para que funcione a traducao no will_paginate. | |
file "app/helpers/application_helper.rb", <<-TXT | |
module ApplicationHelper | |
include WillPaginate::ViewHelpers | |
def will_paginate_with_i18n(collection, options = {}) | |
will_paginate_without_i18n(collection, options.merge(:previous_label => I18n.t(:previous), :next_label => I18n.t(:next))) | |
end | |
alias_method_chain :will_paginate, :i18n | |
end | |
TXT | |
git :add => "." | |
git :commit => "-a -m 'Adicionado o helper do will_paginate, pois nao tem suporte I18n'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment