This example splits namespaces into different files, but that's likely overkill for most uses. Shoving everything in a Rakefile would work fine too.
To use this:
cd /tmp
mkdir raketest
cd raketest
touch Rakefile
mkdir rakelib
# save the two sample *.rake files in rakelib
In this example, a blank Rakefile is fine; it provides an 'anchor' so rake can find the root of the 'project'. Rake will then find and autoload rakelib/*.rake files to load tasks.
Invoke via rake packer:release[baseboxname]
In the tasks, the :basebox parameter is accessible as args.basebox. In the task's sh block, use normal hash+curlies interpolation: #{args.basebox}