Search code examples
antrakejruby

In rake how do I call a subdir Rakefile


In ant I'd do the following

 <target name="subclient" >
     <ant antfile="suddir/build.xml" target="target1" useNativeBasedir="true"/>
 </target>

How do I do this sort of thing in JRuby/Rake


Solution

  • You can simply use Dir.chdir and launch a rake subprocess:

    def rake(*args)
      ruby "-S", "rake", *args
    end
    
    task :subrake do
      Dir.chdir("subproject") do
        rake
      end
    end