Skip to content

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

License

Notifications You must be signed in to change notification settings

johnmendonca/sinatra-template

 
 

Repository files navigation

Sinatra Application Template

A base Sinatra application template, just fork and build. It uses DataMapper and Haml by default, and includes RSpec, Cucumber, and Webrat for testing.

Getting Started

rake db:migrate
ruby application.rb

Configuration

Application requirements and configuration are found in application.rb.

Add your Sinatra routes to application.rb.

Database

This project uses DataMapper and sqlite3 by default. This is configured in application.rb:

configure :development do
  DataMapper.setup(:default, 'sqlite3:///' + File.expand_path(File.dirname(__FILE__)) + '/development.db')
end

There is also a small sample model in lib/models/profile.rb, as well as rake tasks to migrate and upgrade the database.

Views

View templates are found by default in /views, and static files in /public. You can overwrite these by adding the following to application.rb:

set :views, File.dirname(__FILE__) + '/foo'
set :public, File.dirname(__FILE__) + '/bar'

Testing

The general test environment is setup in spec/spec_helper.rb.

Add your specs to spec, and require spec_helper.rb. A couple example specs are provided. To run them:

rake spec

Cucumber specific setup is done in features/support/env.rb (which includes spec_helper). To execute all cucumber features:

rake cucumber

Read more here: wiki.github.com/aslakhellesoy/cucumber/sinatra

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%