Skip to content

Instantly share code, notes, and snippets.

@edelbalso
Forked from bosoxbill/Notes.md
Created December 18, 2012 18:36
Show Gist options
  • Save edelbalso/4330680 to your computer and use it in GitHub Desktop.
Save edelbalso/4330680 to your computer and use it in GitHub Desktop.

Setup RVM/Rails

With RVM installed, I like to maintain a gemset called new_projects. This has whatever rails version I want to be creating new projects with.

$ rvm 1.9.3@new_projects --verbose --create
$ gem install rails

Rails Setup Commands

$ gem install rails
$ rails new [newapp] -T -d postgresql --skip-bundle
$ echo "rvm 1.9.3@[newapp] --verbose --create" > [newapp]/.rvmrc

Gemfile

Update the gemfile to include the following (some will already be there, these are to copy/paste after the included comment) TODO: update for ruby debugger

# Deploy with Capistrano
gem 'capistrano'

gem 'devise'
gem 'haml-rails'
gem 'html5-rails'
gem 'inherited_resources'

group :development, :test do
  #gem 'ruby-debug19', :require => 'ruby-debug'
  gem 'rspec-rails'
  gem 'database_cleaner'
  gem 'factory_girl_rails'
  gem 'capybara'
  gem 'pry'
end

group :assets do
  gem 'sass-rails'
  gem 'coffee-rails'
  gem 'compass-rails'
  gem 'compass-h5bp'
  gem 'uglifier'
end

DB Setup

Remove the role info from config/database.yml and

$ rake db:create:all

Gem Setups/Installs

$ rails generate rspec:install
$ rails generate devise:install
$ rails generate html5:install

Devise install will give you further instructions to follow.

Testing Setup

You will need factories in spec/factories.rb

You willll need to make sure rspec can get at the devise helpers

edit spec/support/devise.rb to include:

RSpec.configure do |config|
  config.include Devise::TestHelpers, :type => :controller
end

You will need to make the capybara DSL available for rspec. Make sure spec/spec_helper includes the following require calls:

require 'capybara/rspec'
require 'capybara/rails'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment