public string CreateConfigurationsContent(Solution solution, RunsetExecutor runsetExecutor, CLIHelper cliHelper) { string sConfig = null; if (cliHelper.DownloadUpgradeSolutionFromSourceControl == true) { sConfig = "SourceControlType=" + solution.SourceControl.GetSourceControlType.ToString() + Environment.NewLine; if (solution.SourceControl.GetSourceControlType == SourceControlBase.eSourceControlType.SVN)//added for supporting Jenkins way of config creation- need to improve it { string modifiedURI = solution.SourceControl.SourceControlURL.TrimEnd(new char[] { '/' }); int lastSlash = modifiedURI.LastIndexOf('/'); modifiedURI = (lastSlash > -1) ? modifiedURI.Substring(0, lastSlash) : modifiedURI; sConfig += "SourceControlUrl=" + modifiedURI + Environment.NewLine; } else { sConfig += "SourceControlUrl=" + solution.SourceControl.SourceControlURL + Environment.NewLine; } if (solution.SourceControl.SourceControlUser != null && solution.SourceControl.SourceControlPass != null) { sConfig += "SourceControlUser="******"SourceControlPassword="******"PasswordEncrypted=" + "Y" + Environment.NewLine; } else { sConfig += "SourceControlUser=N/A" + Environment.NewLine; sConfig += "SourceControlPassword=N/A" + Environment.NewLine; } if (solution.SourceControl.GetSourceControlType == SourceControlBase.eSourceControlType.GIT) { if (solution.SourceControl.SourceControlProxyAddress != null && solution.SourceControl.SourceControlProxyAddress.ToLower().ToString() == "true") { sConfig += "SourceControlProxyServer=" + solution.SourceControl.SourceControlProxyAddress.ToString() + Environment.NewLine; sConfig += "SourceControlProxyPort=" + solution.SourceControl.SourceControlProxyPort.ToString() + Environment.NewLine; } } } sConfig += "solution=" + solution.Folder + Environment.NewLine; sConfig += "env=" + runsetExecutor.RunsetExecutionEnvironment.Name + Environment.NewLine; sConfig += "runset=" + runsetExecutor.RunSetConfig.Name + Environment.NewLine; sConfig += "analyze=" + cliHelper.RunAnalyzer.ToString() + Environment.NewLine; if (!string.IsNullOrEmpty(cliHelper.TestArtifactsFolder)) { sConfig += "artifacts-path=" + cliHelper.TestArtifactsFolder + Environment.NewLine; } //OLD sConfig += "ShowAutoRunWindow=" + cliHelper.ShowAutoRunWindow.ToString() + Environment.NewLine; sConfig += CLIOptionClassHelper.GetAttrLongName <RunOptions>(nameof(RunOptions.ShowUI)) + "=" + cliHelper.ShowAutoRunWindow.ToString() + Environment.NewLine; return(sConfig); }
private string CreateExample(string solution, string runset, string env = null) { StringBuilder sb = new StringBuilder(); RunOptions runOptions = new RunOptions(); runOptions.Solution = solution; if (env != null) { runOptions.Environment = env; } if (runset != null) { runOptions.Runset = runset; } var arguments = Parser.Default.FormatCommandLine <RunOptions>(runOptions); string exe = "dotnet GingerConsole.dll "; sb.Append(@"Open solution at '" + runOptions.Solution + "'"); if (runOptions.Environment == null) { sb.Append(" auto select environment (assuming only one exist)"); } else { sb.Append(" select environment '" + runOptions.Environment + "'"); } sb.Append(" and execute run set '").Append(runOptions.Runset).Append("'"); sb.Append(Environment.NewLine); sb.Append("Long form : ").Append("'" + exe + arguments + "'").Append(Environment.NewLine); sb.Append("Short form: ").Append("'" + exe + "run"); sb.Append(" -").Append(CLIOptionClassHelper.GetAttrShorName <RunOptions>(nameof(RunOptions.Solution))).Append(" ").Append(WrapTextIfNeeded(runOptions.Solution)); if (env != null) { sb.Append(" -").Append(CLIOptionClassHelper.GetAttrShorName <RunOptions>(nameof(RunOptions.Environment))).Append(" ").Append(WrapTextIfNeeded(runOptions.Environment)); } if (runset != null) { sb.Append(" -").Append(CLIOptionClassHelper.GetAttrShorName <RunOptions>(nameof(RunOptions.Runset))).Append(" ").Append(WrapTextIfNeeded(runOptions.Runset)); } sb.Append("'"); sb.Append(Environment.NewLine); sb.Append(Environment.NewLine); return(sb.ToString()); }