diff --git a/docs/manual/OptionalTasks/script.html b/docs/manual/OptionalTasks/script.html index 965433ff0..36f42b621 100644 --- a/docs/manual/OptionalTasks/script.html +++ b/docs/manual/OptionalTasks/script.html @@ -1,7 +1,7 @@
- +name
or
valid Java identifiers, that is).
The name "project" is a pre-defined reference to the Project, which can be
used instead of the project name. The name "self" is a pre-defined reference to the actual
-<script>-Task instance.<property name="message" value="Hello world"/> @@ -71,6 +71,10 @@ The following snippet shows use of four different languages: println 'message is ', message </script> + <script language="ruby"> + print 'message is ', $message, "\n" + </script> + <script language="jython"> print "message is %s" % message </script> @@ -80,6 +84,31 @@ print "message is %s" % message Note that for the jython example, the script contents must start on the first column. ++ The following script shows a little more complicted jruby example: +
+++<script language="ruby"> + xmlfiles = Dir.new(".").entries.delete_if { |i| ! (i =~ /\.xml$/) } + xmlfiles.sort.each { |i| $self.log(i) } +</script> +++ Note that due to a limitation in the current version of jruby (0.7.0), + $project.log("Hello World") does not work (most likely because there are + two log methods on Project), this is fixed in the current CVS version of jruby. +
++ The same example in groovy is: +
++<script language="groovy"> + xmlfiles = new java.io.File(".").listFiles().findAll{ it =~ "\.xml$"} + xmlfiles.sort().each { self.log(it.toString())} +</script> ++The following script uses javascript to create a number of echo tasks and execute them.