Example 2

Copy every entity in the directory d that matches the glob pattern *.jar to the lib directory, using a closure.

Groovy

import org.entityfs.util.* import org.schmant.task.meta.ForEachSourceTF new ForEachSourceTF(). addSources(Directories.getAllFilesMatching(d, "*.jar")). // Note the curly braces. They make the statement a closure. setTaskFactory{ cParam -> Entities.copy(cParam.source, lib) }.run()

JavaScript

new ForEachSourceTF(). addSources(Directories.getAllFilesMatching(d, "*.jar")). setTaskFactory(function(cParam) { Entities.copy(cParam.getSource(), lib) }).run();

JRuby

Schmant::ForEachSourceTF.new. addSources(Schmant::Directories.getAllFilesMatching($d, "*.jar")). setTaskFactory( Proc.new { |cParam| Schmant::Entities.copy(cParam.getSource(), $lib) } ).run


* An EntityFS-aware task is implemented using EntityFS. This means that it uses the filter settings of DirectoryView:s and also that it often can work with other file system implementations than File-based, such as the RAM file system.