[Rant] Extending sys?
Kevin Burge
kevin.burge at systemware.com
Sat Dec 17 13:08:32 EST 2005
Stefan,
You said:
Doesn't wget.exe live in a directory listed in the PATH
environment variable? If it does, the definition of wget
could simply look like:
def wget(src)
sh "wget", src.to_s
end
Long answer:
Part of the goal of this project is to allow that the user has nothing
"as expected" except ruby and maybe rant. As it stands, we build so
many different projects, and the user's machine varies so widely as to
what might get in the way, I completely obliterate the environment on
start up, and I go "fetch" from the web cache the tools that are needed
to accomplish whatever task is required (and these tools have to be
versioned, i.e. java 1.4 and java 1.5, even java 1.3 unfortunately).
This requires being able to execute the tools from the "local cache"
which the user does get to define.
Yes, we could generate a setup that has the tools we need, but then
we'll need a new tool eventually for something, and that'd require
everyone to install... or say, we find a problem with cvsnt.exe we're
using. I can "push out" a new one just by updating the project.yaml
file for cvsnt with a new version and deploy it to the "web cache".
Maven, from what I understand, works out the dependencies without the
user having to download a bunch of stuff themselves. I like this,
especially since it gives the rant developer total control of the build
environment.
Short answer:
No, we don't know if wget.exe (or it's required dlls) live on the PATH.
User's (developers) environments have caused too many problems for me
(us). (Many times I had something build or run just fine on my machine,
but would fail in five different ways on other's machines due to
misconfiguration, tool differences, things in the path ahead of other
things, etc.).
if Env.on_windows?
safe_vars = %w(
ALLUSERSPROFILE APPDATA CLIENTNAME CommonProgramFiles COMPUTERNAME
ComSpec
HOME HOMEDRIVE HOMEPATH LOGONSERVER NUMBER_OF_PROCESSORS OS
PATHEXT PROCESSOR_ARCHITECTURE PROCESSOR_IDENTIFIER PROCESSOR_LEVEL
PROCESSOR_REVISION ProgramFiles PROMPT SESSIONNAME SystemDrive
SystemRoot USERDOMAIN USERNAME USERPROFILE windir
)
ENV.keys.each do |var|
ENV[var] = nil unless safe_vars.include?(var)
end
ENV['PATH'] =
"#{ENV['SystemRoot']}\\system32;#{ENV['SystemRoot']};#{ENV['SystemRoot']}\\System32\\Wbem"
#fix $LOAD_PATH
else
$stderr.puts "set up for unix"
end
Thanks for the info on sh, sp, escape, and lamba. Definitely makes the
code cleaner!
Kevin
Please visit http://www.systemware.com/.
More information about the make-cafe
mailing list