A base Sinatra application template, just fork and build. It uses DataMapper and Haml by default, and includes RSpec, Cucumber, and Webrat for testing.
rake db:migrate ruby application.rb
Application requirements and configuration are found in application.rb
.
Add your Sinatra routes to application.rb
.
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.
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'
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