After releasing Relax into the open arms of those at BarCampOrlando, I decided it was about time I put together a buildfile for the project. Now, I’ve used Rake plenty as a user over the past few years, but I’ve never spent a lot of time looking into how it actually works. My first goal for a buildfile was to create a gem for Relax. This turned out to be incredibly easy, thanks to the built-in gempackagetask. Here’s pretty much the extent of what’s required to create a working buildfile for packaging gems:

require 'rake/gempackagetask'

spec = Gem::Specification.new do |spec|
  spec.name = 'relax'
  spec.version = '0.0.1'
  spec.summary = 'A simple library for creating REST consumers.'
  spec.author = 'Tyler Hunt'
  spec.email = ''
  spec.homepage = 'http://protoh.com/'
  spec.platform = Gem::Platform::RUBY
  spec.files = FileList['{bin,lib}/**/*'].to_a
  spec.require_path = 'lib'
  spec.autorequire = 'relax'
  spec.test_files = FileList['{spec}/**/*spec.rb'].to_a
  spec.has_rdoc = true
  spec.extra_rdoc_files = ['README', 'LICENSE']
  spec.add_dependency('hpricot', '>= 0.5')
end

Rake::GemPackageTask.new(spec) do |package|
  package.need_tar = true
end

Now, a simple rake gem will scour the source files and bundle everything up into a nice, neat gem.

Since then, I’ve been attempting to hurry the project along to a state more typical of most other Ruby packages, and that means writing RDocs. I’ve read lots of code with RDocs, but I don’t recall ever having written any before. It turns out I really like working with the format, and it seems much cleaner than Javadocs. (I’ll leave the details for another post.)

So, I’ve expanded the Rakefile for Relax slightly to add a task for generating my Rdocs:

Rake::RDocTask.new do |rdoc|
  rdoc.title = 'Relax Documentation'
  rdoc.main = 'README'
  rdoc.rdoc_files.include('README', 'LICENSE', 'lib/**/*.rb')
end

Again, a very straightforward task. The full documentation for Relax is now available on the Relax site.

So that’s where Relax development has been focused for the past few days. One of these days I’ll try to put together a high level overview of the progress accomplished last weekend, and the features included in the first release.

Somewhat coincidentally, I’ll be giving a short talk on Rake as part of the Build Tool Shoot Out at the Adogo meeting on Tuesday.

Sorry, comments are closed for this article.