public void Should_Return_Empty_Builder_When_Values_Is_Null() { // Given, When var builder = ProcessArgumentBuilder.FromStrings(null); // Then Assert.Empty(builder); }
public void Build(string target, ElectronBuilderArguments userArgs) { FilePath projectPath = this.context.GuiCsProject; DirectoryPath workingDirectory = projectPath.GetDirectory(); DirectoryPath outputDirectory = this.context.DesktopDistributionPath.Combine(target); var arguments = ProcessArgumentBuilder.FromStrings( new string[] { "build", $"/target {target}", // $"/absolute-path \"{outputDirectory}\"", // <- Doesn't work. Need to use the manifest file to specify this. $"/electron-params --publish=never", // <- Never publish, otherwise Jenkins tries to talk to GitHub. $"/version {MedituConstants.VersionString}", $"/p:Version={MedituConstants.VersionString}", $"/p:AssemblyVersion={MedituConstants.VersionString}", $"/p:FileVersion={MedituConstants.VersionString}" } ); var processSettings = new ProcessSettings { Arguments = arguments, WorkingDirectory = workingDirectory }; this.context.EnsureDirectoryExists(outputDirectory); this.context.CleanDirectory(outputDirectory); FilePath electronizeExe = userArgs.ElectronizePath ?? new FilePath("electronize"); context.Information($"Building desktop application for {target}"); CreateManifestFile(projectPath, outputDirectory, workingDirectory); using (IProcess proc = this.context.ProcessRunner.Start(electronizeExe, processSettings)) { proc.WaitForExit(); if (proc.GetExitCode() != 0) { throw new Exception("electronize exited with exit code: " + proc.GetExitCode()); } } }
/// <summary> /// Performs a conversion from <see cref="IEnumerable{String}"/> to <see cref="ProcessArgumentBuilder"/>. /// </summary> /// <param name="values">The text values to convert.</param> /// <returns>A <see cref="ProcessArgumentBuilder"/>.</returns> public static ProcessArgumentBuilder ToProcessArguments(this IEnumerable <string> values) { return(ProcessArgumentBuilder.FromStrings(values)); }