[Rake-devel] ~/.rake file?
Daniel.Berger at qwest.com
Fri Aug 15 11:54:46 EDT 2008
> -----Original Message-----
> From: rake-devel-bounces at rubyforge.org
> [mailto:rake-devel-bounces at rubyforge.org] On Behalf Of Adam Salter
> Sent: Friday, August 15, 2008 12:39 AM
> To: Rake Development and Discussion
> Subject: Re: [Rake-devel] ~/.rake file?
> Dear all,
> I have created a issue for this, with associated comments and patch:
> It basically just needs:
> a) Windows testing.
> >> If home is not defined, then should be HOMEDRIVE + HOMEPATH :-) If
> >> there is not HOMEDRIVE+HOMEPATH, that mean is not a user, but a
> >> service, then it should look for APPDATA.
Actually ENV['APPDATA'] will return the value of whatever user the
service is setup to run as. It just so happens for the LocalSystem
account, it's nil. (I'm not sure what environment variables are set for
the LocalSystem account off the top of my head).
> >> If no APPDATA there, it should look for ALLUSERSPROFILE
I prefer File.join(ENV['APPDATA'], 'Rake'), but it's up to you. This is
how and where software like Adobe, Subversion, and Firefox put
application specific data.
Here's a way to get the app data directory programmatically if you ever
CSIDL_APPDATA = 0x001A
SHGetFolderPath = Win32API.new('shell32', 'SHGetFolderPath', 'LLLLP',
buf = 0.chr * 260
if SHGetFolderPath.call(0, CSIDL_APPDATA, 0, 1, buf) == 0
puts "The app data directory is: " + buf.strip
puts "Unable to find value"
This approach reads from the registry instead of using environment data.
Note that when run from a service, it returns
C:\WINNT\system32\config\systemprofile\Application Data, which I guess
is the appdata directory for the LocalSystem account - the default
account for Windows services. Note that you can run a service under a
different account, in which case you'll get the appdata directory for
that account instead.
> >>> (4) Include tests for all changes. I am much more likely
> to accept
> >>> patches with tests than otherwise.
> >>> Also, I'm planning on putting a git repository of rake on
> github in
> >>> the very
> >>> near future (meant to do it this weekend but ran out of time).
> >>> That should
> >>> make it easier for alternate versions. I'll put an announcement
> >>> here when I do.
> >> Great news!
> >> I'll be able to fork and make all the tests for rake
> actual pass on
> >> Windows and see what other cross-platform bug we found in
> ruby itself
> >> to catch! :-)
Don't do this:
PLATFORM =~ /win32/
First, PLATFORM is deprecated instead of RUBY_PLATFORM. But, with the
advent of alternative implementations like Jruby and IronRuby,
RUBY_PLATFORM is no longer a wise approach. Jruby, for example, will
return 'java' for the RUBY_PLATFORM, even if you're on Windows.
Use rbconfig + host_os instead:
if Config::CONFIG['host_os'] =~ /mswin/I
PS - I'll post this to the ticket once (if?) my Redmine account has been
This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly
prohibited and may be unlawful. If you have received this communication
in error, please immediately notify the sender by reply e-mail and destroy
all copies of the communication and any attachments.
More information about the Rake-devel