I want to be able to create a rakefile on Windows 7 that I can call with the rake -g <taskname> or rake --system <taskname> command. Where do I save the rakefile? I’ve tried creating a Rake directory under my user directory (c:\users\me\rake), but when I call rake -g hello_world, rake errors out saying it doesn’t know how to build the :hello_world task, which makes me think it just can’t see the rakefile. Here’s what my global rakefile looks like:
require 'rake'
desc "a hello world task"
task :hello_world do
puts "hello from your global rakefile"
end
Figured it out – turns out Rake expects global rakefiles to end in a “.rake” extension. I changed the example above to this:
And saved it as “testing.rake” in my c:\users\me\rake\ directory. I opened up a command prompt to a random directory and ran “rake -g hello_world” and got this output: