[Rake-devel] Rake and directories

Kim Toms kim.toms at gmail.com
Wed May 2 10:23:17 EDT 2007

I was trying to create some rake tasks to compile some software in a
directory other than where the rakefile was located.  At first I tried:

    Dir.chdir('lib/mc_sim') {
>       file 'Makefile' => 'extconf.rb' do |t|
>         sh 'ruby extconf.rb'
>       end
>       task :build_simulator => ['Makefile', :environment] do
>         sh 'make install'
>       end
>     }

 However, the Dir.chdir didn't seem to work right.  So, I changed it to be:

    file 'lib/mc_sim/Makefile' => 'lib/mc_sim/extconf.rb' do |t|
>       Dir.chdir('lib/mc_sim') { sh 'ruby extconf.rb' }
>     end
>     task :build_simulator => ['lib/mc_sim/Makefile', :environment] do
>       Dir.chdir('lib/mc_sim') { sh 'make install' }
>     end

Is there a better (i.e. less verbose) way to do this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rake-devel/attachments/20070502/7cfeb689/attachment.html 

More information about the Rake-devel mailing list