One of the nicer things about developing on the Ruby platform is the sheer amount of meticulously categorized, highly reusable code wrapped up in the form of aptly named â€˜gemsâ€™.
Iâ€™m sure youâ€™ve heard of popular frameworks like Sinatra or the super popular Rails that ship as gems but youâ€™re missing an entire spectrum of others that handle issues at a much lower level. Start using these and watch your productivity shoot through the roof!
A Quick Note
Iâ€™m well aware that some of the gems listed here have Rails, or parts of Rails, as a dependency. That doesnâ€™t mean that they are any less useful or need to be sneered at.
Upload files in your Ruby applications, map them to a range of ORMs, store them on different backends. It works well with Rack based web applications, such as Ruby on Rails.
Kaminari is a Scope Engine based, clean, powerful, customizable and sophisticated paginator. Kaminari supports multiple ORMs (ActiveRecord, Mongoid, MongoMapper) multiple web frameworks (Rails, Sinatra), and multiple template engines (ERB, Haml).
Haml (HTML Abstraction Markup Language) is a layer on top of XHTML or XML thatâ€™s designed to express the structure of XHTML or XML documents in a non-repetitive, elegant, easy way, using indentation rather than closing tags and allowing Ruby to be embedded with ease. It was originally envisioned as a plugin for Ruby on Rails, but it can function as a stand-alone templating engine.
A simple, unobtrusive model based Ruby authentication solution. Authlogic is very flexible, it has a strong public API and a plethora of hooks to allow you to modify behavior and extend it.
Shoulda is a gem that allows you to create more understandable tests for your Ruby application. Shoulda allows you to provide context to your tests enabling you to categorize tests according to a specific feature or scenario youâ€™re testing.
factory_girl provides a framework and DSL for defining and using factories â€“ less error-prone, more explicit, and all-around easier to work with than fixtures. It has straightforward definition syntax, support for multiple build strategies (saved instances, unsaved instances, attribute hashes, and stubbed objects), and support for multiple factories for the same class (user, admin_user, and so on), including factory inheritance.
RMagick is an interface between the Ruby programming language and the ImageMagick and GraphicsMagick image processing libraries.
CanCan is an authorization library for Ruby on Rails which restricts what resources a given user is allowed to access and is decoupled from user roles. All permissions are stored in a single location and not duplicated across controllers, views, and database queries.
Nokogiri is an HTML, XML, SAX, and Reader parser. Among Nokogiriâ€™s many features is the ability to search documents via XPath or CSS3 selectors. Nokogiri parses and searches XML/HTML very quickly, and also has correctly implemented CSS3 selector support as well as XPath support.
Sass makes CSS fun again. Sass is an extension of CSS3, adding nested rules, variables, mixins, selector inheritance, and more. Itâ€™s translated to well-formatted, standard CSS using the command line tool or a web-framework plugin.
Formtastic is a Rails FormBuilder DSL (with some other goodies) to make it far easier to create beautiful, semantically rich, syntactically awesome, readily stylable and wonderfully accessible HTML forms in your Rails applications.
Capistrano is a utility and framework for executing commands in parallel on multiple remote machines, via SSH. It uses a simple DSL (borrowed in part from Rake) that allows you to define tasks, which may be applied to machines in certain roles. It also supports tunneling connections via some gateway machine to allow operations to be performed behind VPNâ€™s and firewalls.
OmniAuth is a Ruby authentication framework that provides a standardized interface to many different authentication providers such as Facebook, OpenID, and even traditional username and password.
Bundler is a tool that manages gem dependencies for your ruby application. It takes a gem manifest file and is able to fetch, download, and install the gems and all child dependencies specified in this manifest. It can manage any update to the gem manifest file and update the bundleâ€™s gems accordingly. It also lets you run any ruby code in context of the bundleâ€™s gem environment.
Resque (pronounced like â€œrescueâ€) is a Redis-backed library for creating background jobs, placing those jobs on multiple queues, and processing them later. Resque is heavily inspired by DelayedJob.
Capybara helps you test Rails and Rack applications by simulating how a real user would interact with your app. It is agnostic about the driver running your tests and comes with Rack::Test and Selenium support built in.
Active Merchant is an extraction from the e-commerce system Shopify. Shopifyâ€™s requirements for a simple and unified API to access dozens of different payment gateways with very different internal APIs was the chief principle in designing the library. It was developed for usage in Ruby on Rails web applications and integrates seamlessly as a plugin but it also works excellently as a stand alone library.
EventMachine implements a fast, single-threaded engine for arbitrary networkcommunications. Itâ€™s extremely easy to use in Ruby. EventMachine wraps all interactions with IP sockets, allowing programs to concentrate on the implementation of network protocols. It can be used to create both network servers and clients.
Inspired by ctemplate, Mustache is a framework-agnostic way to renderlogic-free views.As ctemplates says, â€œIt emphasizes separating logic from presentation:it is impossible to embed application logic in this templatelanguage.
Phusion Passengerâ„¢ â€” a.k.a. mod_rails or mod_rack â€” makes deployment of Ruby web applications, such as those built on the revolutionary Ruby on Rails web framework, a breeze.
Chef is a system integration framework designed to bring the benefits of configuration management to your entire infrastructure. With Chef, you can manage your servers by writing code, not by running commands.
A concise and easy-to-use Ruby library that connects ActiveRecord to the Sphinx search daemon, managing configuration, indexing and searching.
So those were some of the awesome gems Iâ€™ve found extremely useful when Iâ€™m whipping up a web app in Ruby. Iâ€™m a 100% sure Iâ€™m missing a metric butt load of others though. Let me know about your favorite gems in the comments below and thank you so much for reading!
Article source: http://feedproxy.google.com/~r/nettuts/~3/TQXIcZXrplk/