Provides useful extensions for Rake.

Methods
Public Instance methods
subdir(dir, &block)

Allows one to define Rake rules in the context of the given subdirectory. For example,

 subdir 'foo' do
    file 'libfoo.so' => ['foo.c'] do
       sh 'gcc foo.c -shared -fPIC -o libfoo.so'
    end
 end

 subdir 'bar' do
    file 'bar' => ['bar.c', '../foo/libfoo.so'] do
        sh 'gcc bar.c -o bar -L../foo -lfoo'
    end
 end

is equivalent to:

 file 'foo/libfoo.so' => ['foo/foo.c'] do
    Dir.chdir('foo') do
       sh 'gcc foo.c -shared -fPIC -o libfoo.so'
    end
 end

 file 'bar/bar' => ['bar/bar.c', 'foo/libfoo.so'] do
     Dir.chdir('bar') do
        sh 'gcc bar.c -o bar -L../foo -lfoo'
     end
 end

String dependencies are assumed to be filenames

But be careful with string dependencies. They are assumed to be filenames, and will be automatically converted. For example:

 subdir 'foo' do
    task 'super_app' => ['super_app:compile', 'super_app:unit_test']

    task 'super_app:compile' do
       ...
    end

    task 'super_app:unit_test' do
       ...
    end
 end

will be treated like:

 subdir 'foo' do
    # !!!!!!!
    task 'super_app' => ['foo/super_app:compile', 'foo/super_app:unit_test']

    task 'super_app:compile' do
       ...
    end

    task 'super_app:unit_test' do
       ...
    end
 end

To solve this, declare your dependencies as symbols:

 task 'super_app' => [:'super_app:compile', :'super_app:unit_test']

(note the leading ’:’ character)

Supported Rake commands

Only the file and target Rake commands are supported.

    # File lib/rake/extensions.rb, line 92
92: def subdir(dir, &block)
93:         subdir = Subdir.new(dir)
94:         Dir.chdir(dir) do
95:                 subdir.instance_eval(&block)
96:         end
97: end