為Ruby開發人員準備的12個小型Web框架

jopen 10年前發布 | 22K 次閱讀 Ruby

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 ?t 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.

Cuba

 

Cuba is a microframework for web development originally inspired by Rum, a tiny but powerful mapper for Rack applications. It’s quite elegant, and has support for clean code that can be used to run tests. The philosophy of Cuba is to build web applications with as small amount of files as possible, while keeping everything global.

Its a great little framework for building real-time applications, landing pages and even eCommerce apps. You can watch a little slideshow here.

Camping

 

Camping is a MVC web framework which is only 4kb in size, and its built so it stays around the same range. Its so small, it begs to question what it can do, right? The idea here is to store a complete fledgling web application in a single file like many small CGIs. But to organize it as a Model-View-Controller application like Rails does. You can then easily move it to Rails once you’ve got it going.

It hasn’t been updated in the last few months, mostly because it went from being developed and maintainted by one person, everyone can commit an update or a patch, and the author will consider it for approval. I recommend reading this article on Camping (and also Cuba), and how it works.

Honorable Mentions

I’ve not been able to find a lot of information and/or resources for the below frameworks, but they appeared in my research frequently enough to be mentioned here. I’d love to have you comment on these, so that I can update them with a picture and your original comment.

Crepe – The thin API stack.
Hobbit – A minimalistic microframework built on top of Rack.
Kenji – A lightweight Ruby web framework.
Brooklyn – Small web tool on top of Rack.

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!