Rap (Rakish App)

rap v. a quick, sharp knock or blow
rakish adj. having a dashing, jaunty, or slightly disreputable quality or appearance

A rakish extension to Tap.

Description

Rap supercharges the syntax of Rake by adding configurations, extended documentation, and class-based tasks that are easy to test.

Rap is a part of the Tap-Suite. Check out these links for documentation, development, and bug tracking.

Usage

Usage is much like rake:

[Rapfile]
require 'rap/declarations'
include Rap::Declarations

desc "your basic goodnight moon task"

# Says goodnight with a configurable message.
task(:goodnight, :obj, :message => 'goodnight') do |task, args|
  puts "#{task.message} #{args.obj}\n"
end

Now from the command line:

% rap goodnight moon
goodnight moon

% rap goodnight world --message hello
hello world

% rap goodnight --help
Goodnight -- your basic goodnight moon task
--------------------------------------------------------------------------------
  Says goodnight with a configurable message.
--------------------------------------------------------------------------------
usage: rap goodnight OBJ

configurations:
        --message MESSAGE

options:
    -h, --help                       Print this help
        --name NAME                  Specify a name
        --use FILE                   Loads inputs from file

For testing, load the Rapfile and access the task as a constant.

[test.rb]
load 'Rapfile'
require 'test/unit'
require 'stringio'

class RapfileTest < Test::Unit::TestCase
  def test_the_goodnight_task
    $stdout = StringIO.new

    task = Goodnight.new
    assert_equal 'goodnight', task.message

    task.process('moon')
    assert_equal "goodnight moon", $stdout.string
  end
end

The test passes:

% ruby test.rb
Loaded suite test
Started
.
Finished in 0.004921 seconds.

1 tests, 2 assertions, 0 failures, 0 errors

Generally speaking, the rap executable is a shorthand for ‘tap run –’ so you can use rap to quickly launch workflows as well. See the Command and Syntax References for more information.

Limitations

Rap is not a pure replacement of Rake. Rap does not support builds by default, classes like FileList are not included, and namespace lookup is slightly different (see the Syntax Reference).

Installation

Rap is available as a gem on RubyForge. Use:

% gem install rap

Rap requires an updated version of RubyGems (>= 1.2.0). To check the version and update RubyGems:

% gem --version
% gem --update system

Info

Copyright © 2009, Regents of the University of Colorado.

Developer

Simon Chiang, Biomolecular Structure Program, Hansen Lab

Support

CU Denver School of Medicine Deans Academic Enrichment Fund

Licence

MIT-Style