From 0823f73c0d6f9f8e45e45c92a7438c241e79ee27 Mon Sep 17 00:00:00 2001 From: "adrian.f.cole" Date: Mon, 30 Nov 2009 00:59:52 +0000 Subject: [PATCH] Issue 126: renamed to scriptbuilder git-svn-id: http://jclouds.googlecode.com/svn/trunk@2346 3d8758e0-26b5-11de-8745-db77d3ebf521 --- .../src/test/resources/test_script_funcs.cmd | 27 ------------------- pom.xml | 2 +- {initbuilder => scriptbuilder}/pom.xml | 6 ++--- .../jclouds/scriptbuilder}/EnvBuilder.java | 8 +++--- .../jclouds/scriptbuilder/ScriptBuilder.java | 18 ++++++------- .../scriptbuilder}/domain/InitMetadata.java | 2 +- .../domain/JavaInitMetadata.java | 2 +- .../scriptbuilder}/domain/OsFamily.java | 2 +- .../scriptbuilder}/domain/ShellToken.java | 2 +- .../domain/StoppableJavaInitMetadata.java | 2 +- .../jclouds/scriptbuilder}/util/Utils.java | 6 ++--- .../scriptbuilder}/EnvBuilderTest.java | 7 ++--- .../scriptbuilder/ScriptBuilderTest.java | 23 ++++++++-------- .../scriptbuilder}/domain/ShellTokenTest.java | 6 +++-- .../scriptbuilder}/util/UtilsTest.java | 7 ++--- .../src/test/resources/forget.cmd | 0 .../src/test/resources/test_env.bash | 0 .../src/test/resources/test_env.cmd | 0 .../src/test/resources/test_script.bash | 0 .../src/test/resources/test_script.cmd | 0 .../src/test/resources/test_script_funcs.cmd | 27 +++++++++++++++++++ 21 files changed, 76 insertions(+), 71 deletions(-) delete mode 100644 initbuilder/src/test/resources/test_script_funcs.cmd rename {initbuilder => scriptbuilder}/pom.xml (92%) rename {initbuilder/src/main/java/org/jclouds/initbuilder => scriptbuilder/src/main/java/org/jclouds/scriptbuilder}/EnvBuilder.java (94%) rename initbuilder/src/main/java/org/jclouds/initbuilder/InitBuilder.java => scriptbuilder/src/main/java/org/jclouds/scriptbuilder/ScriptBuilder.java (90%) rename {initbuilder/src/main/java/org/jclouds/initbuilder => scriptbuilder/src/main/java/org/jclouds/scriptbuilder}/domain/InitMetadata.java (98%) rename {initbuilder/src/main/java/org/jclouds/initbuilder => scriptbuilder/src/main/java/org/jclouds/scriptbuilder}/domain/JavaInitMetadata.java (98%) rename {initbuilder/src/main/java/org/jclouds/initbuilder => scriptbuilder/src/main/java/org/jclouds/scriptbuilder}/domain/OsFamily.java (96%) rename {initbuilder/src/main/java/org/jclouds/initbuilder => scriptbuilder/src/main/java/org/jclouds/scriptbuilder}/domain/ShellToken.java (99%) rename {initbuilder/src/main/java/org/jclouds/initbuilder => scriptbuilder/src/main/java/org/jclouds/scriptbuilder}/domain/StoppableJavaInitMetadata.java (98%) rename {initbuilder/src/main/java/org/jclouds/initbuilder => scriptbuilder/src/main/java/org/jclouds/scriptbuilder}/util/Utils.java (98%) rename {initbuilder/src/test/java/org/jclouds/initbuilder => scriptbuilder/src/test/java/org/jclouds/scriptbuilder}/EnvBuilderTest.java (90%) rename initbuilder/src/test/java/org/jclouds/initbuilder/InitBuilderTest.java => scriptbuilder/src/test/java/org/jclouds/scriptbuilder/ScriptBuilderTest.java (76%) rename {initbuilder/src/test/java/org/jclouds/initbuilder => scriptbuilder/src/test/java/org/jclouds/scriptbuilder}/domain/ShellTokenTest.java (91%) rename {initbuilder/src/test/java/org/jclouds/initbuilder => scriptbuilder/src/test/java/org/jclouds/scriptbuilder}/util/UtilsTest.java (94%) rename {initbuilder => scriptbuilder}/src/test/resources/forget.cmd (100%) rename {initbuilder => scriptbuilder}/src/test/resources/test_env.bash (100%) rename {initbuilder => scriptbuilder}/src/test/resources/test_env.cmd (100%) rename {initbuilder => scriptbuilder}/src/test/resources/test_script.bash (100%) rename {initbuilder => scriptbuilder}/src/test/resources/test_script.cmd (100%) create mode 100644 scriptbuilder/src/test/resources/test_script_funcs.cmd diff --git a/initbuilder/src/test/resources/test_script_funcs.cmd b/initbuilder/src/test/resources/test_script_funcs.cmd deleted file mode 100644 index bac705f36d..0000000000 --- a/initbuilder/src/test/resources/test_script_funcs.cmd +++ /dev/null @@ -1,27 +0,0 @@ -@echo off - -goto END_FUNCTIONS -:ABORT_SUB - echo Aborting: %EXCEPTION%. - exit /b 1 - -:SOURCE_ENV - set ENV_FILE=%1 - shift - if not defined ENV_FILE ( - set EXCEPTION=Internal error. Called SOURCE_ENV with no file param - exit /b 1 - ) - call %SETTINGS_FILE% - if errorlevel 1 ( - set EXCEPTION=Please end your '%SETTINGS_FILE%' file with the command 'exit /b 0' to enable this script to detect syntax errors. - exit /b 1 - ) - exit /b 0 - -:END_FUNCTIONS - -if exist "%APPENV_SETTINGS_FILE%" ( - call :SOURCE_SF "%APPENV_SETTINGS_FILE%" - if errorlevel 1 goto ABORT_SUB -) diff --git a/pom.xml b/pom.xml index e5e1681523..4f4725a813 100644 --- a/pom.xml +++ b/pom.xml @@ -49,7 +49,7 @@ vcloud twitter rimuhosting - initbuilder + scriptbuilder diff --git a/initbuilder/pom.xml b/scriptbuilder/pom.xml similarity index 92% rename from initbuilder/pom.xml rename to scriptbuilder/pom.xml index f2219f1bb2..e2e909d695 100644 --- a/initbuilder/pom.xml +++ b/scriptbuilder/pom.xml @@ -29,10 +29,10 @@ ../project/pom.xml 4.0.0 - jclouds-initbuilder - jclouds init builder + jclouds-scriptbuilder + jclouds script builder jar - creates init scripts that can be used to manage services + creates scripts that can be used to manage services diff --git a/initbuilder/src/main/java/org/jclouds/initbuilder/EnvBuilder.java b/scriptbuilder/src/main/java/org/jclouds/scriptbuilder/EnvBuilder.java similarity index 94% rename from initbuilder/src/main/java/org/jclouds/initbuilder/EnvBuilder.java rename to scriptbuilder/src/main/java/org/jclouds/scriptbuilder/EnvBuilder.java index ac5298963d..e9965a18dd 100644 --- a/initbuilder/src/main/java/org/jclouds/initbuilder/EnvBuilder.java +++ b/scriptbuilder/src/main/java/org/jclouds/scriptbuilder/EnvBuilder.java @@ -21,15 +21,15 @@ * under the License. * ==================================================================== */ -package org.jclouds.initbuilder; +package org.jclouds.scriptbuilder; import static com.google.common.base.Preconditions.checkNotNull; import java.util.Map; -import org.jclouds.initbuilder.domain.OsFamily; -import org.jclouds.initbuilder.domain.ShellToken; -import org.jclouds.initbuilder.util.Utils; +import org.jclouds.scriptbuilder.domain.OsFamily; +import org.jclouds.scriptbuilder.domain.ShellToken; +import org.jclouds.scriptbuilder.util.Utils; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableMap; diff --git a/initbuilder/src/main/java/org/jclouds/initbuilder/InitBuilder.java b/scriptbuilder/src/main/java/org/jclouds/scriptbuilder/ScriptBuilder.java similarity index 90% rename from initbuilder/src/main/java/org/jclouds/initbuilder/InitBuilder.java rename to scriptbuilder/src/main/java/org/jclouds/scriptbuilder/ScriptBuilder.java index 89d7e88d32..a92a4708f8 100644 --- a/initbuilder/src/main/java/org/jclouds/initbuilder/InitBuilder.java +++ b/scriptbuilder/src/main/java/org/jclouds/scriptbuilder/ScriptBuilder.java @@ -21,7 +21,7 @@ * under the License. * ==================================================================== */ -package org.jclouds.initbuilder; +package org.jclouds.scriptbuilder; import static com.google.common.base.Preconditions.checkNotNull; @@ -29,9 +29,9 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; -import org.jclouds.initbuilder.domain.OsFamily; -import org.jclouds.initbuilder.domain.ShellToken; -import org.jclouds.initbuilder.util.Utils; +import org.jclouds.scriptbuilder.domain.OsFamily; +import org.jclouds.scriptbuilder.domain.ShellToken; +import org.jclouds.scriptbuilder.util.Utils; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Function; @@ -40,11 +40,11 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; /** - * Creates a start script. + * Creates a shell script. * * @author Adrian Cole */ -public class InitBuilder { +public class ScriptBuilder { @VisibleForTesting Map> switchExec = Maps.newHashMap(); @@ -74,7 +74,7 @@ public class InitBuilder { * - case statements, if the value of the variable matches a key, the corresponding * value will be invoked. */ - public InitBuilder switchOn(String variable, Map valueToActions) { + public ScriptBuilder switchOn(String variable, Map valueToActions) { switchExec.put(checkNotNull(variable, "variable"), checkNotNull(valueToActions, "valueToActions")); return this; @@ -83,7 +83,7 @@ public class InitBuilder { /** * Unsets a variable to ensure it is set within the script. */ - public InitBuilder unsetEnvironmentVariable(String name) { + public ScriptBuilder unsetEnvironmentVariable(String name) { variablesToUnset.add(checkNotNull(name, "name")); return this; } @@ -91,7 +91,7 @@ public class InitBuilder { /** * Exports a variable inside the script */ - public InitBuilder export(String name, String value) { + public ScriptBuilder export(String name, String value) { variables.put(checkNotNull(name, "name"), checkNotNull(value, "value")); return this; } diff --git a/initbuilder/src/main/java/org/jclouds/initbuilder/domain/InitMetadata.java b/scriptbuilder/src/main/java/org/jclouds/scriptbuilder/domain/InitMetadata.java similarity index 98% rename from initbuilder/src/main/java/org/jclouds/initbuilder/domain/InitMetadata.java rename to scriptbuilder/src/main/java/org/jclouds/scriptbuilder/domain/InitMetadata.java index 12b0453926..2a6f7c184a 100644 --- a/initbuilder/src/main/java/org/jclouds/initbuilder/domain/InitMetadata.java +++ b/scriptbuilder/src/main/java/org/jclouds/scriptbuilder/domain/InitMetadata.java @@ -21,7 +21,7 @@ * under the License. * ==================================================================== */ -package org.jclouds.initbuilder.domain; +package org.jclouds.scriptbuilder.domain; import static com.google.common.base.Preconditions.checkNotNull; diff --git a/initbuilder/src/main/java/org/jclouds/initbuilder/domain/JavaInitMetadata.java b/scriptbuilder/src/main/java/org/jclouds/scriptbuilder/domain/JavaInitMetadata.java similarity index 98% rename from initbuilder/src/main/java/org/jclouds/initbuilder/domain/JavaInitMetadata.java rename to scriptbuilder/src/main/java/org/jclouds/scriptbuilder/domain/JavaInitMetadata.java index 5f2407f32c..e4623ba23a 100644 --- a/initbuilder/src/main/java/org/jclouds/initbuilder/domain/JavaInitMetadata.java +++ b/scriptbuilder/src/main/java/org/jclouds/scriptbuilder/domain/JavaInitMetadata.java @@ -21,7 +21,7 @@ * under the License. * ==================================================================== */ -package org.jclouds.initbuilder.domain; +package org.jclouds.scriptbuilder.domain; import static com.google.common.base.Preconditions.checkNotNull; diff --git a/initbuilder/src/main/java/org/jclouds/initbuilder/domain/OsFamily.java b/scriptbuilder/src/main/java/org/jclouds/scriptbuilder/domain/OsFamily.java similarity index 96% rename from initbuilder/src/main/java/org/jclouds/initbuilder/domain/OsFamily.java rename to scriptbuilder/src/main/java/org/jclouds/scriptbuilder/domain/OsFamily.java index 8db83553f7..5e6462ea06 100644 --- a/initbuilder/src/main/java/org/jclouds/initbuilder/domain/OsFamily.java +++ b/scriptbuilder/src/main/java/org/jclouds/scriptbuilder/domain/OsFamily.java @@ -21,7 +21,7 @@ * under the License. * ==================================================================== */ -package org.jclouds.initbuilder.domain; +package org.jclouds.scriptbuilder.domain; /** * Type of an Operating System. diff --git a/initbuilder/src/main/java/org/jclouds/initbuilder/domain/ShellToken.java b/scriptbuilder/src/main/java/org/jclouds/scriptbuilder/domain/ShellToken.java similarity index 99% rename from initbuilder/src/main/java/org/jclouds/initbuilder/domain/ShellToken.java rename to scriptbuilder/src/main/java/org/jclouds/scriptbuilder/domain/ShellToken.java index bbc6a7e012..88488b9efe 100644 --- a/initbuilder/src/main/java/org/jclouds/initbuilder/domain/ShellToken.java +++ b/scriptbuilder/src/main/java/org/jclouds/scriptbuilder/domain/ShellToken.java @@ -21,7 +21,7 @@ * under the License. * ==================================================================== */ -package org.jclouds.initbuilder.domain; +package org.jclouds.scriptbuilder.domain; import static com.google.common.base.Preconditions.checkNotNull; diff --git a/initbuilder/src/main/java/org/jclouds/initbuilder/domain/StoppableJavaInitMetadata.java b/scriptbuilder/src/main/java/org/jclouds/scriptbuilder/domain/StoppableJavaInitMetadata.java similarity index 98% rename from initbuilder/src/main/java/org/jclouds/initbuilder/domain/StoppableJavaInitMetadata.java rename to scriptbuilder/src/main/java/org/jclouds/scriptbuilder/domain/StoppableJavaInitMetadata.java index f44effccb0..b9f2943b33 100644 --- a/initbuilder/src/main/java/org/jclouds/initbuilder/domain/StoppableJavaInitMetadata.java +++ b/scriptbuilder/src/main/java/org/jclouds/scriptbuilder/domain/StoppableJavaInitMetadata.java @@ -21,7 +21,7 @@ * under the License. * ==================================================================== */ -package org.jclouds.initbuilder.domain; +package org.jclouds.scriptbuilder.domain; import static com.google.common.base.Preconditions.checkNotNull; diff --git a/initbuilder/src/main/java/org/jclouds/initbuilder/util/Utils.java b/scriptbuilder/src/main/java/org/jclouds/scriptbuilder/util/Utils.java similarity index 98% rename from initbuilder/src/main/java/org/jclouds/initbuilder/util/Utils.java rename to scriptbuilder/src/main/java/org/jclouds/scriptbuilder/util/Utils.java index 256db96cb2..5400c02238 100644 --- a/initbuilder/src/main/java/org/jclouds/initbuilder/util/Utils.java +++ b/scriptbuilder/src/main/java/org/jclouds/scriptbuilder/util/Utils.java @@ -21,7 +21,7 @@ * under the License. * ==================================================================== */ -package org.jclouds.initbuilder.util; +package org.jclouds.scriptbuilder.util; import java.util.List; import java.util.Map; @@ -29,8 +29,8 @@ import java.util.Map.Entry; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.jclouds.initbuilder.domain.OsFamily; -import org.jclouds.initbuilder.domain.ShellToken; +import org.jclouds.scriptbuilder.domain.OsFamily; +import org.jclouds.scriptbuilder.domain.ShellToken; import com.google.common.base.CaseFormat; import com.google.common.base.Function; diff --git a/initbuilder/src/test/java/org/jclouds/initbuilder/EnvBuilderTest.java b/scriptbuilder/src/test/java/org/jclouds/scriptbuilder/EnvBuilderTest.java similarity index 90% rename from initbuilder/src/test/java/org/jclouds/initbuilder/EnvBuilderTest.java rename to scriptbuilder/src/test/java/org/jclouds/scriptbuilder/EnvBuilderTest.java index 11990b8056..f0c718ccfb 100644 --- a/initbuilder/src/test/java/org/jclouds/initbuilder/EnvBuilderTest.java +++ b/scriptbuilder/src/test/java/org/jclouds/scriptbuilder/EnvBuilderTest.java @@ -1,12 +1,13 @@ -package org.jclouds.initbuilder; +package org.jclouds.scriptbuilder; import static org.testng.Assert.assertEquals; import java.io.IOException; import java.net.MalformedURLException; -import org.jclouds.initbuilder.domain.OsFamily; -import org.jclouds.initbuilder.domain.ShellToken; +import org.jclouds.scriptbuilder.EnvBuilder; +import org.jclouds.scriptbuilder.domain.OsFamily; +import org.jclouds.scriptbuilder.domain.ShellToken; import org.testng.annotations.Test; import com.google.common.base.Charsets; diff --git a/initbuilder/src/test/java/org/jclouds/initbuilder/InitBuilderTest.java b/scriptbuilder/src/test/java/org/jclouds/scriptbuilder/ScriptBuilderTest.java similarity index 76% rename from initbuilder/src/test/java/org/jclouds/initbuilder/InitBuilderTest.java rename to scriptbuilder/src/test/java/org/jclouds/scriptbuilder/ScriptBuilderTest.java index 3e0e6a9c34..ed2c29137b 100644 --- a/initbuilder/src/test/java/org/jclouds/initbuilder/InitBuilderTest.java +++ b/scriptbuilder/src/test/java/org/jclouds/scriptbuilder/ScriptBuilderTest.java @@ -1,12 +1,13 @@ -package org.jclouds.initbuilder; +package org.jclouds.scriptbuilder; import static org.testng.Assert.assertEquals; import java.io.IOException; import java.net.MalformedURLException; -import org.jclouds.initbuilder.domain.OsFamily; -import org.jclouds.initbuilder.domain.ShellToken; +import org.jclouds.scriptbuilder.ScriptBuilder; +import org.jclouds.scriptbuilder.domain.OsFamily; +import org.jclouds.scriptbuilder.domain.ShellToken; import org.testng.annotations.Test; import com.google.common.base.Charsets; @@ -15,13 +16,13 @@ import com.google.common.io.CharStreams; import com.google.common.io.Resources; /** - * Tests possible uses of InitBuilder + * Tests possible uses of ScriptBuilder * * @author Adrian Cole */ -public class InitBuilderTest { +public class ScriptBuilderTest { - InitBuilder testScriptBuilder = new InitBuilder().switchOn("1", + ScriptBuilder testScriptBuilder = new ScriptBuilder().switchOn("1", ImmutableMap.of("start", "echo started", "stop", "echo stopped")).export("javaHome", "/apps/jdk1.6"); @@ -41,7 +42,7 @@ public class InitBuilderTest { @Test public void testSwitchOn() { - InitBuilder builder = new InitBuilder(); + ScriptBuilder builder = new ScriptBuilder(); builder.switchOn("1", ImmutableMap.of("start", "echo started", "stop", "echo stopped")); assertEquals(builder.switchExec, ImmutableMap.of("1", ImmutableMap.of("start", "echo started", "stop", "echo stopped"))); @@ -49,13 +50,13 @@ public class InitBuilderTest { @Test public void testNoSwitchOn() { - InitBuilder builder = new InitBuilder(); + ScriptBuilder builder = new ScriptBuilder(); assertEquals(builder.switchExec.size(), 0); } @Test public void testExport() { - InitBuilder builder = new InitBuilder(); + ScriptBuilder builder = new ScriptBuilder(); builder.export("javaHome", "/apps/jdk1.6"); assertEquals(builder.variables, ImmutableMap.of("javaHome", "/apps/jdk1.6")); @@ -63,13 +64,13 @@ public class InitBuilderTest { @Test public void testNoExport() { - InitBuilder builder = new InitBuilder(); + ScriptBuilder builder = new ScriptBuilder(); assertEquals(builder.variables.size(), 0); } @Test(expectedExceptions = NullPointerException.class) public void testExportNPE() { - new InitBuilder().export(null, null); + new ScriptBuilder().export(null, null); } } diff --git a/initbuilder/src/test/java/org/jclouds/initbuilder/domain/ShellTokenTest.java b/scriptbuilder/src/test/java/org/jclouds/scriptbuilder/domain/ShellTokenTest.java similarity index 91% rename from initbuilder/src/test/java/org/jclouds/initbuilder/domain/ShellTokenTest.java rename to scriptbuilder/src/test/java/org/jclouds/scriptbuilder/domain/ShellTokenTest.java index 45491aa02e..8d0c5b2fda 100644 --- a/initbuilder/src/test/java/org/jclouds/initbuilder/domain/ShellTokenTest.java +++ b/scriptbuilder/src/test/java/org/jclouds/scriptbuilder/domain/ShellTokenTest.java @@ -21,12 +21,14 @@ * under the License. * ==================================================================== */ -package org.jclouds.initbuilder.domain; +package org.jclouds.scriptbuilder.domain; import static org.testng.Assert.assertEquals; import java.util.Map; +import org.jclouds.scriptbuilder.domain.OsFamily; +import org.jclouds.scriptbuilder.domain.ShellToken; import org.testng.annotations.Test; import com.google.common.collect.ImmutableMap; @@ -34,7 +36,7 @@ import com.google.common.collect.ImmutableMap; /** * @author Adrian Cole */ -@Test(groups = "unit", testName = "initbuilder.ShellTokenTest") +@Test(groups = "unit", testName = "scriptbuilder.ShellTokenTest") public class ShellTokenTest { public void testTokenValueMapUNIX() { diff --git a/initbuilder/src/test/java/org/jclouds/initbuilder/util/UtilsTest.java b/scriptbuilder/src/test/java/org/jclouds/scriptbuilder/util/UtilsTest.java similarity index 94% rename from initbuilder/src/test/java/org/jclouds/initbuilder/util/UtilsTest.java rename to scriptbuilder/src/test/java/org/jclouds/scriptbuilder/util/UtilsTest.java index f8c3902cb2..a76cb9bfd8 100644 --- a/initbuilder/src/test/java/org/jclouds/initbuilder/util/UtilsTest.java +++ b/scriptbuilder/src/test/java/org/jclouds/scriptbuilder/util/UtilsTest.java @@ -21,13 +21,14 @@ * under the License. * ==================================================================== */ -package org.jclouds.initbuilder.util; +package org.jclouds.scriptbuilder.util; import static org.testng.Assert.assertEquals; import java.io.UnsupportedEncodingException; -import org.jclouds.initbuilder.domain.OsFamily; +import org.jclouds.scriptbuilder.domain.OsFamily; +import org.jclouds.scriptbuilder.util.Utils; import org.testng.annotations.Test; import com.google.common.collect.ImmutableList; @@ -36,7 +37,7 @@ import com.google.common.collect.ImmutableMap; /** * @author Adrian Cole */ -@Test(groups = "unit", testName = "initbuilder.UtilsTest") +@Test(groups = "unit", testName = "scriptbuilder.UtilsTest") public class UtilsTest { public void testReplaceTokens() throws UnsupportedEncodingException { diff --git a/initbuilder/src/test/resources/forget.cmd b/scriptbuilder/src/test/resources/forget.cmd similarity index 100% rename from initbuilder/src/test/resources/forget.cmd rename to scriptbuilder/src/test/resources/forget.cmd diff --git a/initbuilder/src/test/resources/test_env.bash b/scriptbuilder/src/test/resources/test_env.bash similarity index 100% rename from initbuilder/src/test/resources/test_env.bash rename to scriptbuilder/src/test/resources/test_env.bash diff --git a/initbuilder/src/test/resources/test_env.cmd b/scriptbuilder/src/test/resources/test_env.cmd similarity index 100% rename from initbuilder/src/test/resources/test_env.cmd rename to scriptbuilder/src/test/resources/test_env.cmd diff --git a/initbuilder/src/test/resources/test_script.bash b/scriptbuilder/src/test/resources/test_script.bash similarity index 100% rename from initbuilder/src/test/resources/test_script.bash rename to scriptbuilder/src/test/resources/test_script.bash diff --git a/initbuilder/src/test/resources/test_script.cmd b/scriptbuilder/src/test/resources/test_script.cmd similarity index 100% rename from initbuilder/src/test/resources/test_script.cmd rename to scriptbuilder/src/test/resources/test_script.cmd diff --git a/scriptbuilder/src/test/resources/test_script_funcs.cmd b/scriptbuilder/src/test/resources/test_script_funcs.cmd new file mode 100644 index 0000000000..ddae1f268b --- /dev/null +++ b/scriptbuilder/src/test/resources/test_script_funcs.cmd @@ -0,0 +1,27 @@ +@echo off + +goto END_FUNCTIONS +:abortFunction + echo Aborting: %EXCEPTION%. + exit /b 1 + +:sourceEnv + set ENV_FILE=%1 + shift + if not defined ENV_FILE ( + set EXCEPTION=Internal error. Called sourceEnv with no file param + exit /b 1 + ) + call %ENV_FILE% + if errorlevel 1 ( + set EXCEPTION=Please end your '%ENV_FILE%' file with the command 'exit /b 0' to enable this script to detect syntax errors. + exit /b 1 + ) + exit /b 0 + +:END_FUNCTIONS + +if exist "%APPENV_SETTINGS_FILE%" ( + call :sourceEnv "%APPENV_SETTINGS_FILE%" + if errorlevel 1 goto abortFunction +)