views:

61

answers:

2

I like the rake task structure and rake utilities.. I want to create a script that can do many things, and rake seems the logical choice.
I want to know how can I make it look like a regular script:

./myscript.rb cake:bake

as opposed to

rake -f myscript.rb cake:bake

any idea? Of course, rake must still be installed etc.. simply to make it easier to use...

+4  A: 

myscript.rb:

#!/usr/bin/ruby

require 'rubygems'
require 'rake'

namespace :cake do
  task :bake do
    puts "Baking cake..."
  end
end

Rake::Task[ARGV.first].execute

Then on the command line:

chmod +x myscript.rb
./myscript.rb cake:bake
Leventix
A: 

I found this for cygwin / windows

http://errtheblog.com/posts/60-sake-bomb

removes the dependency on rails and let's you have rake tasks installed and available globally

jonezy