New to the Sinatra DSL // Ruby Web Framework?
Check out the website HERE and GitHub Repo.
At a high level, this template comes with the following features:
- A modular Sinatra app using Ruby 2.1.0 built in to get you started fast.
- Local development using SQLite3 and production using PostgreSQL on Heroku.
- Support for ActiveRecord model inheritance and database migrations.
- Authentication Support for API, OAuth Keys, or any sensitive information.
- Debugging tools like Better Errors, Pry Debugger, and Sinatra Reloader.
- RSpec Integration for testing your application, models, and concerns.
I've written in comments to explain all parts of the code base for you.
This template does not come with any UI in place. That's for you to decide!
This project is made with <3 and uses a collection of tips and tricks.
Let me know if you have any suggestions via comments / pull request!
Here are a few sections on how you can get started with this template.
In order to use this template:
- Clone the repository via:
git clone git@github.com:CarlosPlusPlus/swoonatra.git
. cd
into the repository and remove the .git folder:rm -rf .git
folder.- Perform a
git init
folder, or set as a remote to a respository already on GitHub. - Ensure you have PostgreSQL installed on your machine.
- If not installed and on a MAC, use Homebrew via Terminal:
brew install postgresql
- If not installed and on a MAC, use Homebrew via Terminal:
- Run a
bundle install
to install all gem dependencies. - Run
rackup
to start your local server. - Visit
localhost:9292
in your favorite browswer.
All set and good to go!
The SQLite3 development database will be generated when you first run rackup
, and the SQLite3 database will be created when you first run rspec
.
In order to customize your local databases:
In the config
folder: cp database.example.yml database.yml
In order to use API Keys, OAuth Keys, or sensitive information:
- Rename
config/authentication.example.rb
toconfig/authentication.rb
- Add your API and authentication tokens etc. to
config/authentication.rb
This will allow you to access them everywhere via the ENV hash.
Here are the gems included with this template:
Framework
- sinatra
- sinatra-contrib
- activerecord
- sinatra-activerecord
- sinatra-flash
- sinatra-redirect-with-flash
- sqlite3
- rake
Debug
Test
Development
Production