Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A small Ruby web framework, built on Rack, which borrows from Sinatra's expressiveness and performance, and targets larger applications.
Ruby
branch: master

README.rdoc

Gin

Description

Gin is a small Ruby web framework, built on Rack, which borrows from Sinatra expressiveness, and targets larger applications.

Getting Started

Gin provides a simple command for setting up a new application.

$ gin path/to/appname

Hello World

A Hello World application requires at minimum a Gin::App instance and a Gin::Controller.

# config.ru
require 'gin'

class HelloWorldCtrl < Gin::Controller
  def index; "Hello World!"; end
end

class MyApp < Gin::App
  mount HelloWorldCtrl, "/"
end

run MyApp.new

Why Gin?

Gin tries to fill a need for a framework that's simple and lightweight, yet scalable for large applications. Gin is comparable to Sinatra in performance and memory consumption, but supports multiple controllers and filters.

Features

  • Easily mount multiple apps as Rack middleware

  • Simple and fast RESTful routing

  • Controller classes and action arguments

  • Inheritable Before/After filter chains

  • Response streaming

  • Asset urls with cache-busting and CDN support

  • Configs for multiple environments

  • Periodic config reloading

  • Inheritable error handling

  • In-app middleware

  • Rack-Session and Rack-Protection

  • Dev-mode auto-reloading

  • Templates (layouts/views) with Tilt

What's Not Included

  • Helpers - those are called Modules in Ruby

  • ORM - choose your own library

Requirements

  • rack

  • rack-protection

  • tilt

Install

  • gem install gin

License

(The MIT License)

Copyright © 2013 Jeremie Castagna

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Something went wrong with that request. Please try again.