Skip to content

Commit

Permalink
Merge pull request #92 from OctopusDeploy/bug-scrmodvars
Browse files Browse the repository at this point in the history
Ensure the ScriptModules are written after Variables.
  • Loading branch information
michaelnoonan committed Feb 29, 2016
2 parents a615cd3 + 827e37b commit 25c4524
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ Write-VersionTable

{{VariableDeclarations}}

# -----------------------------------------------------------------
# Script Modules - after variables
# -----------------------------------------------------------------

{{ScriptModules}}

# -----------------------------------------------------------------
# Defaults
# -----------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public static string PrepareBootstrapFile(string targetScriptFile, CalamariVaria
var builder = new StringBuilder(BootstrapScriptTemplate);
builder.Replace("{{TargetScriptFile}}", targetScriptFile.Replace("'", "''"));
builder.Replace("{{VariableDeclarations}}", DeclareVariables(variables));
builder.Replace("{{ScriptModules}}", DeclareScriptModules(variables));

using (var writer = new StreamWriter(bootstrapFile, false, new UTF8Encoding(true)))
{
Expand All @@ -83,15 +84,22 @@ private static string DeclareVariables(CalamariVariableDictionary variables)
{
var output = new StringBuilder();

WriteScriptModules(variables, output);
output.AppendLine();
WriteVariableDictionary(variables, output);
output.AppendLine();
WriteLocalVariables(variables, output);

return output.ToString();
}

private static string DeclareScriptModules(CalamariVariableDictionary variables)
{
var output = new StringBuilder();

WriteScriptModules(variables, output);

return output.ToString();
}

static void WriteScriptModules(VariableDictionary variables, StringBuilder output)
{
foreach (var variableName in variables.GetNames().Where(SpecialVariables.IsLibraryScriptModule))
Expand Down

0 comments on commit 25c4524

Please sign in to comment.