Giter Club home page Giter Club logo

sinatra-boilerplate-v2's Introduction

Sinatra Boilerplate v2

What Is It?

Sinatra Boilerplate is a starting point for new projects using the Ruby micro web framework Sinatra. I grew tired of constantly checking my last Sinatra project to grab lines from various files when starting fresh so I made something easy to clone from GitHub and just get going.

Why Sinatra over Rails?

Ruby on Rails is still a great framework for web development and I would highly recommend learning it at some point or even moving completely over to it for larger projects. However, when I first started with web development in Ruby, I found Sinatra to be a lot more clear which I found critical in understanding how everything fits together. Sinatra is far less opinionated than Rails which leads to a lot of people using it very differently. This project aims to give just as much structure as is required to keep you fairly organized. It assumes you have some working knowledge of Sinatra and Ruby.

Version 2 You Say?

The old version of this boilerplate is four years old now. A lot changes in that amount of time. Whilst I went off and was working full-time with Ruby, neglecting this project almost entirely, it's become my most starred repository so I wanted give a bit more back to say thanks for all the support before I move on entirely.

So What Has Changed?

Firstly, here's what got removed from the first version:

  • Datamapper (replaced with ActiveRecord)
  • Twitter Bootstrap (feel free to choose your own, Foundation etc.)
  • JQueryMobile has been removed
  • Removed sass Rake task (project uses Compass now)
  • Removed bootstrap related tasks from Rakefile
  • Mobile request helpers removed

Now what has been added?

  • Compass - for working with SCSS (and minifying assets at a later stage)
  • ActiveRecord - makes transitioning to Rails later easier for everyone (plus I like migrations)
  • Underscore.js - some utility functions to make Javascript more sane
  • Shotgun & Tux - for development, automatic reloading and a REPL for your app
  • Mocha - mocking to improve your tests
  • Foreman - Procfiles for deployment and local development
  • Sinatra-Contrib - useful extensions for Sinatra apps
  • A config file - for local development

So how do I get started?

  • Clone the project onto your local machine
  • Make setup.sh executable: chmod +x setup.sh
  • Run setup.sh
  • Create a Heroku instance
  • Deploy!

The Project Structure Explained

  • app/
    • helpers/ - small utility functions
    • lib/ - domain specific objects that are not models
    • models/ - ActiveRecord::Base subclasses
    • routes/ - effectively the controllers
  • app.rb - starting point of the app
  • config/ - contains config.yml
  • config.rb - used to configure Compass
  • config.ru - used by Foreman
  • db/
  • public/ - frontend assets
    • css/
    • font/
    • img/
    • js/
  • sass/ - all SCSS files go here
  • tests/ - matches each of the directories in app/
    • helpers/
    • lib/
    • models/
    • routes/
    • test_helper.rb - include in all your unit tests

© Robert Ziehl 2016

sinatra-boilerplate-v2's People

Contributors

robzedgames avatar

Watchers

 avatar  avatar

Forkers

miclast

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.