/sinatra-template

A base Sinatra application template with DataMapper, and RSpec. Just fork and build.

Primary LanguageRubyMIT LicenseMIT

Sinatra Application Template

A base Sinatra application template. Just fork and build. Yay! Includes Bundler, DataMapper, and RSpec, all ready to go.

Configuration

Dependencies and all configuration is done in environment.rb. Your database is also set up here. DataMapper will use sqlite3 by default. Tests use the sqlite3-memory adapter (no configuration needed).

Add your controller actions in application.rb. Views for these actions are placed in the views directory. Static files, including a stock stylesheet, go in the public directory. Models go in the lib directory and are auto-loaded.

Environment variables that you want to expose to your application can be added in .env

Testing

Add your specs in spec; just require spec_helper.rb to pre-configure the test environment. A number of samples are provided (including a sample model, which can be removed). To run the specs:

bundle exec rake spec

Getting Started

bundle install
bundle exec foreman start

Extras

We've included a handy console script that fires up irb with your environment loaded. To load it, use the Rake task:

bundle exec rake console

Thanks

This project includes contributions from several awesome developers.

(c) 2015 Nick Plante. This code is distributed under the MIT license.