Skip to content
This repository

Quick and dirty CLI harness #36

Merged
merged 1 commit into from about 2 years ago

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
Timo Westkämper timowest closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Jun 23, 2012
James F McMahon JamesMcMahon Quick and dirty CLI harness f1a26d5
This page is out of date. Refresh to see the latest.
21 scalagen/pom.xml
@@ -179,6 +179,27 @@
179 179 <argLine>-Xms256m -Xmx512m</argLine>
180 180 </configuration>
181 181 </plugin>
  182 +
  183 + <!-- Dependencies needed to run command line jar -->
  184 + <plugin>
  185 + <groupId>org.apache.maven.plugins</groupId>
  186 + <artifactId>maven-dependency-plugin</artifactId>
  187 + <executions>
  188 + <execution>
  189 + <id>copy-dependencies</id>
  190 + <phase>package</phase>
  191 + <goals>
  192 + <goal>copy-dependencies</goal>
  193 + </goals>
  194 + <configuration>
  195 + <includeScope>runtime</includeScope>
  196 + <overWriteIfNewer>true</overWriteIfNewer>
  197 + <overWriteSnapshots>true</overWriteSnapshots>
  198 + <outputDirectory>${basedir}/target/dependencies</outputDirectory>
  199 + </configuration>
  200 + </execution>
  201 + </executions>
  202 + </plugin>
182 203 </plugins>
183 204 </build>
184 205
2  scalagen/scalagen
... ... @@ -0,0 +1,2 @@
  1 +#!/usr/bin/env bash
  2 +scala -cp target/dependencies/*:target/classes/ com.mysema.scalagen.Cli $1 $2
36 scalagen/src/main/scala/com/mysema/scalagen/Cli.scala
... ... @@ -0,0 +1,36 @@
  1 +/*
  2 + * Copyright (C) 2011, James McMahon
  3 + *
  4 + * This library is free software; you can redistribute it and/or
  5 + * modify it under the terms of the GNU Lesser General Public
  6 + * License as published by the Free Software Foundation; either
  7 + * version 2.1 of the License, or (at your option) any later version.
  8 + *
  9 + * This library is distributed in the hope that it will be useful,
  10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12 + * Lesser General Public License for more details.
  13 + */
  14 +package com.mysema.scalagen
  15 +
  16 +import java.io.File
  17 +
  18 +/**
  19 + * Simple harness to facilitate running scalagen from the command line
  20 + */
  21 +object Cli {
  22 + val usage = "USAGE: scalagen <src-directory> <target-directory>"
  23 +
  24 + def main(args: Array[String]) {
  25 + if (args.length != 2) {
  26 + println(usage)
  27 + return
  28 + }
  29 +
  30 + val in = new File(args(0))
  31 + if (in.exists) {
  32 + val out = new File(args(1))
  33 + Converter.instance.convert(in, out)
  34 + }
  35 + }
  36 +}

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.