Tutorials

Interesting Ruby Tidbits That Don’t Warrant Separate Posts #1

Welcome to the first "Interesting Ruby Tidbits That Don't Warrant Separate Posts"! This is going to be a somewhat regular feature of all the reasonably interesting things I'm e-mailed about or discover that aren't getting as much attention as they should, but which aren't captivating enough to warrant an entire post on their own. So without further ado..thread-dump librarythread-dump is an interesting library that lets you to get a dump of thread activity when a Ruby process quits by Greg Fodor. In his own words:

Read more →

How to Build Simple Console Apps with Ruby and ActiveRecord

Gregory Brown has put together a great four-page tutorial on how to build a database driven console application using Ruby and ActiveRecord (no Rails needed!). As well as delivering what the title suggests, Brown also looks at some neat Ruby techniques for structuring applications in general (such as using modules and module_function). The end result is an app called "EarGTD," a basic time / task management tool.

Read more →

Easy RubyGem Publishing With Hoe

Geoffrey Grosenbach, author of the famous PeepCode screencasts, has written a tutorial about using Ryan Davis' hoe library to make releasing your own RubyGems a cakewalk. Geoffrey says that using Hoe turns a laborious, multi-step twenty minute process into only a few Rake tasks. Hoe takes the automation of Gem publishing seriously, and once you've set it up properly you can go as far as let it post announcements (to your blog and/or Rubyforge), build your docs, create an e-mail announcement, run testing packages against the library, as well as actually releasing and uploading the gem to Rubyforge ready for public consumption. CPAN, eat your heart out!

Read more →

How to Transfer Files using SSH and Ruby

Matthew Bass has written a tutorial, published by InfoQ, called "Automating File Uploads with SSH and Ruby." It provides an in-depth look into building a small Ruby script that can backup files to a remote machine over SSH using the Net-SSH and Net-SFTP libraries. It goes into quite some depth, and provides source code for a recursive backup script. If you haven't had a dig into the Net-SSH and Net-SFTP libraries yet, it's worth a look to see how the basics work.

Read more →

How to Easily Deploy a Self-Contained Rails App On A Tomcat Server

Victor Igumnov has put together a simple walkthrough of how to package a Rails application into a single WAR file to run on a Tomcat server using JRuby, a pure Ruby PostgreSQL library (no ActiveRecord-JDBC needed!), and GoldSpike (JRuby addon that provides rake tasks to make WAR files). This is useful knowledge for anyone who might be forced into deploying Rails apps in an enterprise type system where Tomcat may be the only viable deployment option.

Read more →

Data Structures and Algorithms with OO Design Patterns in Ruby

Cs
Data Structures and Algorithms with Object-Oriented Design Patterns in Ruby is an online book (free to read!) by Dr. Bruno R. Preiss, an incredibly well qualified engineer and computer scientist. It covers all of the various data structures and algorithms that beginning Computer Science students have to learn, but from a Ruby perspective and using object oriented design patterns.
The book itself is now a few years old, but I've only just come across it and it still seems relevant although, rather sadly, the on-page code is in graphics only (a ZIP file containing the source is available) and feels like a line-by-line conversion from C++ rather than true Ruby code. Still, if computer science, data structures, and algorithms elude you to any degree, and you want to learn about them while following Ruby code, it's a good place to start. There are also versions for C++, Java, C# and Python available from Bruno's homepage.

Read more →