Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

Author Archives: Peter Cooper

By Peter Cooper / November 11, 2009

emailIcon.pngTo date, the main ways to send e-mails from Ruby have been Net::SMTP, TMail, and Rails’ ActionMailer (which uses TMail). Now, however, there’s a fourth option, the simply named “mail” by Mikel Lindsaar.

Mail is a new pure Ruby library designed to handle the generation, parsing, and sending of e-mail in a “Rubyesque” manner. Both the sending and receiving e-mails can be handled through the library and, where necessary, Mail proxies methods from libraries like Net::SMTP and Net::POP3. Ruby 1.9 support has been built in from day one so dealing with different text encodings in your e-mails is easier than ever (Mikel claims this is less than straightforward with TMail). Read More

By Peter Cooper / November 10, 2009

rubies2Welcome to the latest installment in the series of compilation posts summarizing some of my latest findings in the world of all things Ruby. Let’s tackle those links..

Alchemist: Easy Unit Conversion in Ruby

Alchemist is a new Ruby library that aims to take the pain out of performing translation with day to day units, such as miles, kilograms, kelvin, meters, and becquerels. There are a few ways you can perform conversions such as explicitly with a method: 8.meters.to.miles or inline: 10.kilometers + 1.mile. The library’s source code is quite something to look at – there are units I’ve never even heard of before. Read More

By Peter Cooper / November 3, 2009

thinkfunc.pngThinking Functionally in Ruby is a talk that British Ruby developer Tom Stuart gave at a recent London Ruby Users Group meeting. In it he covers what functional programming is, why it’s a “pretty neat idea,” and how to adopt functional programming principles in Ruby. Skills Matter took a video of the entire 47 minute presentation (it’s embedded on the right hand side of that page – Flash required.. just been told it might be limited to UK visitors only, if so get the original MP4 file) but there’s also a 110 page PDF (1.5MB download) you should have to hand too (with Tom’s slides). Read More

By Peter Cooper / October 28, 2009

heroku.pngHeroku is a Ruby webapp hosting service that we first mentioned about two years ago. It started off as an online IDE of sorts, but is now a complete cloud platform for running Ruby webapps. You can develop locally and then, with a single command, deploy your app to their metered service. Well, Heroku got in touch with me last week to talk about their new “Add-Ons” feature and they’ve really kicked things up a notch for people wanting to quickly roll out webapps online.

Till now, Heroku has provided basic functionality on a semi-metered basis. You pay a monthly fee for a basic rate of service and then pay an hourly rate for more concurrency. Read More

By Peter Cooper / October 26, 2009

rubygems.pngJust two months ago we posted about Gemcutter, a new RubyGem hosting repository that, we said, was “taking aim at RubyForge and GitHub.” It only took six weeks for GitHub to give up on building gems and to start recommending Gemcutter instead. Today, RubyForge is toppled also. Gemcutter developer Nick Quaranto has announced that Ruby Central has given the thumbs up to replacing http://gems.rubyforge.org/ with http://rubygems.org/ (the new Gemcutter URL) as the default gem host in RubyGems.

The transition from RubyForge to Gemcutter/RubyGems.org isn’t an overnight deal and gem publishing from RubyForge will continue to work for the time being, but within the next couple of months, RubyForge accounts will be merged with Gemcutter and an update will be made to change the canonical gem source (though, of course, you can use Gemcutter already if you like by following their instructions). Read More

By Peter Cooper / October 22, 2009

boson.pngBoson is a new command/task framework for Ruby by Gabriel Horner (of Hirb fame). Gabriel seems to be trying to supersede Rake, the Ruby “make” equivalent, and from first glance Boson seems to provide many benefits from the “reinvent the wheel” philosophy.

Anyone who’s built a Rakefile knows it’s not the most straightforward syntax, so Boson’s approach of using regular Ruby code in the shape of methods added to a module is refreshing. Tasks are methods, methods are tasks—simple. Within these methods, you can use the options helper method and passed arguments to access command line options and other data. Read More

By Peter Cooper / October 14, 2009

rack-logo.pngIf you’ve worked with Web apps using Ruby, you might know of Rack, an interface that sits between Ruby applications and HTTP-speaking Web servers. All of the major Ruby frameworks and server setups use it now, including Rails. Middleware (in Rack) is code that manipulates data going back and forth between your Ruby apps and the HTTP server. You can use middleware to intercept requests, change data in mid-flow, etc. Ryan Bates has a great screencast tutorial if you’re new to the concept and want to build your own.

P.S. I know the term “middlewares” sounds borderline insane, but.. it works, you know what it means – yada, yada ;-)

In this post, we’re going to highlight various Rack middlewares from CodeRack, an on-going Rack middleware competition:

Karma Chameleon – Focused at Rails developers, Karma Chameleon makes it easy to automatically have file extensions added to all of your app’s links and URLs. Read More

By Peter Cooper / October 12, 2009

socket.pngEgyptian Ruby developer Muhammed Ali (of MySQLPlus fame) has released the first draft of a “Ruby 1.9.x Web Servers” booklet. It looks at how different HTTP daemons and server libraries (Thin, Passenger, WEBrick and Mongrel) perform in Ruby 1.9.1. You can read the book for free on his site or on Scribd, but if you want to download a PDF to view locally you’ll need to have a free Scribd account, alas.

As of this first draft, the e-book’s 60 pages long – resulting in about 50 pages of actual content. It’s clearly a draft, but Mohammed has put together a pretty readable overview of the state of not only Web servers but basic TCP servers and concurrency issues on Ruby 1.9. Read More

By Peter Cooper / October 10, 2009

begruby-edition-2-cover.gif A few days ago I received the latest in a long line of royalty statements for my book, Beginning Ruby (as published by Apress). Long time readers might recall that Ruby Inside was started principally to promote the book, but turned into so much more that the book took a back seat. Well, the whim came over me to share the murky details of being the author of such a book, including how the royalty statements work (or not), how much is earned, sales figures, and so forth.

So I wrote What I’ve Earned (And Learned) From Writing “Beginning Ruby” over at the new, official Beginning Ruby promotional site. Read More

By Peter Cooper / October 5, 2009

ruby-inside-design-transition.gifThey’ve had several days to settle in, but because most of you will be reading via the RSS feed it’s time to make a point to announce that… Ruby Inside and Rails Inside have both been redesigned! If you usually just read the full-text RSS feed, do come and visit the site – if only to let us know what you think.

The new design marks the 3rd major redevelopment of Ruby Inside since 2006 and the stats from the last week are showing it to be a lot more effective with a 40% increase in pageviews per visitor. As well as an improved design, new features include:

  • An extended “elsewhere” section with automatically updated links to other top Ruby content each day
  • Our listing of the “Top 10 Ruby Sites” on every page’s sidebar (Wanna know what they are?
  • Read More

By Peter Cooper / October 3, 2009

rubypulse.pngRubyPulse is a screencast site that publishes regular videos about different Ruby libraries. It’s a month old so far and German Ruby developer Alex Peuchert has put out 9 episodes already. With a little support, perhaps Alex will be able to keep it going and become the pure Ruby equivalent of Ryan Bates!

Each RubyPulse episode is in Quicktime format and about 4 minutes long – each is also available in an iPod/iPhone tailored format. The nine episodes of RubyPulse so far include:

  • FastRI – A look at the performance-focused alternative to the “ri” command line tool.
  • Memoize – An overview of memoization in Ruby (the process of caching method responses for future use).
  • Read More

By Peter Cooper / September 30, 2009

rubymine2.pngRubyMine is a Ruby and Rails IDE (for Windows, OS X, and Linux) by JetBrains, the guys behind the popular Java IDE IntelliJ IDEA. We’ve previously posted about how much people seem to like RubyMine, and it looks like things will get even better, as they’ve just released the beta of RubyMine 2.0. Notably, RubyMine 2.0 will be free to existing 1.0 users as it falls within the year allowed for free updates!

The New Stuff

RubyMine 2.0 was initially meant to only be RubyMine 1.5 but Eugene Toporov of JetBrains told me that they’ve considered 2.0 to be more appropriate given the number of updates and additions. Read More

By Peter Cooper / September 29, 2009

ruby-enterprise-edition.pngToday Phusion has announced the release of Ruby Enterprise Edition (REE) 1.8.7 (more specifically, 1.8.7-20090928). Once considered a bit of a joke, given the name, REE has proven itself to be anything but, with significant memory usage and speed improvements over the stock “MRI” Ruby implementation (achieved by way of patches to the MRI code). The key development with this release is compatibility with Ruby 1.8.7, rather than the 1.8.6 of previous versions.

While REE has shown itself to be a good performer compared to the unpatched MRI implementation before, this week Evan Weaver of Twitter revealed how a release candidate version of REE 1.8.7 has resulted in a significant throughput increase on the same codebase. Read More

By Peter Cooper / September 25, 2009

twitter-stream.png A couple of weeks ago, popular micro-blogging service Twitter unveiled a beta “streaming API.” Twitter’s nature means they get hammered with polling requests so they’ve begun to experiment with the concept of streaming relevant data within a single HTTP request (in a Comet style). TweetStream (or GitHub repo) is a new Ruby library by Michael Bleigh to handle interacting with Twitter streams from Ruby.

TweetStream is available as a gem from both GitHub and Gemcutter (which, incidentally, got a fresh design today) and installation instructions are given in Michael’s blog post about TweetStream. Once you’re all installed, though, reading the live stream becomes as simple as:

require ‘tweetstream’

TweetStream::Client.new(TWITTER_USERNAME, TWITTER_PASSWORD).sample do |status|
puts “[#{status.user.screen_name}] #{status.text}”
end

Beyond basic functions, though, TweetStream also include daemonization features that allow you to create scripts that run in the background “out of the box.” You could add these features yourself with the daemons library, sure, but having this at hand to quickly throw together Twitter scripts is pretty cool. Read More

By Peter Cooper / September 21, 2009

Wanted to go to JRubyConf or RubyConf this year? Tough – they’re sold out already. Luckily, though, there are some interesting upcoming events that you can still get in to – some online, some in multiple cities, some held in youth centers, some in hotels, and even one on a tropical island. Whew!

(Update: Removed Aloha on Rails as it has sold out – thanks to Tammer Saleh for the note.)

Free “Optimizing Your Online Store” Webinar (Online; September 24, 2009)

newrelic.png

New Relic is running a free webinar event on Thursday, September 24 for developers and customers interested in optimizing e-commerce sites ready for the 2009 holiday season. Read More