A skeleton of a default classic Sinatra application
Prominent items in use:
- Bootstrap framework in the sample content
- Sinatra Contrib
- Active Support and Active Record (Postgres)
- RSpec, Capybara, Factory Bot, Faker
- Rubocop
Check out the rake tasks: bundle exec rake -T
vi .env.development.local
export APP_ENV=development
export APPLICATION_NAME=default_sinatra
export DATABASE_HOST=localhostsource .env.development.localThere is an option to run postgres in Docker, or use another database server.
docker-compose up -d dbbundle exec rake db:create
bundle exec rake db:migrateRun it locally or build and run it as a docker container.
bundle exec rackupdocker-compose build
docker-compose up -d appDefinitions and recommendations oh how to develop using this Sinatra skeleton.
Settings located in config/database.yml
bundle exec rake db:new_migration name=<name of migration>Add models to app/models and organize how you prefer.
Add routes to app/routes and organize how you prefer.
Add html/erb files to app/views and organize how you prefer.
Recommendation: organize models, routing and views in a similar manner.
A few helpers to advance the application.
Adds extra stylesheets to that page, if defined
- In layout head section:
<%= stylesheet_controller %> - In route:
stylesheet :'views/main.css' - In public path:
/stylesheets/views/main.css
Adds extra javascript to that page, if defined
- In layout just before body close:
<%= javascript_controller %> - In route:
javascript :'views/main.css' - In public path:
/javascripts/views/main.css
Copyright 2012-2019, Nick Willever
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.