Tapfile example broken

3 views
Skip to first unread message

grosser.michael

unread,
Dec 14, 2008, 12:43:09 PM12/14/08
to Tap Forum
in empty directory create Tapfile with:

# ::desc your basic goodnight moon task
# Says goodnight with a configurable message.
Tap.task(:goodnight, :name, :message => 'goodnight') do |task, args|
puts "#{task.message} #{args.name}"
end

tap run -T
dump # the default dump task
load # the default load task
rake # run rake tasks

tap run -- goodnight moon
unknown task: goodnight

tap run goodnight moon
unknown task: goodnight

rap run goodnight moon
warning: implict rake for [run goodnight moon]
rake aborted!

Simon Chiang

unread,
Dec 14, 2008, 7:13:26 PM12/14/08
to ruby-...@googlegroups.com
The problem here is a bit of confusion about when to use 'tap' and when to use 'rap'. 

Tap is a kind of pure interface to the framework.  You can run commands with it (ex 'run' or 'manifest') and it ONLY picks up tasks that are installed as gems or under your lib directory.  If you run 'tap' in a directory with a tap configuration file (ie tap.yml), ONLY tasks under your lib directory are picked up.  Various configurations can change that, but by design this is the case to give you strict control over what's going on.

Rap is basically a shorthand for 'tap run -- ' and picks up tasks the same way as tap... with one addition.  Rap also picks up tasks in your tapfile.  This was added to give rap similar use as rake.

So what you've got is a task declaration in a tapfile.

  % tap run -T
  % tap run -- goodnight

Doesn't pick it up because it's in the tapfile, not in your lib directory.

  % rap goodnight

Should work (it works for me).  This doesn't work:

  % rap run goodnight

You're effectively calling a non-existant 'run' task... it's the equivalent of 'tap run -- run goodnight'.



Reply all
Reply to author
Forward
0 new messages