commit
a2f3c531fb
2 changed files with 28 additions and 28 deletions
|
@ -27,38 +27,36 @@ namespace Microsoft.DotNet.Scripts
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public class Config
|
public class Config
|
||||||
{
|
{
|
||||||
public static Config Instance { get; } = Read();
|
public static Config Instance { get; } = new Config();
|
||||||
|
|
||||||
public string UserName { get; set; }
|
private Lazy<string> _userName = new Lazy<string>(() => GetEnvironmentVariable("GITHUB_USER"));
|
||||||
public string Email { get; set; }
|
private Lazy<string> _email = new Lazy<string>(() => GetEnvironmentVariable("GITHUB_EMAIL"));
|
||||||
public string Password { get; set; }
|
private Lazy<string> _password = new Lazy<string>(() => GetEnvironmentVariable("GITHUB_PASSWORD"));
|
||||||
public string CoreFxVersionUrl { get; set; }
|
|
||||||
public string GitHubOriginOwner { get; set; }
|
private Lazy<string> _coreFxVersionUrl = new Lazy<string>(() => GetEnvironmentVariable("COREFX_VERSION_URL", "https://raw.githubusercontent.com/dotnet/versions/master/dotnet/corefx/release/1.0.0-rc2/LKG.txt"));
|
||||||
public string GitHubUpstreamOwner { get; set; }
|
private Lazy<string> _gitHubOriginOwner;
|
||||||
public string GitHubProject { get; set; }
|
private Lazy<string> _gitHubUpstreamOwner = new Lazy<string>(() => GetEnvironmentVariable("GITHUB_UPSTREAM_OWNER", "dotnet"));
|
||||||
public string GitHubUpstreamBranch { get; set; }
|
private Lazy<string> _gitHubProject = new Lazy<string>(() => GetEnvironmentVariable("GITHUB_PROJECT", "cli"));
|
||||||
public string[] GitHubPullRequestNotifications { get; set; }
|
private Lazy<string> _gitHubUpstreamBranch = new Lazy<string>(() => GetEnvironmentVariable("GITHUB_UPSTREAM_BRANCH", "rel/1.0.0"));
|
||||||
|
private Lazy<string[]> _gitHubPullRequestNotifications = new Lazy<string[]>(() =>
|
||||||
|
GetEnvironmentVariable("GITHUB_PULL_REQUEST_NOTIFICATIONS", "")
|
||||||
|
.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries));
|
||||||
|
|
||||||
private static Config Read()
|
private Config()
|
||||||
{
|
{
|
||||||
string userName = GetEnvironmentVariable("GITHUB_USER");
|
_gitHubOriginOwner = new Lazy<string>(() => GetEnvironmentVariable("GITHUB_ORIGIN_OWNER", UserName));
|
||||||
|
|
||||||
return new Config
|
|
||||||
{
|
|
||||||
UserName = userName,
|
|
||||||
Email = GetEnvironmentVariable("GITHUB_EMAIL"),
|
|
||||||
Password = GetEnvironmentVariable("GITHUB_PASSWORD"),
|
|
||||||
|
|
||||||
CoreFxVersionUrl = GetEnvironmentVariable("COREFX_VERSION_URL", "https://raw.githubusercontent.com/dotnet/versions/master/dotnet/corefx/release/1.0.0-rc2/LKG.txt"),
|
|
||||||
GitHubOriginOwner = GetEnvironmentVariable("GITHUB_ORIGIN_OWNER", userName),
|
|
||||||
GitHubUpstreamOwner = GetEnvironmentVariable("GITHUB_UPSTREAM_OWNER", "dotnet"),
|
|
||||||
GitHubProject = GetEnvironmentVariable("GITHUB_PROJECT", "cli"),
|
|
||||||
GitHubUpstreamBranch = GetEnvironmentVariable("GITHUB_UPSTREAM_BRANCH", "rel/1.0.0"),
|
|
||||||
GitHubPullRequestNotifications = GetEnvironmentVariable("GITHUB_PULL_REQUEST_NOTIFICATIONS", "")
|
|
||||||
.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string UserName => _userName.Value;
|
||||||
|
public string Email => _email.Value;
|
||||||
|
public string Password => _password.Value;
|
||||||
|
public string CoreFxVersionUrl => _coreFxVersionUrl.Value;
|
||||||
|
public string GitHubOriginOwner => _gitHubOriginOwner.Value;
|
||||||
|
public string GitHubUpstreamOwner => _gitHubUpstreamOwner.Value;
|
||||||
|
public string GitHubProject => _gitHubProject.Value;
|
||||||
|
public string GitHubUpstreamBranch => _gitHubUpstreamBranch.Value;
|
||||||
|
public string[] GitHubPullRequestNotifications => _gitHubPullRequestNotifications.Value;
|
||||||
|
|
||||||
private static string GetEnvironmentVariable(string name, string defaultValue = null)
|
private static string GetEnvironmentVariable(string name, string defaultValue = null)
|
||||||
{
|
{
|
||||||
string value = Environment.GetEnvironmentVariable(name);
|
string value = Environment.GetEnvironmentVariable(name);
|
||||||
|
|
|
@ -57,7 +57,9 @@ namespace Microsoft.DotNet.Scripts
|
||||||
{
|
{
|
||||||
List<DependencyInfo> dependencyInfos = c.GetDependencyInfos();
|
List<DependencyInfo> dependencyInfos = c.GetDependencyInfos();
|
||||||
|
|
||||||
IEnumerable<string> projectJsonFiles = Directory.GetFiles(Dirs.RepoRoot, "project.json", SearchOption.AllDirectories);
|
IEnumerable<string> projectJsonFiles = Enumerable.Union(
|
||||||
|
Directory.GetFiles(Dirs.RepoRoot, "project.json", SearchOption.AllDirectories),
|
||||||
|
Directory.GetFiles(Path.Combine(Dirs.RepoRoot, @"src\dotnet\commands\dotnet-new"), "project.json.pretemplate", SearchOption.AllDirectories));
|
||||||
|
|
||||||
JObject projectRoot;
|
JObject projectRoot;
|
||||||
foreach (string projectJsonFile in projectJsonFiles)
|
foreach (string projectJsonFile in projectJsonFiles)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue