<project name="Cucumber Demo" default="cucumber" basedir=".">
  <target name ="compile" description="Compile classes">
    <mkdir dir="build" />
    <javac srcdir="src" destdir="build" />
  </target>

  <target name="cucumber" depends="compile" description="Run Cucumber">
    <property environment="ENV" />
    <fail unless="ENV.JRUBY_HOME">
      (::) ERROR (::)
      Define JRUBY_HOME in your shell. For example:
      
      export JRUBY_HOME=/usr/local/jruby
      set JRUBY_HOME=C:\jruby
    </fail>
    <java classname="org.jruby.Main" fork="true" failonerror="true">
      <classpath>
        <pathelement path="${ENV.JRUBY_HOME}/lib/jruby.jar"/>
        <pathelement path="build"/>
      </classpath>
      <jvmarg value="-Djruby.home=${ENV.JRUBY_HOME}"/>
      <arg value="-S"/>
      <arg value="cucumber"/>
      <arg value="--format"/>
      <arg value="pretty"/>
      <arg value="--format"/>
      <arg value="junit"/>
      <arg value="--out"/>
      <arg value="build"/>
      <arg value="features"/>
    </java>
  </target>
</project>