lib/rbbt/resource/util.rb in rbbt-util-5.34.4 vs lib/rbbt/resource/util.rb in rbbt-util-5.34.5

- old
+ new

@@ -121,12 +121,12 @@ end end def rake_for(path) - @rake_dirs.reject{|dir, content| - !Misc.common_path(dir, path) + @rake_dirs.select{|dir, content| + Misc.common_path(dir, path) }.sort_by{|dir, content| dir.length }.last end @@ -135,15 +135,20 @@ end def run_rake(path, rakefile, rake_dir) task = Misc.path_relative_to rake_dir, path rakefile = rakefile.produce if rakefile.respond_to? :produce + rakefile = rakefile.find if rakefile.respond_to? :find rake_dir = rake_dir.find(:user) if rake_dir.respond_to? :find begin require 'rbbt/resource/rake' - Rake.run(rakefile, rake_dir, task) + if Proc === rakefile + Rake.run(nil, rake_dir, task, &rakefile) + else + Rake.run(rakefile, rake_dir, task) + end rescue Rake::TaskNotFound raise $! if rake_dir.nil? or rake_dir.empty? or rake_dir == "/" or rake_dir == "./" task = File.join(File.basename(rake_dir), task) rake_dir = File.dirname(rake_dir) retry