In another thread I described how I handle that problem.

I maintain the constants and variables in an Excel sheet.
But I have a macro on the sheet that writes those out to another file.

You have a choice at that point: to have the macro write all or part of your 
.RB file and execute it, as I am doing, or have it export to an .ini file and 
then read the .ini file from your .RB file.  The second is probably more 
standard, and it can also be used by other environments if it ever comes around 
to that.

Let's say you have 3 constants on the Excel page, laid out vertically:

---A---   ---B---
xyzzy  345
plugh   gopher
razzle .28951

your macro would do the following:
open a text file
write the var and val to it for each of the items
close the text file

That might look something like this (I use the older style .VB code for writing 
to files)

f=freefile
open "c:\yourpath\yourfile.ini" for output as #f
for a = 1 to 3
print #f, cells(a,1) & "=" & cells(a,2)
next a
close #f

This will produce a file that looks like:

xyzzy=345
plugh=gopher
razzle=.28951


At this point you have your .ini file, and the data can be read  easily by any 
script, including your ruby script.  AND you still have the data in a 
spreadsheet format that your stakeholders can use.  

The other way to do the same thing is to use the .rb code to open and extract 
the cells from the spreadsheet.  That way you don't have to have a macro in the 
spreadsheet, which may bother some people.
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5619&messageID=16369#16369
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to