FROMDEV

80+ Most Useful Ruby Libraries

Ruby is one of the most popular programming languages in the digital world. One of the reasons for the popularity of Ruby is its characteristic nature of reusability through codes wrapped in the form of gems.

It is easy to add functionalities in Ruby through packaged libraries and this is one of the nicest things about Ruby development.

Recently there has been a release of Rail 5 and there are many useful and popular Ruby Rails available for your usage. This article will briefly and specifically talk about few useful and popular gems that can save you a lot of time re-inventing.

As a beginner at ruby programming, you may also find these ruby books handy for learning.

Ruby Libraries For Authentication

Authlogic

This is a clean, unobtrusive and simple Ruby authentication solution that supports both Rails 3 and 4. A new type of model was introduced through Authlogic. The solution program has the option to logout or destroys the session.

CanCan

All permissions in this Ruby Rails is defined in a single location called the Ability class. This is not duplicated across views database queries and controllers. You can install it as a plugin.

OmniAuth

It is a standardized multi-provider authentication tool for web applications that is flexible and powerful and allows the developer to create strategies, which are released individually as RubyGems.

Devise

It is a flexible authentication solution for Rails that is based on Warden. This solution is Rack based and is a complete MVC solution based in Rail engines. Through this, the user can log in to multiple models.

File Processing and Upload Utility Libraries in Ruby

CarrierWave

It offers extremely flexible and a simple way for uploading files from Ruby applications. Rack based web applications like Ruby on Rails is the best on which it works.

Paperclip

The main aim to create this is to make it an easy file attachment library for Active Record. It now works on Ruby version that is equal or higher than 1.9.2 and Rails version higher than or equal to 3.0. This is required only when the user is using Ruby on Rails.

FasterCSV

It was built with the intension that it serves as the replacement of the standard CSV library of Ruby. It is significantly fast compared to CSV at the same, it is a Pure Ruby library.

Spreadsheet

As the name suggests, this library is designed to read and write Spreadsheet Document. It is compatible with only Microsoft Excel spreadsheet as of version 0.6.0.

User Interface Libraries in Ruby

Kaminari

This is a scope and engine based Ruby solution. This is a sophisticated paginator for modern web application frameworks or ORMs. This application offers users the choice of customization too.

Haml

This is an HTML abstraction markup language that is based on a primary principle, which says that markup is necessary to be beautiful. It has the ability to simplify yet accelerate the creation of template down to veritable haiku.

Sass

This is an extension of CSS3 and it makes CSS fun. This has the ability to add nested rules, mixins, selector inheritance, variables and many others. It has two syntaxes – main syntax SCSS and superset of CSS3’s syntax.

Mustache

The views in Mustache are broken into two parts – Ruby class and HTML template. It is inspired by et and ctemplate. It is a framework-agnostic way of rendering logic-free views.

Compass

It is an open-source CSS Authoring framework and it uses Sass, which is an extension of CSS3. It has the best reusable patterns on the web. Compass mixins ease out the use of CSS3 and create good typographic rhythm.

Hirb

It offers mini view framework for console applications and uses the same in order to improve the ripl’s or rib’s default inspect output. It offers reusable views of two helper classes – Table and Tree.

Unit Testing and Automation Libraries in Ruby

Shoulda

This gem is a meta gem that has two dependencies – shoulda context and shoulda matchers. This can be used in different tests and uses case combinations.

Factory Girl

This is a fixture replacement that has a straightforward definition syntax. It can support multiple build strategies like saved and unsaved instances, stubbed objects and attribute hashes. It also supports multiple factories of same classes.

Capybara

This helps you testing the web applications through simulation of real users interacting with your app. It comes with Rack and has built in Selenium and Test support. The external gem supports the WebKit.

Capistrano

Capistrano works with the Ruby Rails that are higher or equal to the version 1.9. This rail supports JRuby and C-Ruby or YARV. It can create different stages in the capfile.

Delayed Job

It is a direct extraction from Shopify in which the job table performs a wide array of core tasks, which includes sending of massive newsletters, image resizing, http downloads and many others.

Resque

This is a Redis-backed library used for creating background jobs. It places those jobs on multiple queues and processes them later. The latest version is 2.0, which has a master branch.

Nano Test

It has the framework that has a very minimal testing and is perfect plugin for those who love DIY.

Picture / Image Processing Libraries in Ruby

Rmagick

The new release version of this Ruby Rail is 2.13.2. This is Ruby Gem has the ability to add bundles of Gemfile and you can install the application directly.

Smusher

There is no need of image libraries and everything can be done through the interwebs. The file is less in size, offers 97% saving, faster downloads and less bandwidth makes the users happy to use it.

XML Parsing and Processing Libraries in Ruby

Nokogiri

It is an XML Reader, SAX and HTML parser. Its ability to search documents through CSS3 and XPath selectors is one of its key features. It can also build XML/HTML.

Gyoku

The main function of this Ruby gem is to translate the Hashes into XML. It is available through Rubygems and can be directly installed or by adding it to the gem file.

Feedjira.com

It is a Ruby library that is designed to fetch and parse the feeds very quickly. The recent release version is 1.0 and it is a Ruby gem application.

JSON Parsing and Processing Libraries in Ruby

JSON

It is regarded as the low fat alternate to XML and a pure Ruby variant. This is useful if you want to store data in a disk or transmit the same over a network, rather than to use as a verbose markup language.

JSON – Stream

It is a JSON parser that is based on a finite state machine. It is more like an XML SAX parser and can generate events during parsing. Document or object graphs are not required for it to be fully buffered in memory.

YAJL C Bindings

It is a C binding to YAJL JSON parsing and generation library. It can directly conduct JSON parsing as well as encode to and from IO stream like socket or file and String. It offers API compatibility and is a basic HTTP client.

Domain Specific Language Libraries in Ruby

Formtastic

It is a Rails FormBuilder DSL that has some other goodies. This makes it easier to create beautiful and semantically rich HTML forms in your Rails application that are accessible and syntactically awesome.

Jbuilder

It offers you a simple DSL enabling you to declare JSON structures that can beat massaging giant hash structures. It proved to be helpful during the generation process that is overloaded with loops and conditionals.

Thor

It is like a tool kit that is used for building powerful command line interface. Apart from Rails, it can also be used in Vagrant, Bundler and many others.

Build and Dependency Management Libraries in Ruby

Bundler

This unique software ensures that same code runs in every machine by Ruby applications. It aesthetically manages all gems upon which the application depends on. If you give the names of the gems, it can automatically download them.

RAKE

It is a program that resembles Make program built for Ruby. The dependencies and tasks in this program are specified in standard Ruby syntax and there are no XML files to edit.

Compression Libraries in Ruby

Jammit

This is an asset packaging library for Rails that has industrial strength. It has the capacity to provide compression and concatenation of both CSS and JavaScript. The available current version is 0.6.5.

Payment Processing Libraries in Ruby

Active Merchant

This is a Ruby Rail that deals with payment processors and credit cards. This application is an extraction from Shopify, which is an e-commerce software solution. It can be used as a Ruby on Rails web application.

Concurrency Libraries in Ruby

EventMachine

It is a lightweight concurrency library for Ruby, which is an event-driven I/O. It uses Reactor patterns like Apache MINA, JBoss Netty, Node.js, Python’s Twisted and many others.

Application Servers n Ruby

Phusion Passenger

It is a lightweight, robust and a fast web application server for Ruby and also supports Python and Node.js. Its C++ core along with watchdog system and zero-capacity architecture makes it fast. It has hybrid-evented multi-process and multi-threaded design.

Configuration Management Libraries in Ruby

Chef

It is a configuration management tool that is designed in such a way that it can automate your entire infrastructure. By learning and using Chef, you can administer IT infrastructure from your workstation like your desktop or laptop.

RConfig

It is a complete solution as far as Ruby configuration management is concerned and manages the configurations that are available in Ruby applications, bridging gaps between kay/value based property files and XML/YAML.

MVC Framework Related Libraries

Thinking Sphinx

It is a library that connects ActiveRecords to the Sphinx full-text search tools. Though it can closely integrate with Rails, it can also function with other Ruby web frameworks. The currently available version is 3.1.1.

Will Paginate

This is basically a collection of extensions suitable for the database layers that enable paginated queries and view helpers for frameworks that offer pagination links. It helps in combining view helpers and CSS styling.

Squeel

This is the best tool that users can use to write Active Records queries using fewer strings with more Ruby. It makes the Arel awesomeness accessible that lie beneath Active Records.

HasScope

This tool enables users to create controller filters with ease based on the resources that are named ‘scopes’. Users can use the named scopes as filters by declaring them on the controllers.

Security Related Libraries in Ruby

Rack::SslEnforcer

This is a simple Rack middleware that can enforce SSL connections. The cookies are by default marked as secure entities by the 0.2.0 version of Rack::SslEnforcer. It works with various versions of Ruby, Ruby-head, and REE.

Ngrok

It has the capacity to create tunnels from the public internet that it can port to a local machine. Through this tunnel, it captures all internet or HTTP traffic information.

Developer Help, Debugging and Tuning Libraries

Bullet

Bullet gem is designed in such a way that it increases the performance of applications. It does that by reducing the number of queries that it makes. It can support ActiveRecord as well as Mongoid.

Debugger

It is a fork of Ruby debug that works only on 1.9.2 and 1.9.3. It can be easily installed for rvm or rbenv Rubies. It can support Rubies that are 1.9.x and doesn’t support Rubies that are higher or equal to 2.0.

Rack Mini Profiler

This is a type of middleware that has the feature of displaying speed badge for every HTML page and helps in database profiling. It is designed in such a way that it can work in both production and development.

Quiet Assets

It supports Ruby on Rail versions that are higher or equal to version 3.1. It turns off the pipeline log of the Rails asset and suppresses the messages in the development log.

Request Log Analyzer

This is a simple command line tool that can analyze the request log files in different formats like Apache or Amazon S3 and prepare a performance report. The aim of this is to find the best actions for optimization.

Rails Footnotes

It enables easy debugging for your application by displaying footnotes like request parameters, filter chain, queries, routes, cookies, sessions and much more. It can directly open files in the editor.

MethodProfiler

It is one of the best tools that captures performance information of the methods in the process and creates a report that allows identifying slow methods.

RDoc

This is the program for Ruby projects that produces command line documentation and HTML. It includes ri and rdoc tools and displays documentation from the command line.

Static Code Analysis Libraries in Ruby

Flay

This tool analyzes the code for structural similarities and can report differences at any level of the code. It has the capacity to offer both conservative and liberal pruning options.

Rails Best Practices

It is a code metric tool that can check the quality of the rail codes. It supports ORM/ODMs like Mongomapper, Mongoid, and ActiveRecord. It also supports template engines like ERB, HAML, SLIM and RABL.

Reek

It is code smell detection for Ruby. It can examine Ruby modules, methods and classes. Reek also helps in reporting any kind of code smells that it can find.

SimpleCov

It is a code coverage analysis tool for Ruby applications. Built-in coverage library of Ruby is used to capture the code coverage data.

Database Utility Libraries in Ruby

Lol DBA

It is a small package of different rake tasks, which can scan the application models and display it in the form of column lists that can be indexed. It also has the ability to generate .sql migration script.

Other Useful Libraries in Ruby

Better Errors

If a user wants to replace a standard error page with a much better and useful error page, Better Errors is the solution for that. It can also be used outside Rails as a Rack middleware in any Rack app.

Annotate

It helps the user to add comments by summarizing the present schema to the top or bottom of the ActiveRecords model, fixture files, Tests and Specs, Object Daddy exemplars and others.

MailCatcher

From the name itself, it can be understood that it catches mails and serves them. It runs on a very simple SMTP server that catches any message and sends it to be displayed on a web interface.

Pry

If there is any powerful alternative to the standard IRB shell for Ruby, then it is Pry. It offers both source code and documentation browsing. Two of the main features of Pry are syntax highlighting and gist integration.

RailRoady

The Rail 3/4 model like Mongoid, ActiveRecord, and Datamapper can be generated by RailRoady. It can also generate Controller UML diagrams in the form of cross-platform .svg files and also in DOT language format.

Zeus

It can preload the Rails app, which enables the normal development tasks like a server, generate and console, the specs/test takes less than a second. In general, it is language-agnostic application checkpointer used for non-multithreaded applications.

Ransack

It is basically a rewrite of MetaSearch. Though it supports most of the features as MetaSearch the underlying implementation is different. It enables creating both simple and advanced search forms against the application models.

FriendlyId

It is basically regarded as the “Swiss Army bulldozer” as it can slug and permalink plugins for Active Record. It allows users to create pretty URLs and work with different numeric IDs in the form of human-friendly strings.

Settingslogic

It is basically a simple configuration or setting solution that uses YAML file that is ERB enabled. It can work with Sinatra, Rails or any kind of Ruby projects.

Graph and Chart in Ruby

Chartkick

With the help of this, you can create beautiful Javascript charts using just one line of Ruby. It works with Sinatra, Rails and most of the browsers including IE6.

Gruff Graphs

It is a library that enables you to create beautiful graphs like a line graph, bar graph, area graph and much more. It enables you to create your feature branches in the program and push the changes to the branches.

Active Record

It consists M in the MVC or Model-View-Controller paradigm. It helps in facilitating the creation and use of various business objects the data for which it requires persistent storage to a database.

Log4r

It is a comprehensive flexible logging library that is written in Ruby in order to be used in Ruby programs. It has hierarchical logging system used for any number of levels and also has YAML and XML configuration.

Prawn

It is a pure Ruby PDF generation library. It offers vector drawing support that includes polygons, lines, ellipses, and curves. It also offers JPG and PNG image embedding with flexible scaling option.

Origami

It is a Ruby framework meant for editing PDF files. It supports advance PDF features like encryption, digital signature, forms, annotation, Flash and much more.

Breadcrumbs

It is a simple Ruby on Rails plugin that is required for creating and managing a breadcrumb navigation for Rails project. It requires Rails 3 or 4 to run.

Crummy

The simple way to add breadcrumbs to the Rails application is by using Crummy. The user just needs to add the dependency to the gem file.

Whenever

It is a Ruby gem that offers a clear syntax, which enables you to write and deploy cron jobs. It can directly installed in the gem file or with a bundler in it.

Spree

It is an open source e-commerce solution that is built using Ruby on Rails. It consists of many different gems maintained in a single repository and documented in a single set of online documentation.

Capistrano

It supports JRuby and C-Ruby/YARV. It can be installed through a particular command in the gem file of the application and it can post that bundle that needs to be executed.

Attr Encrypted

It generates attr_accessors that can transparently encrypt and decrypt attributes. Though it can be used with any class but using with Datamapper, ActiveRecord or Sequel give it some extra features.

Refinery

It is a Ruby on Rails CMS and supports Rails 3.2 and 4.1. The new version 2.1.4 has the ability to make many core functions optional like visual editor, authentication, and the dashboard.

Gosu

It is game development library for Ruby. It supports only 2D games and apart from Ruby, it also supports C++ language. It is available for Windows, Linux, and Mac OS X.

We have seen here quite a few Ruby libraries that have one or the other benefits for Ruby applications. However, it is our experience and knowledge base that help us choosing the best one among the lot. Moreover, it is always recommended to choose the one that has the highest utility for programs and applications you are using.

Exit mobile version