[Cook] commands in Cook actions

Pendergraft, Jerry JPendergraft at sjm.com
Sun May 16 10:01:23 EST 2010


A couple of things may be causing the problem.
Using echo as you have done:
    echo "#define VERSION $(git describe)" > src/version.h;
Is often tricky due to exactly where the variables are evaluated.
I suspect the ${git describe} is being evaluated as a shell variable as being empty thus you get an empty value.

Better practice is to use the data dataend form or function write, using the cook variable for version. Examples
    cat > [target]; data
#define VERSION [version]
dataend

Or 
    function write [target] #define VERSION [version];

I tend to favor the data dataend method because one can see exactly the resulting content and easily add to it if desired, Ala:

    cat > [target]; data
/* Automatically generated - do no edit */
#define VERSION [version]
dataend



Jerry Pendergraft                              voice:651-756-3212
St.Jude Medical                                mobil:651-491-0163
Atrial Fibrillation Division                email:jpendergraft at sjm.com
1350 Energy Lane
St.Paul, MN  55108






-----Original Message-----
From: cook-users-bounces+jpendergraft=sjm.com at lists.auug.org.au on behalf of Andreas Wagner
Sent: Sat 15-May-10 13:34
To: cook-users at lists.auug.org.au
Subject: [Cook] commands in Cook actions
 
Hello,

I have this in my Howto.cook for automatically updating the version
number in my command line utility:

src/version.h:
                    ;
{
    echo "#define VERSION $(git describe)" > src/version.h;
}

after Cooking src/version.h contains:
define VERSION

Shouldn't Cook execute this command as it would be executed on the command line?

Thanks,
Andreas
_______________________________________________
Cook-users mailing list
Cook-users at lists.auug.org.au
http://lists.auug.org.au/listinfo/cook-users

This communication, including any attachments, may contain information that is proprietary, privileged, confidential or legally exempt from disclosure.  If you are not a named addressee, you are hereby notified that you are not authorized to read, print, retain a copy of or disseminate any portion of this communication without the consent of the sender and that doing so may be unlawful.  If you have received this communication in error, please immediately notify the sender via return e-mail and delete it from your system.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.auug.org.au/pipermail/cook-users/attachments/20100515/1d03d5be/attachment.html>


More information about the Cook-users mailing list