Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
83 lines (57 sloc) 3.82 KB

Sinatra Bootstrap

A simple Sinatra starting point

Sinatra Bootstrap supports:

What is the purpose of Sinatra Bootstrap?

I created Sinatra Bootstrap in order to have a consistent starting point for my Sinatra projects. I like having Haml, Sass and Compass available to me in every project, likewise jQuery and a few JavaScripts make their way into every production as well. A number of helpful rake tasks have also been included.

How do I get started?

If you're using RVM, there's an .rvmrc file in the root of the project that automatically sets the Ruby version to 1.9.2 and the gemset to sinatra-bootstrap. You'll need to have 1.9.2 in place and a gemset called sinatra-bootstrap in place before moving on (only if you are using RVM though). See the RVM docs if you need help or send me message if you get stuck here.

First you'll need to fork the project and then clone your Sinatra Bootstrap to your local machine.

git clone

Then we need to run bundle install to install the required gems as specified by the Gemfile.

If you're in a fresh gemset or you don't have Bundler installed, run the following at the command prompt:

gem install bundler

You should see output like this:

sinatra-bootstrap :: (master) » gem install bundler
Successfully installed bundler-1.0.14
1 gem installed
sinatra-bootstrap :: (master) » bundle install
Fetching source index for
Installing chunky_png (1.2.0) 
Installing fssm (0.2.7) 
Installing sass (3.1.2) 
Installing compass (0.11.1) 
Installing grid-coordinates (1.1.4) 
Installing haml (3.1.1) 
Installing rack (1.3.0) 
Installing shotgun (0.9) 
Installing tilt (1.3.2) 
Installing sinatra (1.2.6) 
Using bundler (1.0.14) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

How do I start the application?

After you've ran bundle install and Sinatra as well as the other required gems are installed, start it up by running this command:

# runs `bundle exec shotgun` behind the scenes
rake start

This will start Sinatra Bootstrap on Sinatra's default port 9393 and will now be able to view the application in your web browser at this URL http://localhost:9393.

You'll also want to open a new terminal window to the same directory and run the Compass watch rake task so we can monitor our Sass files for changes.

rake styles:watch

Or you just run compass watch, either work.

Helper Rake Tasks

There are a few helper Rake tasks that will help you to clear and compile your Sass stylesheets as well as a few other helpful tasks. There is also a generate task, so you can generate a new project at a defined location based on the bootstrap.

rake -T

rake generate                   # Generate a new project at dir=foo
rake start                      # Start the application
rake styles:clear               # Clear the styles
rake styles:compile             # Compile new styles
rake styles:compile:production  # Compile new styles for production
rake styles:list                # List the styles
rake styles:stats               # Run compass stats
rake styles:stats:log           # Create a log of compass stats
rake styles:watch               # Watch the styles and compile new changes