Capistrano is just a Ruby program, so you're free to define and use  
Ruby methods.   

def my_function
    now = Time.now
    # Assuming $CRONJOBLOG is a file-like object
    $CRONJOBLOG << "#{now} : #{$*}"
end

You would define this at the top of your recipe (or in another file  
that you would require at the top of your recipe) and call it with

my_function

or

my_function()



On Mar 28, 2008, at 1:47 AM, Jim wrote:

>
> I wrote a task like:
> task :parse_log, :hosts=>"myhostname", :roles=>:jim do
>    run "Date=`date --d '1 day ago' +%Y-%m-%d`"
>    run "echo '${Date}'"
> end
>
> by the way. Can I use function in capistrano?
> like:
>
> function myfunction  {
>  NOW=`date`
>  echo "$NOW : $*" >> $CRONJOBLOG
> }
>
> How can I call this function in capistrano?
> >


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

Reply via email to