为Ruby开发人员准备的12个小型Web框架

jopen 10年前

Sinatra

 

Sinatra is a DSL for quickly creating web applications in Ruby with minimal effort. Now, I know that Sinatra is library, and not an actual framework, but there are those who will argue or consider it as a framework, and because of the immense popularity – I’ve included Sinatra in the list.

 

Sinatra allows you to structure your application to fit the problem you’re trying to solve instead of the other way around. It will only perform a set of functions that its meant to perform, each class does what it has to do, and gives the control back to you. Damn, that rhymed good.

You’ll eventually learn that many of the frameworks I’m about to mention have been ‘inspired’ and ‘built on top’ of Sinatra.

Ramaze

 

Ramaze is a very simple and straight-forward web-framework. The philosophy of it could be expressed in a mix of KISS and POLS, trying to make simple things simple and complex things possible. It’s built to follow the MVC pattern, though it’s possible to ‘deploy’ everything from within a single script.

It’s also one of those web frameworks that has managed to stick around for a long time, and in turn has built a good sized community behind it, always there to help and support. It supports all major templating systems, and its heavily focused on modular design.

Padrino

 

Padrino is a full-stack ruby framework built upon the Sinatra web library. Here we see the inception of Sinatra, and how it can be used to build actual web frameworks.

Padrino Features

The ultimate goal of Padrino is to extend the functionality of Sinatra, so that those developers who’re beginning to miss bigger frameworks can get back some of that essence, and build more complex applications at the same time.

NYNY

 

NYNY is unassuming, it has all the core stuff to get running, but nothing else. Your app is the framework. However, it’s trivial to extend NYNY via its extension interface. Each NYNY app is a Rack middleware, so it can be used inside of Sinatra, Rails, or any other Rack-based app.

It uses the same interface for extensions as Sinatra does, but it is not guaranteed that all of the Sinatra extensions are going to be working with New York, New York. (NYNY) But, any extensions built specifically for NYNY, will never have issues with working on Sinatra.

Nancy

 

This is also the perfect chance to see how humbling the Ruby community is, “Sinatra’s little daughter”. Nancy is incredibly fast, being based Cuba and Sinatra. It has got the same route functionality that Sinatra has. You can ‘use’ to include Middleware. Enables mounting rack applications with ‘map’.

Grape

 

It’s a REST-like API micro-framework built to complement existing web application frameworks by providing a simple DSL to easily provide APIs. It was built to replace the API functionality of bigger frameworks like Rails, and Sinatra – because they just end up getting caught up in between their own infrastructure.

Also known as Generalized Rapid API Erector. It was built to ease the development of API’s, and it simply works. Its Grape.