Incorporate Clintons review comments

This commit is contained in:
Matthew Nesbit 2016-08-08 11:54:41 +01:00
parent 3dc8a95d69
commit 6b23800f02
3 changed files with 36 additions and 24 deletions

View File

@ -24,6 +24,8 @@ buildscript {
}
plugins {
// TODO The capsule plugin requires the newer DSL plugin block.It would be nice if we could unify all the plugins into one style,
// but the DSL has some restrictions e.g can't be used on the allprojects section. So we should revisit this if there are improvements in Gradle.
id "us.kirchmeier.capsule" version "1.0.2"
}
@ -223,22 +225,15 @@ task createStandalone(dependsOn: 'createCapsule') << {
into "${buildDir}/standalone/nodeb"
rename 'generalnodeb.conf', 'node.conf'
}
delete("${buildDir}/standalone/runstandalone")
def myFile = file("${buildDir}/standalone/runstandalone")
def jarName = createCapsule.outputs.getFiles().getSingleFile().getName()
myFile << "#!/usr/bin/env bash\n"
myFile << "set -euo pipefail\n"
myFile << "trap 'kill \$(jobs -p)' SIGINT SIGTERM EXIT\n"
myFile << "export CAPSULE_CACHE_DIR=cache\n"
myFile << "pushd nameserver\n"
myFile << "( java -jar "+ jarName+" )& \n"
myFile << "popd\n"
myFile << "pushd nodea\n"
myFile << "( java -jar "+ jarName+" )& \n"
myFile << "popd\n"
myFile << "pushd nodeb\n"
myFile << "( java -jar "+ jarName+" )& \n"
myFile << "popd\n"
myFile << "read -p 'Any key to exit'\n"
myFile << "kill \$(jobs -p)\n"
delete("${buildDir}/standalone/runstandalone")
def jarName = createCapsule.outputs.getFiles().getSingleFile().getName()
copy {
from "buildSrc/scripts/runstandalone"
filter { String line -> line.replace("JAR_NAME",jarName) }
filter(org.apache.tools.ant.filters.FixCrLfFilter.class, eol:org.apache.tools.ant.filters.FixCrLfFilter.CrLf.newInstance("lf"))
into "${buildDir}/standalone"
}
}

View File

@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail
trap 'kill $(jobs -p)' SIGINT SIGTERM EXIT
export CAPSULE_CACHE_DIR=cache
pushd nameserver
( java -jar JAR_NAME )&
popd
pushd nodea
( java -jar JAR_NAME )&
popd
pushd nodeb
( java -jar JAR_NAME )&
popd
read -p 'Any key to exit'
kill $(jobs -p)

View File

@ -17,6 +17,8 @@ val log = LoggerFactory.getLogger("Main")
object ParamsSpec {
val parser = OptionParser()
// The intent of allowing a command line configurable directory and config path is to allow deployment flexibility.
// Other general configuration should live inside the config file unless we regularly need temporary overrides on the command line
val baseDirectoryArg =
parser.accepts("base-directory", "The directory to put all files under")
.withOptionalArg()
@ -46,7 +48,7 @@ fun main(args: Array<String>) {
}
val appConfig = ConfigFactory.parseFile(configFile)
val cmdlineOverrideMap = HashMap<String, Any?>()
val cmdlineOverrideMap = HashMap<String, Any?>() // If we do require a few other command line overrides eg for a nicer development experience they would go inside this map.
if (cmdlineOptions.has(ParamsSpec.baseDirectoryArg)) {
cmdlineOverrideMap.put("basedir", baseDirectoryPath.toString())
}
@ -59,12 +61,12 @@ fun main(args: Array<String>) {
val dir = conf.basedir.toAbsolutePath().normalize()
logInfo(args, dir)
val dirFile = dir.toFile()
if (!dirFile.exists()) {
dirFile.mkdirs()
}
try {
val dirFile = dir.toFile()
if (!dirFile.exists()) {
dirFile.mkdirs()
}
val node = conf.createNode()
node.start()
try {