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

Author Archives: Hendy Irawan

About Hendy Irawan

Ruby programmer from Indonesia.

By Hendy Irawan / August 4, 2007

(English translation of the text below follows)

Situs Resmi Ruby Indonesia telah diluncurkan. Jadi sekarang telah tersedia 9 terjemahan dalam situs web Ruby, belum termasuk beberapa lagi yang masih dalam pengerjaan.

Programmer Indonesia yang menyukai Ruby semakin banyak, berdiskusi menggunakan wadah milis id-ruby, yang sekarang sudah semakin ramai.

Adanya situs ini diharapkan dapat semakin membantu kemajuan Ruby dan teknologi di tanah air tercinta. Selain berisi materi yang terdapat di situs Ruby versi Inggris, situs ini juga menyediakan materi-materi yang spesifik terhadap komunitas Ruby di Indonesia.

Tim pelaksana proyek ini terdiri dari Arie Kusuma Atmaja, Yohanes Santoso, dan Hendy Irawan. Read More

By Hendy Irawan / July 22, 2007

Capistrano is a deployment system written in Ruby by Jamis Buck. It has been the de facto standard for deploying Rails applications and automating remote tasks via SSH.

The recently released version 2.0 expands its usefulness not just for Rails developers, but for general automation tasks as well. New features include:

  • Namespaces. Tasks may be defined within namespaces, nested arbitrarily deep. No more worrying of task name collision.
  • Deployment strategies. Besides Subversion checkout, you can now specify other deployment strategies: export, copy, tar/gzip, etc.
  • Opt-in deployment tasks. Deployment tasks are now opt-in; you don’t get them, unless you ask for them.
  • Read More

By Hendy Irawan / July 20, 2007

Prfsa

Practical Ruby For System Administration, a recently released Apress book authored by André Ben Hamou, will help you pick up practical tips on Ruby coding style, learn how to analyze and improve script performance, and make use of no-nonsense advice on scripting workflow, including testing and documentation.

In this book you’ll see why Ruby’s flexibility, superb feature set, and gentle learning curve make it a natural choice for system administration tasks, from the humblest server to the largest enterprise deployment.

André was kind enough to let Ruby Inside ask a few questions for this interview.

Ruby Inside: What is your background in the computer industry? Read More

By Hendy Irawan / July 18, 2007

god monitors your server processes and tasks to make sure they run smoothly, and performs maintenance tasks (such as restarting your application servers) as necessary. This Ruby application is written by Tom Preston-Werner and serves similar functionality to, and inspired by, a popular tool called monit.

Among the features god provides include:

  • Config file is written in Ruby
    Easily write your own custom conditions in Ruby
    Supports both poll and event based conditions
    Different poll conditions can have different intervals

Here’s a part of an example config file used to monitor mongrel instances: Read More

god.watch do |w|
w.name = “gravatar2-mongrel-#{port}”
w.interval = 30 # seconds
w.start = “mongrel_rails cluster::start –only #{port}
-C #{RAILS_ROOT}/config/mongrel_cluster.yml”
w.stop = “mongrel_rails cluster::stop –only #{port}
-C #{RAILS_ROOT}/config/mongrel_cluster.yml”
w.grace = 10 # seconds

By Hendy Irawan / July 17, 2007

Twitter4R is a Ruby library to access Twitter API functionality developed by Susan Potter. Twitter itself is sort of social network with a differentiation: it allows you to send to and receive updates from your friends instantly.

The recently released major upgrade Twitter4R 0.2.0 offers significant improvements:

  • 100% coverage of official Twitter REST API
  • RSpec specifications with 100% code coverage
  • Cleaning and removal of previously inconsistent API

Here’s a simplified example Twitter4R usage:

gem(‘twitter4r’, ‘>=0.2.0′)
require(‘twitter’)

client = Twitter::Client.new(:login => ‘mylogin’,
:password => ‘mypassword’)
new_message = client.message(:post,
‘I am addicted to Twitter’, ‘myfriendslogin’)

To install it:

gem install twitter4r

Note: As an alternative, Twitter gem, as covered previously at Ruby Inside, is also available. Read More

By Hendy Irawan / July 9, 2007

The freely available Aptana IDE seems to be moving faster than ever. Aptana is a web developer’s IDE with extensive Ruby and Rails support through the RadRails plugin. Having announced support for AIR right after Adobe released a Beta, the latest Aptana IDE already supports development for the just-released Apple iPhone.

Among the features that Aptana IDE provides for iPhone developers include:

  • Preview of your iPhone projects in hortizontal and vertical mode
  • iPhone Project contains starter files to get you going easily on your iPhones apps
  • Easy import of Ajax libraries into iPhone projects
  • Help and online documentation
  • Integrated server that enables you to serve your iPhone apps directly to your iPhone for easy testing
  • A version of Joe Hewitt’s Firebug for iPhone
  • Export wizard for bundling and deploying iPhone applications (coming soon)
  • Integrated content assist for iPhone-specific APIs (coming soon)

Check out the Aptana for iPhone development page for more information. Read More

By Hendy Irawan / June 26, 2007

Sake is a RubyGem by Chris Wanstrath which executes and manages system-wide Rake tasks. Whereas Rake is project-specific, Sake allows the developer to examine, install, run, and uninstall Rake files and tasks globally, much like the way Rubygems does this for Ruby libraries.

Sake files are for the most part just regular Rake files:

namespace :db do
desc “Returns the current schema version”
task :version => :environment do
puts “Current version: ” +
ActiveRecord::Migrator.current_version.to_s
end
end

desc “Show specs when testing”
task :spec do
ENV['TESTOPTS'] = ‘–runner=s’
Rake::Task[:test].invoke
end

Installing a task is easy:

$ sake -i err.rake spec
# Installing task `spec’
$ sake -T
sake spec # Show specs when testing

You can combine Sake global tasks and project-specific Rake tasks, as Sake picks them up automatically. Read More

By Hendy Irawan / June 16, 2007

Adobe Integrated Runtime (AIR), codenamed and originally named Apollo, is a cross-operating-system runtime environment for building Rich Internet Applications, using Flash, Flex, HTML, Ajax, that can be deployed as a desktop application.
 

AIR has gone Public Beta, so does anybody use it? eBay does, Adobe has more, and who doesn’t love twitter?

Here are some AIR-related resources (and alternatives) that might interest you.

Related Ruby on Rails AIR ResourcesWebORB for Rails by Midnight Coders can be installed as a plugin into any Rails application to expose Ruby classes as remote services. Mike Potter created Ruby on Rails RIA SDK Read More which makes integration much easier.

By Hendy Irawan / June 15, 2007

Deplate is a Ruby-based tool written by Thomas Link to convert documents written in wiki-like markup to various output formats. Supported output formats include LaTeX, HTML, “HTML slides”, DocBook (which means it can also convert to PDF, and other DocBook-supported output), and plain text.

In addition to being capable of reading various Wiki markup variants, a particularly interesting feature is it also handles rdoc input which is very handy for generating print-ready documentation of your Ruby projects.

To see the results for yourself, various samples of Deplate generated output are available for your viewing pleasure. To get it, you can download the stable version from Deplate project files page or check out its latest development version from CVS. Read More

By Hendy Irawan / June 11, 2007

From Basecamp's screenshot

relative_time_helpers is a straightforward, but very useful Rails plugin by Rick Olson that formats timestamps to human-friendly relative dates. You’re probably already using Rails’ built-in time_ago_in_words helper in your applications, but Rick’s relative_time gives even better results:

<%= relative_time(Time.now) %>
# today
<%= relative_time(1.day.ago) %>
# yesterday
<%= relative_time(1.day.from_now) %>
# tomorrow
<%= relative_time_span([Time.now, 5.days.from_now]) %>
# May 17th – 22nd

To install it: Read More

script/plugin install http://ar-code.svn.engineyard.com/plugins/relative_time_helpers

By Hendy Irawan / June 9, 2007

ar_mailer

ar_mailer is a Ruby gem by Eric Hodel (a ZenTest core developer) that works with Rails to store outgoing e-mail messages into the database for later delivery by a separate ar_sendmail process. This is handy because delivering e-mails can take a long time if performed before rendering pages, especially if you have hundreds of messages to send!

Version 1.2.0 adds TLS (Transport Layer Security) support and numerous other bug fixes and updates. To install:

gem install ar_mailer

Note: If you still get the old 1.1.0 version even after doing a gem install, you can download the .gem file directly from Seattlerb Rubyforge Project Page. Read More

By Hendy Irawan / June 6, 2007

Just a couple of weeks ago, the XRuby team released XRuby 0.2.0. XRuby is Ruby-to-Java bytecode compiler, so you can compile Ruby source code directly to Java classes. The latest version fixes several issues and adds debugging support.

The goal of this project is similar to JRuby, to run Ruby applications on the Java Virtual Machine. Each takes a different approach however. JRuby uses an interpreter written in Java to execute Ruby code at runtime. XRuby, on the other hand, compiles the Ruby code to Java bytecode (although JRuby is introducing a feature which also does this – the JIT perform of JRuby is beginning to become impressive) which means there is less overhead and potentially increased performance. Read More

By Hendy Irawan / June 2, 2007

Aptana IDE features

Aptana IDE has been since inception targeted to Ajax developers and power web designers, with advanced features such as JavaScript debugging and built-in searchable reference manuals for many web standards (in addition to JavaScript, DOM, CSS, and HTML, it also bundles documentation for several Ajax libraries including Scriptaculous.)

With the merge of RadRails into Aptana, the Aptana+RadRails bundled IDE now supports Ruby syntax highlighting, debugging, code completion, and support for Rails-specific tasks like defining WEBrick and Mongrel servers. Although the project is still in beta, it is already very usable for daily use.

Alternatives: EasyEclipse for Ruby on Rails, which is very easy to install (bundles the Java runtime) has RadRails built-in and you can enhance it using the Aptana plug-in. Read More

By Hendy Irawan / May 29, 2007

Autotest_red_green

ZenTest is a bundle of useful time-saving tools created by Ryan Davis to make the process of testing your applications faster and more effective:

  • zentest automatically writes your missing code based on simple naming rules.
  • unit_diff compares expected results from actual results and allows you to quickly see exactly what is wrong.
  • autotest continuously runs in the background, running relevant tests as soon as you modify a file. It’s probably the most popular component of the ZenTest package. With RedGreen, you’ll even get colorized tests!
  • multiruby runs anything you want on multiple versions of ruby. Great for compatibility checking!
  • Test::Rails provides even more comprehensive testing support for your Rails projects.
  • Read More

By Hendy Irawan / May 27, 2007

Rack, recently announced at version 0.2 by Christian Neukirchen, is a minimal, modular and adaptable interface for developing Ruby web applications. By wrapping HTTP requests and responses in the simplest way possible, it unifies and distills the API for web servers, web frameworks, and software in between (the so-called middleware) into a single method call.

A simple Rack application looks like this:

class HelloWorld
def call(env)
[200, {"Content-Type"=>"text/plain"}, ["Hello world!"]]
end
end

If you ever think Rails is a bit overkill for some of your projects, you might just really like Rack. It supports web frameworks such as Camping, Ramaze, Maveric, and Racktools::SimpleApplication. Read More