Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick and dirty CLI harness #36

Merged
merged 1 commit into from
Jun 23, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions scalagen/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
2 changes: 2 additions & 0 deletions scalagen/scalagen
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
scala -cp target/dependencies/*:target/classes/ com.mysema.scalagen.Cli $1 $2
36 changes: 36 additions & 0 deletions scalagen/src/main/scala/com/mysema/scalagen/Cli.scala
Original file line number Diff line number Diff line change
@@ -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)
}
}
}