Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Quick and dirty CLI harness #36

Merged
merged 1 commit into from

2 participants

James F McMahon Timo Westkämper
James F McMahon

Timo,

This a real simple CLI harness I threw together for my own purposes. There are better ways to accomplish this, but since this is something scalagen is currently lacking I figured I'd send it back over to you.

Timo Westkämper

Looks nice. Thanks a lot. We can refine it later if needed.

Timo Westkämper timowest merged commit 70670ca into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 23, 2012
  1. James F McMahon
This page is out of date. Refresh to see the latest.
21 scalagen/pom.xml
View
@@ -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>
2  scalagen/scalagen
View
@@ -0,0 +1,2 @@
+#!/usr/bin/env bash
+scala -cp target/dependencies/*:target/classes/ com.mysema.scalagen.Cli $1 $2
36 scalagen/src/main/scala/com/mysema/scalagen/Cli.scala
View
@@ -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)
+ }
+ }
+}
Something went wrong with that request. Please try again.