[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Setting Windows Environment Variables

Cameron, Gemma (UK)

8/14/2006 4:03:00 PM


Hi all!

I'm another Ruby noob and wondered if any of you can help me with my problem.

I've have been tasked with writing some rake files to automate parts of our project and to begin I'm trying to automate the setup of the build machine. The first task is to set the environment variables.

Can this be done in Ruby without using system("%PATH% = %PATH%;c:\ruby\bin") etc.?

Thanks in advance!!!! ( :

Regards

Gem

********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

3 Answers

Jano Svitok

8/14/2006 4:08:00 PM

0

On 8/14/06, Cameron, Gemma (UK) <gemma.cameron@baesystems.com> wrote:
>
> Hi all!
>
> I'm another Ruby noob and wondered if any of you can help me with my problem.
>
> I've have been tasked with writing some rake files to automate parts of our project and to begin I'm trying to automate the setup of the build machine. The first task is to set the environment variables.
>
> Can this be done in Ruby without using system("%PATH% = %PATH%;c:\ruby\bin") etc.?
>
> Thanks in advance!!!! ( :

ENV['PATH'] += "c:\ruby\bin"

will be vaild only in processes that you'll start from your script, in
other words, you cannot modify parent environment. (you could do by
some batch file wizardry)

J.

Jeff Schwab

8/14/2006 4:09:00 PM

0

Cameron, Gemma (UK) wrote:

> I've have been tasked with writing some rake files to automate parts of our project and to begin I'm trying to automate the setup of the build machine. The first task is to set the environment variables.
>
>
> Can this be done in Ruby without using system("%PATH% = %PATH%;c:\ruby\bin") etc.?

# http://www.rubycentral.com/book/rubywor...

ENV['Hello']='World'
system("echo %HELLO%")


Austin Ziegler

8/14/2006 4:57:00 PM

0

On 8/14/06, Robert Dober <robert.dober@gmail.com> wrote:
> ENV cannot be assigned too.

>> ENV["PATH"]
=> "C:\\Ruby\\bin;..."
>> ENV["PATH"] += ";C:\\tmp"
=> "C:\\Ruby\\bin;...;C:\\tmp"
>> system("cmd")
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\home>PATH
PATH=C:\Ruby\bin;...;C:\tmp

The environment CAN be assigned to. What you can't do is propagate it
upwards. Any processes you spawn from your Ruby application will use
your new environment table, but you can't call a Ruby application to
set your environment in its parent.

-austin
--
Austin Ziegler * halostatue@gmail.com * http://www.halo...
* austin@halostatue.ca * http://www.halo...feed/
* austin@zieglers.ca