Skip to content

Instantly share code, notes, and snippets.

@leandrocp
Created August 5, 2012 22:26
Show Gist options
  • Save leandrocp/3267484 to your computer and use it in GitHub Desktop.
Save leandrocp/3267484 to your computer and use it in GitHub Desktop.
Rails 3 bootstrap
# rails3_bootstrap.rb
#
# rails new project --skip-test-unit -m rails3_bootstrap.rb
require 'rbconfig'
HOST_OS = RbConfig::CONFIG['host_os']
# Limpeza
#-------------------------------------------------------------------------------
say("Limpando arquivos", :yellow)
run "rm -Rf .gitignore README public/index.html test app/views/layouts/* public/images/rails.png"
# Gems
#-------------------------------------------------------------------------------
say("Adicionando gems", :yellow)
#gem 'brazilian-rails', :git => 'git://github.com/tapajos/brazilian-rails.git'
gem 'slim-rails'
gem 'simple_form'
gem "nested_form", :git => 'git://github.com/ryanb/nested_form.git'
gem 'friendly_id'
#gem 'capistrano'
gem 'zurb-foundation', :group => :assets
gem 'compass-rails', :group => :assets
gem 'thin', :group => :development
gem 'rails_best_practices', :group => :development
gem 'rspec-rails', :group => [:test, :development]
#gem 'cucumber-rails', :group => [:test]
#gem 'pickle', :group => [:test, :development]
gem 'factory_girl_rails', :group => [:test, :development]
gem 'database_cleaner', :group => [:test]
gem 'faker', :group => [:test]
gem 'capybara', :group => [:test]
gem 'launchy', :group => [:test]
gem 'guard-rspec', :group => [:development]
#gem 'guard-cucumber', :group => [:development]
gem 'sqlite3', :group => [:test, :development]
gem 'pg', :group => :production
case HOST_OS
when /darwin/i
gem 'rb-fsevent', :group => :development
gem 'growl', :group => :development
when /linux/i
gem 'libnotify', :group => :development
gem 'rb-inotify', :group => :development
when /mswin|windows/i
gem 'rb-fchange', :group => :development
gem 'win32console', :group => :development
gem 'rb-notifu', :group => :development
end
# Bundle
#-------------------------------------------------------------------------------
say("Instalando gems", :yellow)
run "bundle install --without production"
# Setup Gems
#-------------------------------------------------------------------------------
say("Configurando Gems", :yellow)
generate "rspec:install"
#generate "cucumber:install"
run "guard init"
generate "foundation:install"
generate "foundation:layout --slim"
generate "simple_form:install -e slim"
generate "nested_form:install"
run "capify ."
# Generators
#-------------------------------------------------------------------------------
generators = <<-GENERATORS
config.generators do |g|
g.test_framework :rspec,
:fixtures => true,
:view_specs => false,
:helper_specs => false,
:routing_specs => false,
:controller_specs => true,
:request_specs => true
g.fixture_replacement :factory_girl, :dir => "spec/factories"
end
GENERATORS
application generators
# Locale pt-BR
# http://github.com/lackac/app_lego/blob/master/locale.rb
#-------------------------------------------------------------------------------
say("Localizacao pt-BR", :yellow)
get "https://github.com/svenfuchs/rails-i18n/raw/master/rails/locale/pt-BR.yml", "config/locales/pt-BR.yml"
gsub_file "config/application.rb",
/(#\s*)?config.i18n.default_locale.*$/,
"config.i18n.default_locale = 'pt-BR'"
# Time Zone Brasilia
#-------------------------------------------------------------------------------
say("Time Zone BR", :yellow)
gsub_file "config/application.rb",
/(#\s*)?config.time_zone.*$/,
"config.time_zone = 'Brasilia'"
# Deploy (capistrano)
#-------------------------------------------------------------------------------
say("Deploy (capistrano)", :yellow)
run "curl https://raw.github.com/gist/1594294/89a9ccc627c4f7a86f9559b7b743d995e305e062/deploy.rb > config/deploy.rb"
# Database
#-------------------------------------------------------------------------------
say("Banco de dados", :yellow)
rake "db:create:all"
rake "db:migrate"
# Git
#-------------------------------------------------------------------------------
say("git", :yellow)
git :init
run "curl https://raw.github.com/github/gitignore/master/Ruby.gitignore > .gitignore"
run "curl https://raw.github.com/github/gitignore/master/Rails.gitignore >> .gitignore"
git :add => "."
git :commit => "-am 'primeiro commit'"
# Notas
#-------------------------------------------------------------------------------
say("Ver: https://github.com/plataformatec/simple_form/wiki/Zurb%27s-Foundation-integration", :yellow)
say("Ver: https://github.com/ryanb/nested_form", :yellow)
say("Ver: https://github.com/styleguide/ruby", :yellow)
say("Ver: https://github.com/bbatsov/rails-style-guide", :yellow)
say("Feito!", :green)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment