Skip to content

Commit

Permalink
Added standalone script for Groovy
Browse files Browse the repository at this point in the history
  • Loading branch information
aslakhellesoy committed Jan 2, 2012
1 parent 015f73e commit 2ad198a
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 93 deletions.
6 changes: 5 additions & 1 deletion core/src/main/java/cucumber/io/FileResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ public FileResource(File root, File file) {

@Override
public String getPath() {
return file.getAbsolutePath().substring(root.getAbsolutePath().length() + 1);
if(file.equals(root)) {
return file.getAbsolutePath();
} else {
return file.getAbsolutePath().substring(root.getAbsolutePath().length() + 1);
}
}

@Override
Expand Down
158 changes: 68 additions & 90 deletions cucumber-jvm.ipr

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions groovy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## Running from the Command Line Interface (CLI)

groovy bin/cucumber-jvm.groovy --glue src/test/resources src/test/resources/cucumber/runtime/groovy/a_feature.feature

This demonstrates that the files in the bin directory (`cucumber-jvm.groovy` and `cucumber-groovy-full.jar` are a completely standalone
execution environment. TODO: Figure out the best way to package and publish this as a "groovy package"
1 change: 1 addition & 0 deletions groovy/bin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cucumber-groovy-full.jar
3 changes: 3 additions & 0 deletions groovy/bin/cucumber-jvm.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
scriptDir = new File(getClass().protectionDomain.codeSource.location.path).getParent();
this.class.classLoader.rootLoader.addURL(new File(scriptDir, "cucumber-groovy-full.jar").toURL())
this.class.classLoader.loadClass("cucumber.cli.Main").main(args)
19 changes: 19 additions & 0 deletions groovy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,25 @@
</includes>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>package</phase>
<configuration>
<tasks>
<copy file="${project.build.directory}/${project.build.finalName}-full.jar" tofile="${basedir}/bin/cucumber-groovy-full.jar" failonerror="true" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
2 changes: 1 addition & 1 deletion jruby/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<phase>package</phase>
<configuration>
<tasks>
<copy file="${project.build.directory}/${project.build.finalName}-full.jar" tofile="${basedir}/lib/cucumber-jruby-full.jar" failonerror="false" />
<copy file="${project.build.directory}/${project.build.finalName}-full.jar" tofile="${basedir}/lib/cucumber-jruby-full.jar" failonerror="true" />
</tasks>
</configuration>
<goals>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.0.0-beta-1</version>
<version>2.0.0-beta-2</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
Expand Down

0 comments on commit 2ad198a

Please sign in to comment.