23 Useful Ruby 1.9 Links and Resources
It's approaching two weeks now since Ruby 1.9.1 was released, bringing with it not only a whole stack of extra performance and a new VM, but also a lot of compatibility issues. No pain, no gain!
Thankfully, the Ruby community in its typical way has got to blogging, writing scripts, and what not, resulting in a flurry of useful links and resources for those brave enough to test the Ruby 1.9.1 waters. So here come 23 useful Ruby 1.9.1 links and resources! If you have any others you wish to add, please leave a comment as people will be checking those out too.
Ruby 1.9.1 Specifically..
build_ruby19.sh - A quick shell / bash script that downloads Ruby 1.9.1 from ruby-lang.org then untars and installs it. It uses a "program suffix" of "19" so it shouldn't overwrite your existing Ruby 1.8 programs. Instead you'll end up with ruby19, gem19, irb19, and so forth. This strategy makes it a cakewalk to run two versions of Ruby at the same time. Want a script that installs both? Try this instead (it makes the 1.9 versions the "default" though). All somewhat based around these similar Web-based instructions by Ryan Grove.
Future proofing your Ruby code. Ruby 1.9.1 is coming. - Australian superhero Dr Nic Williams takes a look at using multiruby to run Ruby 1.9 and 1.8 on the same system. This is quite a different approach to just installing them separately with different suffixes and might suit your workflow better.. Ken Collins has also written MultiRuby The MacPorts Way which takes a slightly different approach.
Getting ready for Ruby 1.9.1 - The Phusion guys (behind the excellent Passenger / mod_rails) give some tips regarding running Rails apps on Ruby 1.9.1. They explain that you must move on up to Rails 2.3, that you'll need to patch a ton of gems, but that the latest build of Phusion Passenger will work happily with Ruby 1.9.1.
Ruby 1.9.1 - The Stuff It Gives Us - Justin Reagor presents an overview of 8 new features / differences (with code examples). For example, you can now overload operators like !, !=, and !~, hashes preserve their order, and newlines can go where no newline has gone before.
Is It Ruby 1.9 - A community site where you can track gem compatibility with Ruby 1.9 (Ruby 1.9.1 specifically, though) as well as make reports of your own. If you want to contribute to the community in any way right now, this is a good place to do it. Get those reports and fixes in!
Installing Ruby 1.9.1 & Rails from Source on Ubuntu Screencast - A 7 minute walkthrough of installing Ruby 1.9.1 and Rails from source on Ubuntu (rather than via apt-get) by Joon You. This should work on Debian as well.
Ruby 1.9.1 Release News - The official "NEWS" list from the 1.9.1 release. It doesn't go into details but presents a gigantic list that expresses what's new and what changed in Ruby 1.9.1 versus 1.8. Certainly worth a quick scan.
Ruby 1.9 Generally..
Migrating to Ruby 1.9 - Bruce Williams' presentation covering Ruby 1.9 at a high level. Lots of pithy code examples, M17N is covered, etc. A great resource if you get bored quickly as you can just flick through in a few minutes.
Working with Encodings in Ruby 1.9 - A very solid introduction to M17N (multilingualization) support in Ruby 1.9 with examples.
Changes in Ruby 1.9 - A classic guide to the changes in Ruby 1.9 by Mauricio Fernandez. Sadly it's not been updated since 2007 but it's such a gigantic list packed with excellent code examples that it should still be essential reading.
10 things to be aware of in moving to Ruby 1.9 - David A Black (of RubyCentral and Ruby for Rails fame) highlights 10 "gotchas" that could bite you in the ass when moving to Ruby 1.9. Includes
String#each, block variables scope and semantics, the
* operator, and more.
Fun with Ruby 1.9 Regular Expressions - Dave Thomas (of Pickaxe fame) presents a very compelling code example showing how regular expressions have grown up in Ruby 1.9. You can now write some pretty advanced parsers using the new features.
Getting Code Ready for Ruby 1.9 - James Edward Gray II wrote a year ago about some of the changes you'll need to take into account when moving from Ruby 1.8 to 1.9. Still good reading and the plentiful comments make it worth the trip.
Benchmarking Ruby - Evan DiBiase has just (as in, a few days ago) performed some benchmarks on JRuby 1.1.6 (and an early build of 1.2), MacRuby, Ruby 1.8.6, and Ruby 1.9.1. Benchmarks are always hard to get right, but he finds that while Ruby 1.9.1 is significantly faster than 1.8.6, JRuby is faster still. (I have found this to be true in my own work.. JRuby is on fire!)
The December 2008 Great Ruby Shootout - Antonio Cangiano's famous Ruby benchmarking shootout. It wasn't without flaws (what benchmarks are?) but it showed us that Ruby 1.9 is approximately double the speed of 1.8.
Pipelines Using Fibers in Ruby 1.9 - It's from all the way back in 2007 but Dave Thomas shows how to use Ruby 1.9's "fibers" feature to implement a pipeline of operations. Note that it leads on to a second part too.
Why you should use Ruby 1.9 with Prawn - Gregory Brown explains with Ruby 1.9 is so awesome for his Prawn PDF library. The tests run in half the time and Ruby 1.9's text encoding features make life a lot easier.
Arrow Lambdas, a Ruby 1.9 Vignette - A code-driven walkthrough of lambdas in Ruby 1.9 by Bruce Williams. This is the best casual walkthrough of the new lambda syntax(es) for 1.9 I've seen so far.
Ruby 1.9 can check your indentation - No, no, this isn't the start of a process leading to a Ruby/Python merger with Ruby 3.0 (though never say never).. it's just that Ruby 1.9 can now see if indentation is mismatched on things like if statements or method definitions and give you better warnings when you get things wrong. Another great post by Dave Thomas.