That's a neat idea (and I LOVE the autogenerated documentation!), but I'm not sure I like adding (1) another "keyword", and (2) calling them arguments, when they're really just variables that the task depends on.

What if this was implemented by extending the 'desc' keyword, something like this:

  desc do |d|
    d.text "foo"
    d.references :rake, "Path to rake", :default => "rake"
    # ...
  end

The original syntax would continue to work, too:

  desc "foo"

This way, we could later decide that we want to document other aspects of the task (roles, subtasks it calls, etc.) without resorting to further cluttering the namespace. What do you think?

- Jamis

On May 14, 2008, at 2:29 PM, gabe wrote:


In the capitate gem, we added a task_arg metho to the task DSL, so
that we could document and setup defaults for cap variables.

For example,

---

 desc <<-DESC
   Run the migrate rake task ....
 DESC
 task_arg(:rake, "Path to rake", :default => "rake")
 task_arg(:merb_env, "Merb environment", :default => "")
 task_arg(:migrate_target, "Migration target", :default => :latest)
 task :migrate, :roles => :db, :only => { :primary => true } do

   current_directory = case migrate_target.to_sym
     when :current then current_path
     when :latest  then current_release
     else raise ArgumentError, "unknown migration target
#{migrate_target.inspect}"
     end

   run "cd #{current_directory}; #{rake} MERB_ENV=#{merb_env}
#{migrate_env} db:migrate"
 end

---

http://github.com/gabriel/capitate/tree/master/lib/recipes/merb.rb

Using this info, we also generate documentation, for example:
http://capitate.rubyforge.org/recipes/merb.html

Is this a weird "extension" of cap or do you think its something that
might be useful to add in?

Thanks!
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---


Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to