setting RUBYLIB in a script

A

aidy

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
 
Z

zycte

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.

sorry, I meant this variable assignment.

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

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top