Page 1 of 1

Running Cobra the first time

PostPosted: Tue Jul 06, 2010 9:23 pm
by Charles
mchean wrote:...I would like some kind of instructions on how to setup the Cobra env. such that one just unzips - and then is able to compile and run the Hello sample for instance. Quick and easy gratification without any in depth knowledge of the .Net and its setup.


To run the most recent release, try this:

Download the prominent .zip for Windows, or .tar.gz for other systems, at the Downloads page. Currently that is Cobra-2010-04-02

If you are on Mac or Linux, you will need to install Novell Mono if you don't have it already. If you are on Windows, you probably already have .NET 2.0 or higher.

Unzip (or untar) the file.

Change to the directory such as "cd Cobra-2010-04-02"

Examine the "read me" file and follow its directions.

Afterwards, create a new Cobra file in your own directory such as:
class MyProgram
def main
print 'Hello.'

And run with "cobra hello.cobra" at the command line.


mchean, please provide feedback on the above. Is there a step missing? Is anything unclear? We can then make these instructions more prominent on the downloads page.

Re: Running Cobra the first time

PostPosted: Wed Jul 07, 2010 1:47 am
by carlosqt
After Unzip Cobra-2010-04-02.zip you have the following folder structure:
> Developer
> HowTo
> Reusables
> Samples
> SamplesInProgress
> Source
> Supplements
> Tests

Go to: Source

Run install-from-workspace.bat

Command line appears running scripts

The result is a new folder in C:\ root.
You can move the complete folder to another location if you want.
Assuming you did not change the folder location you have:

C:\Cobra
> bin
> Cobra-0.8.0-post
> bin <-- compiler is here (Cobra.exe)
> HowTo
> Reusables
> Samples
> Supplements

Here is what you need to start compiling: C:\Cobra\Cobra-0.8.0-post\bin

Create a hello.cobra txt file with the code mentioned by Chuck in the previous post and put it in the same bin folder:

C:\Cobra\Cobra-0.8.0-post\bin

Open a command prompt and navigate to the Bin folder where the Cobra.exe and hello.cobra are:

C:\Cobra\Cobra-0.8.0-post\bin

Run the following:

Cobra.exe hello.cobra

This creates a hello.exe and displays hello. to the console.

Re: Running Cobra the first time

PostPosted: Wed Jul 07, 2010 4:21 am
by Charles
Thanks for the extra detail. Overall looks good, but I don't like cluttering up the bin\ directory with various user files. I wouldn't put anything there, not even hello.cobra.

Maybe we can move this to the wiki as InstallOnWindows and InstallOnUnix or something similar.

Re: Running Cobra the first time

PostPosted: Wed Jul 07, 2010 9:37 am
by mchean
Hi:
It looks good after the addition of the install-from-workspace.bat instruction. That is the step I missed initially, but found the
error mentioned elsewhere in these forums.
Thanks for all the effort Chuck, this is a great language, very clear and concise.
Have you ever presented at the L.A. Python User group?

Re: Running Cobra the first time

PostPosted: Wed Jul 07, 2010 10:13 am
by Charles
You're welcome. Thanks for the compliment.

Yeah I presented Cobra there back in 2008. I used to attend the meetings every month but haven't been there in awhile. Still on the list.

You'll find Cobra mentioned at http://socal-piggies.org/scp/PastMeetings.