public void Write(GitHubFlowVersionContext context) { foreach (var variable in context.Variables) { Environment.SetEnvironmentVariable(variable.Key, variable.Value); } }
public void Write(GitHubFlowVersionContext context) { if (string.IsNullOrEmpty(context.Arguments.ToFile)) { return; } var stringBuilder = new StringBuilder(); stringBuilder.AppendLine("{"); var variableList = context.Variables.ToArray(); for (var index = 0; index < variableList.Length; index++) { var variable = variableList[index]; stringBuilder.AppendFormat(" \"{0}\": \"{1}\"{2}", variable.Key, variable.Value, index < variableList.Length - 1 ? "," : string.Empty); stringBuilder.AppendLine(); } stringBuilder.AppendLine("}"); var directoryName = Path.GetDirectoryName(context.Arguments.ToFile); if (!Directory.Exists(directoryName)) { Directory.CreateDirectory(directoryName); } File.WriteAllText(context.Arguments.ToFile, stringBuilder.ToString()); }
public AssemblyInfoUpdateTests() { _context = new GitHubFlowVersionContext { Arguments = new GitHubFlowArguments(), Variables = new VariableProvider().GetVariables(new SemanticVersion(1, 2, 3, "beta", 4)) }; _fileSystem = Substitute.For <IFileSystem>(); }
public void Write(GitHubFlowVersionContext context) { if (_buildServer.IsRunningInBuildAgent()) { _buildServer.WriteBuildNumber(context.NextBuildNumber); foreach (var variable in context.Variables) { _buildServer.WriteParameter(variable.Key, variable.Value); } } }
public TeamCity(GitHubFlowVersionContext context) { _context = context; }