Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Quick and dirty CLI harness

  • Loading branch information...
commit f1a26d524b39527e5aa98e537530e8568e609100 1 parent 67432d3
@JamesMcMahon JamesMcMahon authored
View
21 scalagen/pom.xml
@@ -179,6 +179,27 @@
<argLine>-Xms256m -Xmx512m</argLine>
</configuration>
</plugin>
+
+ <!-- Dependencies needed to run command line jar -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <phase>package</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <includeScope>runtime</includeScope>
+ <overWriteIfNewer>true</overWriteIfNewer>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ <outputDirectory>${basedir}/target/dependencies</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
View
2  scalagen/scalagen
@@ -0,0 +1,2 @@
+#!/usr/bin/env bash
+scala -cp target/dependencies/*:target/classes/ com.mysema.scalagen.Cli $1 $2
View
36 scalagen/src/main/scala/com/mysema/scalagen/Cli.scala
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2011, James McMahon
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ */
+package com.mysema.scalagen
+
+import java.io.File
+
+/**
+ * Simple harness to facilitate running scalagen from the command line
+ */
+object Cli {
+ val usage = "USAGE: scalagen <src-directory> <target-directory>"
+
+ def main(args: Array[String]) {
+ if (args.length != 2) {
+ println(usage)
+ return
+ }
+
+ val in = new File(args(0))
+ if (in.exists) {
+ val out = new File(args(1))
+ Converter.instance.convert(in, out)
+ }
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.