Commits

Sam Adams committed be5eb4b

Added cli scripts

Comments (0)

Files changed (5)

         </repository>
     </repositories>
 
+    <build>
+
+        <plugins>
+
+            <plugin>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <configuration>
+                    <descriptors>
+                        <descriptor>src/main/assembly/bin-dist.xml</descriptor>
+                    </descriptors>
+                    <appendAssemblyId>false</appendAssemblyId>
+                    <attach>false</attach>
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <phase>package</phase>
+                    </execution>
+                </executions>
+            </plugin>
+
+        </plugins>
+    </build>
+
 </project>

src/main/assembly/bin-dist.xml

+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+
+    <id>bin-dist</id>
+
+    <formats>
+        <format>tar.gz</format>
+        <format>zip</format>
+    </formats>
+
+    <baseDirectory>quixote-client-${project.version}</baseDirectory>
+
+    <fileSets>
+
+        <fileSet>
+            <includes>
+                <include>README*</include>
+                <include>LICENSE*</include>
+                <include>NOTICE*</include>
+            </includes>
+        </fileSet>
+
+        <fileSet>
+            <directory>src/main/bin</directory>
+            <includes>
+                <include>qc.bat</include>
+            </includes>
+            <outputDirectory>bin</outputDirectory>
+            <filtered>true</filtered>
+            <lineEnding>dos</lineEnding>
+        </fileSet>
+
+        <fileSet>
+            <directory>src/main/bin</directory>
+            <includes>
+                <include>qc.sh</include>
+            </includes>
+            <outputDirectory>bin</outputDirectory>
+            <filtered>true</filtered>
+            <lineEnding>unix</lineEnding>
+            <fileMode>0755</fileMode>
+        </fileSet>
+
+        <fileSet>
+            <directory>src/main/conf</directory>
+            <outputDirectory>conf</outputDirectory>
+        </fileSet>
+
+    </fileSets>
+
+    <dependencySets>
+        <dependencySet>
+            <useProjectArtifact>true</useProjectArtifact>
+            <outputDirectory>lib</outputDirectory>
+        </dependencySet>
+    </dependencySets>
+
+</assembly>

src/main/bin/qc.bat

+@REM Chempound Client CLI Start-up File
+@REM Copyright (c) Sam Adams 2011
+@REM Inspired by Apache Maven Project
+
+@REM Required ENV vars:
+@REM JAVA_HOME - location of a JDK home dir
+
+@echo off
+@setLocal
+
+set ERROR_CODE=0
+
+@REM ==== CHECK JAVA_HOME ====
+if not "%JAVA_HOME%" == "" goto OkJHome
+echo.
+echo ERROR: JAVA_HOME not found in your environment.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation
+echo.
+goto error
+
+:OkJHome
+@REM ==== CHECK java.exe ====
+if exist "%JAVA_HOME%\bin\java.exe" goto OkJavaExe
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory.
+echo JAVA_HOME = "%JAVA_HOME%"
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation
+echo.
+goto error
+
+:OkJavaExe
+if not "%CPCLIENT_HOME%" == "" goto StripCpClientHome
+@REM ==== Find Chempound Client installation ====
+set "CPCLIENT_HOME=%~dp0.."
+goto CheckCpClientHome
+
+:StripCpClientHome
+@REM ==== Strip trailing slash ====
+if not "_%CPCLIENT_HOME:~-1%"=="_\" goto CheckCpClientHome
+set "CPCLIENT_HOME=%CPCLIENT_HOME:~0,-1%"
+goto StripLCpClientHome
+
+
+:CheckCpClientHome
+@REM ==== CHECK CPCLIENT_HOME ====
+if exist "%CPCLIENT_HOME%\bin\qc.bat" goto CheckCpClientOpts
+echo.
+echo ERROR: CPCLIENT_HOME is set to an invalid directory.
+echo CPCLIENT_HOME = "%CPCLIENT_HOME%"
+echo Please set the CPCLIENT_HOME variable in your environment to match the
+echo location of the Chempound Client installation
+echo.
+goto error
+
+
+:CheckCpClientOpts
+if not "%CPCLIENT_OPTS%" == "" goto init
+set "CPCLIENT_OPTS=-Xmx128m"
+
+:init
+"%JAVA_HOME%/bin/java" %CPCLIENT_OPTS% -classpath "%CPCLIENT_HOME%\lib\*" -Dcpclient.home="%CPCLIENT_HOME%" -Dlog4j.configuration=qc-log4j.properties uk.ac.cam.ch.wwmm.quixote.client.QuixoteClientCLI %*
+
+if ERRORLEVEL 1 goto error
+goto exit
+
+
+:error
+SET ERROR_CODE=1
+goto exit
+
+:exit
+@endlocal
+cmd /C exit /B %ERROR_CODE%

src/main/bin/qc.sh

+#!/bin/sh
+# Chempound Client CLI Start-up File
+# Copyright (c) Sam Adams 2011
+# Inspired by Apache Maven Project
+
+# Required ENV vars:
+# JAVA_HOME - location of a JDK home dir
+
+if [ -z "$JAVA_HOME" ] ; then
+  echo "Warning: JAVA_HOME environment variable is not set."
+fi
+
+
+if [ -z "$CPCLIENT_HOME" ] ; then
+  ## resolve links - $0 may be a link to Chempound Client's home
+  PRG="$0"
+
+  # need this for relative symlinks
+  while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+      PRG="$link"
+    else
+      PRG="`dirname "$PRG"`/$link"
+    fi
+  done
+
+  saveddir=`pwd`
+
+  CPCLIENT_HOME=`dirname "$PRG"`/..
+
+  # make it fully qualified
+  CPCLIENT_HOME=`cd "$CPCLIENT_HOME" && pwd`
+
+  cd "$saveddir"
+fi
+
+exec "$JAVA_HOME/bin/java" \
+  $CPCLIENT_OPTS \
+  -classpath "$CPCLIENT_HOME/lib/*" \
+  -Dcpclient.home="$CPCLIENT_HOME" \
+  -Dlog4j.configuration=qc-log4j.properties \
+  uk.ac.cam.ch.wwmm.quixote.client.QuixoteClientCLI $*

src/main/resources/qc-log4j.properties

+log4j.rootLogger = WARN, A
+
+log4j.appender.A = org.apache.log4j.ConsoleAppender
+log4j.appender.A.layout = org.apache.log4j.PatternLayout
+log4j.appender.A.layout.ConversionPattern = %-4r [%t] %-5p %c %x - %m%n
+log4j.appender.A.target = System.err