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?
_______________________________________________
Rake-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rake-devel

Reply via email to