rails-mrap-seed
For those who need to go fast on Rails.
This is the seed project I wish I had for my last hackathons.
The Stack:
Main Players:
- Mongoid (Wrapper for MongoDB)
- HAML
- Bootstrap (Sass flavored)
- RSpec
- Capybara (Preconfigured to use Poltergeist for fast BDD)
Fast Testing!
- Zeus (Saves too much time, run specs immediately)
- Guard (Automatically runs the correct spec after you save the file)
Fast Deployment!
Preconfigured for Heroku. Foreman for development, Unicorn for production.
Details here.
Note: Requires a MongoDB add-on. I use MongoHQ.
Getting Started
Before you begin, ensure you have MongoDB installed on your system.
For Mac users, I recommend installing MongoDB via Homebrew:
brew install mongodb
-
Clone this repo and cd into the directory.
git clone git@github.com:mrap/rails-mrap-seed.git && cd rails-mrap-seed
-
In another terminal window, start your local
MongoDBserver. This will run in the background as your development server.mongod
-
Bundle install everything.
bundle install
-
Run rspec and make sure it works.
rspec
The Ideal Setup
4 terminal windows
Main Terminal: This is where you code/commit/etc. The usual stuff.
Guard: This is where your specs run automatically. Zeus must be running!
Start Guard:
bundle exec guard
Zeus: This is where you can start/stop Zeus.
Start Zeus:
zeus start
MongoDB: This is where you start/stop MongoDB. DO NOT forget to start this.
Start MongoDB:
mongod
Ideally we want our specs to run automatically everytime we save a file.
We use zeus to keep Rails "running" in its current state.
If you don't use zeus, you'd have to wait ~3-5 seconds everytime you run specs.
Railscasts breaks down the details in this screencast. I highly recommend watching this!