[Rake-devel] rule does not look for every source

Emanuel Indermühle e.i at bluewin.ch
Wed Aug 8 06:44:00 EDT 2007


Hello 

I tried to make a Rakefile to generate pdf from latex sources:

---------------------Rakefile--------------------
$file = "latexproject"

rule ".aux" => [".tex"] do | t |
    sh "latex #{t.name.chomp(".aux")}"
end

rule ".toc" => [".aux"]

rule ".dvi" => [".toc",".blg",".bbl"] do | t |
    sh "latex #{t.name.chomp(".dvi")}"
end

rule ".bbl" => [".aux",".bib"] do | t |
    sh "bibtex #{t.name.chomp(".bbl")}"
end

rule ".blg" => [".bbl"]

rule ".pdf" => [".dvi"] do | t |
    sh "pdflatex #{t.name.chomp(".pdf")}"
end

task :pdf => [$file+".pdf"]
---------------------end rakefile---------------

It seams that for generating ".dvi" rake only seems to need ".toc" but
not the other sources.

-------------------console output----------------

emanuel at laptop$ rake  -n  pdf
/usr/bin/rake:17:Warning: require_gem is obsolete.  Use gem instead.
(in /home/emanuel/office/Hilfsassistenz1/sub-and-optimal-GM)
** Invoke pdf (first_time)
** Invoke optimal_and_suboptimal_gm.pdf (first_time)
** Invoke optimal_and_suboptimal_gm.dvi (first_time)
** Invoke optimal_and_suboptimal_gm.toc (first_time)
** Invoke optimal_and_suboptimal_gm.aux (first_time)
** Invoke optimal_and_suboptimal_gm.tex (first_time, not_needed)
** Execute (dry run) optimal_and_suboptimal_gm.aux
** Execute (dry run) optimal_and_suboptimal_gm.toc
** Execute (dry run) optimal_and_suboptimal_gm.dvi
** Execute (dry run) optimal_and_suboptimal_gm.pdf
** Execute (dry run) pdf

----------------------end console output----------

I think there is a bug in the rake.rb file on line 1592 of the rake
version 0.7.3

------------------rake.rb:1592------------------
prereqs = sources.collect { |source|
  if File.exist?(source) || Rake::Task.task_defined?(source)
    source
  elsif parent = enhance_with_matching_rule(sources.first, level+1) <---
    parent.name
  else
    return nil
  end
}
------------------end rake.rb:1592-----------------

it think it should be

------------------rake.rb.patched:1592------------------
prereqs = sources.collect { |source|
  if File.exist?(source) || Rake::Task.task_defined?(source)
    source
  elsif parent = enhance_with_matching_rule(source, level+1) <---
    parent.name
  else
    return nil
  end
}
------------------end rake.rb.patched:1592-----------------

It worked for me with this patch

best regards 

emanuel



More information about the Rake-devel mailing list