From: James Edward Gray II Date: 2007-01-16T23:45:03+09:00 Subject: Re: Q: How can a Rake task know the caller's directory? On Jan 15, 2007, at 9:57 PM, Trans wrote: > > Jim Weirich wrote: >> James Britt wrote: >>> Trans wrote: >>>>> $ r com This is my log message >>>> >>>> how are you accessing "This is my log message" in your task? >>> >>> ARGV.shift # remove the task name >>> ARGV.join( ' ') # Get everything else on the command line >>> >>> Sadly, rake still thinks that there are more tasks on the command >>> line; >>> even calling ARGV.clear doesn't help. >>> >>> (I looked for the command to flush the Rake task call queue, but >>> couldn't find it, so I live with the error it raises at the end. : >>> ( ) >> >> You could do: >> >> rake com MSG="This is my log message" >> >> Inside of your Rakefile, ENV['MSG'] will contain your log message. >> >> Sadly, more typing that what you have, but it works with rake >> instead of >> against it. > > why did you choose to use environment vars here. isn't that sort of > like using globals? also, these don't work in my case becuase i can't > differentiate the env vars set by rake from the "real" env vars. Sure you can. Just introduce a little pragmatic namespacing: rake com RAKE_MSG="This is my log message" James Edward Gray II