[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

setting RUBYLIB in a script

aidy

6/13/2006 10:17:00 AM

I have scripts in 2 different windows folders

C:\Documents and Settings .....\E2\Customers
C:\Documents and Settings .....\E2\Employers

Now, I want to run a script in 'Employers' that requires scripts from
'Customers'.

In my 'Employers' script at the very top I have put this:

ENV['RUBYLIB'] = "..\MaintainEmpsInRoles"
require 'all_libs' # this is in 'Customers'folder

I am getting a syntax error. I have looked at pickaxe, but I don't feel
it is fully explained.

Thanks

Aidy

2 Answers

aidy

6/13/2006 11:21:00 AM

0

sorry, I meant this variable assignment.

ENV['RUBYLIB'] = "..\Customers"


aidy wrote:
> I have scripts in 2 different windows folders
>
> C:\Documents and Settings .....\E2\Customers
> C:\Documents and Settings .....\E2\Employers
>
> Now, I want to run a script in 'Employers' that requires scripts from
> 'Customers'.
>
> In my 'Employers' script at the very top I have put this:
>
> ENV['RUBYLIB'] = "..\MaintainEmpsInRoles"
> require 'all_libs' # this is in 'Customers'folder
>
> I am getting a syntax error. I have looked at pickaxe, but I don't feel
> it is fully explained.
>
> Thanks
>
> Aidy

zycte

6/15/2006 12:48:00 AM

0

The standard way of doing this would be:

$:.unshift File.join(File.dirname(__FILE__), "..", "Customers")

This is an almost literal extract from the pickaxe book, in which they
refer to it as "load path magic".

The reason you get a syntax error is because you use \ in a string,
which is reserved for escaping. Use "\\" to get a string containing a
single backslash.

On 2006-06-13 13:21:18 +0200, "aidy" <aidy.rutter@gmail.com> said:

> sorry, I meant this variable assignment.
>
> ENV['RUBYLIB'] = "..\Customers"
>
>
> aidy wrote:
>> I have scripts in 2 different windows folders
>>
>> C:\Documents and Settings .....\E2\Customers
>> C:\Documents and Settings .....\E2\Employers
>>
>> Now, I want to run a script in 'Employers' that requires scripts from
>> 'Customers'.
>>
>> In my 'Employers' script at the very top I have put this:
>>
>> ENV['RUBYLIB'] = "..\MaintainEmpsInRoles"
>> require 'all_libs' # this is in 'Customers'folder
>>
>> I am getting a syntax error. I have looked at pickaxe, but I don't feel
>> it is fully explained.
>>
>> Thanks
>>
>> Aidy