Capistrano or Omniauth. Here’s seven nice gems that you may not known "/>

Seven Handy Yet Lesser Known Ruby Gems

If you’re into Rails or Ruby development, chances are that you’ll already play with popular gems like Capistrano or Omniauth. Here’s seven nice gems that you may not known

Capistrano Calendar

You probably already use Capistrano for your application deployments. This gem is a addon which posts events to a Google calendar on deployments and rollbacks. My company use a calendar for each project and thanks to our Continuous Integration system, Jenkins (you should use one too too), we also have the information whenever a build is successful or failing, giving us a quick overview of past deployments & build.

[Capistrano calendar @ github]


Sprite factory

Combined images, also known as CSS sprites are a great way to minimize HTTP requests, and thus speed up web sites. This technique is effective but its maintenance can quickly turn into a nightmare if you do not have the proper tool to automatize it. The sprite-factory gem help you manage your sprites by automaticly combining them and producing the according CSS. If you’re using Rails, add the gem to your Gemfile, create the following file to your lib/tasks directory as assets_resprite, put your sprites in app/assets/images/sprites/ and then call rake assets:resprite to obtain your assembled image and resulting CSS. You could also use Guard to automaticly update the output image whenever you add or update the sprites.

# http://codeincomplete.com/posts/2011/8/6/sprite_factory_1_4_1/
require 'sprite_factory'

namespace :assets do
  desc 'Recreate sprite images and css'
  task :resprite => :environment do
    SpriteFactory.report   = true
    SpriteFactory.selector = '.sprite_'
    SpriteFactory.layout   = :horizontal
    SpriteFactory.library  = :chunkypng                   # use chunkypng as underlying image library
    SpriteFactory.csspath  = "$IMAGE" # embed ERB into css file to be evaluated by asset pipeline
    SpriteFactory.run!('app/assets/images/sprites', :output_style => 'app/assets/stylesheets/sprites.css.erb')
  end

end

[Sprite-factory @ github]


Dropbox-api & Dropbox

Dropbox is a file hosting service, which uses the cloud to store them. While I’m not a big fan of cloud based applications (I am not the only one), Dropbox has clients available on several and allows a great proximity with customers: e.g. reports export in their private dropbox directory or automatic file processing whenever they add them in a specific Dropbox directory. The company behind Dropbox also released a gem - called Dropbox -, which syntax differ slightly from Dropbox-api.

[Dropbox-api @ github] - [Dropbox @ github]


Mailcatcher

Mailcatcher is daemon acting as a SMTP server which catches any mails sent to it, and display them in a web interface like a webmail. It can also display the HTML or text alternative.

[Mailcatcher @ github]


Twitter

If you have to develop something on the Internet that is not static HTML, chances are that you’ll want to tell about it : new products, new posts or the latest tagged version of your opensource software. With only a few lines to configure it and one more to post a status, the Twitter gem is very easy to use and has access to all the API : direct messages, mentions, saved search, etc.

# initialization
Twitter.configure do |config|
  config.consumer_key = YOUR_CONSUMER_KEY
  config.consumer_secret = YOUR_CONSUMER_SECRET
  config.oauth_token = YOUR_OAUTH_TOKEN
  config.oauth_token_secret = YOUR_OAUTH_TOKEN_SECRET
end

Twitter.update "Hi there !"

[Twitter @ github]


Wkhtmltopdf

Wkhtmltopdf transforms a HTML page - and all its assets - in a PDF using the webkit renderer. Result are really impressive : see the rendered pdf for www.cnn.com. It is a nice alternative to others systems, notably those - like prawn - that give an API to manually create PDF (see this exemple).

[Wkhtmltopdf @ github]


GoogleVisualr

The Google Chart Tool service provides javascript that generates client-side charts. The GoogleVisualr gem allows you to obtain that javascript (with a Rails helper) from simple ruby code. If you prefer to use images rather than a javascript based solution, you may take a look at Googlecharts gem by Matt Aimonetti.

[google_visualr @ github] - Exemples


Nice icon (colored in red) from artdesigner.lv

See also