Script sample

Is there a sample of Train script available? Because of the lack of documentation (or perhaps of my knowledge of JS), it’s pretty difficult to use Train methods.

As far as I know the SDK/DA bundles contain such scripts, but seems like that only applies for a full version, not trial (which is available for me).

Any help would be appreciated.

Vladimir Kudelin

Hi Vladimir,

Here is a (a bit obscured) example of one of our build scripts:

folder.remove("BuildOutput", true);
folder.create("BuildOutput");
folder.create("BuildOutput/CompiledFiles");
folder.create("BuildOutput/Installer");

msbuild.updateAssemblyVersion("InstrumentGUI/Properties/AssemblyInfo.pas", env["version"]);

msbuild.build("InstrumentGUI2010.sln", 
  {
		destinationFolder: "BuildOutput/CompiledFiles"
	});
	
nunit.run("BuildOutput/CompiledFiles/DataModelUnitTests.exe");
sleep(3000);
file.remove("BuildOutput/CompiledFiles/DataModelUnitTests.*");	
file.remove("BuildOutput/CompiledFiles/*.TBEIATEST");	
sleep(500);
file.copy("../common/used types/*.*", "BuildOutput/Included Files", true);
folder.remove("BuildOutput/Included Files/ExeFolder", true);

file.copy("../common/scripts/*.*", "BuildOutput/scripts", true);
file.copy(env["FTDIDRIVERS"], "BuildOutput/USB", true);
file.copy("CreateInstrumentGUIInstaller.iss", "BuildOutput/CreateInstrumentGUIInstaller.iss", false);
file.copy("Instrument GUI Release Notes.html", "BuildOutput/Instrument GUI Release Notes.html", false);
file.copy("../common/Images/GSD.ico", "BuildOutput/GSD.ico", false);

var innoOptions = 
{
  destinationFolder:path.resolve("BuildOutput/Installer")
}

inno.build(path.resolve("BuildOutput/CreateInstrumentGUIInstaller.iss"), innoOptions);

sleep(1000);

var md5checksum = md5.createFromFile("BuildOutput/Installer/ThunderboltEIAGUISetup_" + env["version"] + ".exe");

var md5Text = "This is the MD5 checksum.\nMore info about MD5 can be found here:\nhttp://en.wikipedia.org/wiki/MD5\nA MD5 verification tool can be downloaded here:\nhttp://getmd5checker.com/download/latest/Md5Checker.zip\n\nCopy checksum below...\n" + md5checksum;

file.write("BuildOutput/Installer/ThunderboltEIAGUISetup_" + env["version"] + "_MD5.txt", md5Text);

zip.compress("BuildOutput/Installer/ThunderboltEIAGUISetup_" + env["version"] + ".zip", "BuildOutput/Installer", "*.exe;*.txt", false, "thunderbolt");

mail.send("Train@SomeDomain.be", "Jeroen@SomeDomain.be", "New Thunderbolt GUI Software Version " + env["version"], 
          "Hi,\nHere is a new version of the TB EIA GUI software:\nftp://ftp.SomeDomain.be/ThunderboltEIAGUISetup_" + env["version"] + 
          ".zip\n\nBest Regards,\nJeroen Vandezande\nGold Standard Engineering\nEsperantolaan 7a\n3300 Tienen\nTel: +32 (0)16 810 777\nFax: +32 (0)16 767 163");
          
ftp.upload("ftp://Hal2010", 
           "someUserName", 
           "SomePassword",
           "BuildOutput/Installer/ThunderboltEIAGUISetup_" + env["version"] + ".zip",
           "ThunderboltEIAGUISetup_" + env["version"] + ".zip");

Thank you very much!