Merge branch 'octokit/master' into mono

This commit is contained in:
naveen
2015-12-15 17:32:52 -05:00
28 changed files with 185 additions and 155 deletions
+8 -11
View File
@@ -95,21 +95,18 @@ Run this command to confirm all the tests pass: `.\build`
### Running integration tests
Octokit has integration tests that access the GitHub API, but they must be
configured before they will be executed.
Octokit has integration tests that access the GitHub API, but they require a
bit of setup to run. The tests make use of a set of test accounts accessed via
credentials stored in environment variables.
**Note:** To run the tests, we highly recommend you create a test GitHub
account (i.e., don't use your real GitHub account) and a test organization
owned by that account. Then set the following environment variables:
Run the following interactive script to set the necessary environment
variables:
`OCTOKIT_GITHUBUSERNAME` (set this to the test account's username)
`OCTOKIT_GITHUBPASSWORD` (set this to the test account's password)
`OCTOKIT_GITHUBORGANIZATION` (set this to the test account's organization)
`OCTOKIT_PRIVATEREPOSITORIES` (set this to `TRUE` to indicate account has access to private repositories)
`.\script\configure-integration-tests.ps1`
Once these are set, the integration tests will be executed both when
running the FullBuild MSBuild target, and when running the
Octokit.Tests.Integration assembly through an xUnit.net-friendly test runner.
running the IntegrationTests build target, or when running the
Octokit.Tests.Integration assembly in the Visual Studio test runner.
### Submitting Changes
@@ -1,13 +1,12 @@
using System;
using System.Threading.Tasks;
using Octokit.Tests.Helpers;
using Xunit;
namespace Octokit.Tests.Integration.Clients
{
public class AuthorizationClientTests
{
[IntegrationTest]
[BasicAuthenticationTest]
public async Task CanCreatePersonalToken()
{
var github = Helper.GetBasicAuthClient();
@@ -41,10 +40,10 @@ namespace Octokit.Tests.Integration.Clients
Assert.True(error.Result.Message.Contains("username and password Basic Auth"));
}
[ApplicationTest]
[BasicAuthenticationTest(Skip = "See https://github.com/octokit/octokit.net/issues/1000 for issue to investigate this further")]
public async Task CanCreateAndGetAuthorizationWithoutFingerPrint()
{
var github = Helper.GetAuthenticatedClient();
var github = Helper.GetBasicAuthClient();
var note = Helper.MakeNameWithTimestamp("Testing authentication");
var newAuthorization = new NewAuthorization(
note,
@@ -84,10 +83,10 @@ namespace Octokit.Tests.Integration.Clients
await github.Authorization.Delete(created.Id);
}
[ApplicationTest]
[BasicAuthenticationTest]
public async Task CanCreateAndGetAuthorizationByFingerprint()
{
var github = Helper.GetAuthenticatedClient();
var github = Helper.GetBasicAuthClient();
var fingerprint = Helper.MakeNameWithTimestamp("authorization-testing");
var note = Helper.MakeNameWithTimestamp("Testing authentication");
var newAuthorization = new NewAuthorization(
@@ -130,10 +129,10 @@ namespace Octokit.Tests.Integration.Clients
await github.Authorization.Delete(created.Id);
}
[ApplicationTest]
[BasicAuthenticationTest]
public async Task CanCheckApplicationAuthentication()
{
var github = Helper.GetAuthenticatedClient();
var github = Helper.GetBasicAuthClient();
var fingerprint = Helper.MakeNameWithTimestamp("authorization-testing");
var note = Helper.MakeNameWithTimestamp("Testing authentication");
var newAuthorization = new NewAuthorization(
@@ -156,10 +155,10 @@ namespace Octokit.Tests.Integration.Clients
Assert.ThrowsAsync<NotFoundException>(() => github.Authorization.Get(created.Id));
}
[ApplicationTest]
[BasicAuthenticationTest]
public async Task CanResetApplicationAuthentication()
{
var github = Helper.GetAuthenticatedClient();
var github = Helper.GetBasicAuthClient();
var fingerprint = Helper.MakeNameWithTimestamp("authorization-testing");
var note = Helper.MakeNameWithTimestamp("Testing authentication");
var newAuthorization = new NewAuthorization(
@@ -182,10 +181,10 @@ namespace Octokit.Tests.Integration.Clients
Assert.ThrowsAsync<NotFoundException>(() => github.Authorization.Get(created.Id));
}
[ApplicationTest]
[BasicAuthenticationTest]
public async Task CanRevokeApplicationAuthentication()
{
var github = Helper.GetAuthenticatedClient();
var github = Helper.GetBasicAuthClient();
var fingerprint = Helper.MakeNameWithTimestamp("authorization-testing");
var note = Helper.MakeNameWithTimestamp("Testing authentication");
var newAuthorization = new NewAuthorization(
@@ -205,10 +204,10 @@ namespace Octokit.Tests.Integration.Clients
Assert.ThrowsAsync<NotFoundException>(() => github.Authorization.Get(created.Id));
}
[ApplicationTest]
[BasicAuthenticationTest]
public async Task CanRevokeAllApplicationAuthentications()
{
var github = Helper.GetAuthenticatedClient();
var github = Helper.GetBasicAuthClient();
var fingerprint = Helper.MakeNameWithTimestamp("authorization-testing");
var note = Helper.MakeNameWithTimestamp("Testing authentication");
@@ -35,9 +35,7 @@ public class PullRequestsClientTests : IDisposable
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
Assert.Equal("a pull request", result.Title);
Assert.False(result.Merged);
}
[IntegrationTest]
@@ -241,7 +239,7 @@ public class PullRequestsClientTests : IDisposable
Assert.True(ex.Message.StartsWith("Head branch was modified"));
}
[IntegrationTest]
[IntegrationTest (Skip="this PR is actually mergeable - rewrite the test")]
public async Task CannotBeMergedDueNotInMergeableState()
{
await CreateTheWorld();
@@ -253,6 +251,12 @@ public class PullRequestsClientTests : IDisposable
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
await Task.Delay(TimeSpan.FromSeconds(5));
var updatedPullRequest = await _fixture.Get(Helper.UserName, _context.RepositoryName, pullRequest.Number);
Assert.False(updatedPullRequest.Mergeable);
var merge = new MergePullRequest { Sha = pullRequest.Head.Sha };
var ex = await Assert.ThrowsAsync<PullRequestNotMergeableException>(() => _fixture.Merge(Helper.UserName, _context.RepositoryName, pullRequest.Number, merge));
@@ -439,7 +439,7 @@ public class RepositoriesClientTests
public class TheDeleteMethod
{
[IntegrationTest]
[IntegrationTest(Skip = "See https://github.com/octokit/octokit.net/issues/1002 for investigating this failing test")]
public async Task DeletesRepository()
{
var github = Helper.GetAuthenticatedClient();
@@ -21,7 +21,7 @@ public class RepositoryDeployKeysClientTests : IDisposable
_context = github.CreateRepositoryContext("public-repo").Result;
}
[IntegrationTest(Skip = "see https://github.com/octokit/octokit.net/issues/533 for the resolution to this failing test")]
[IntegrationTest(Skip = "see https://github.com/octokit/octokit.net/issues/533 for investigating this failing test")]
public async Task CanCreateADeployKey()
{
var deployKey = new NewDeployKey()
@@ -36,8 +36,7 @@ public class RepositoryDeployKeysClientTests : IDisposable
Assert.Equal(_keyTitle, deployKeyResult.Title);
}
[IntegrationTest]
[IntegrationTest(Skip = "See https://github.com/octokit/octokit.net/issues/1003 for investigating this failing test")]
public async Task CanRetrieveAllDeployKeys()
{
var deployKeys = await _fixture.GetAll(_context.RepositoryOwner, _context.RepositoryName);
@@ -51,7 +51,7 @@ namespace Octokit.Tests.Integration.Clients
var forkCreated = await github.Repository.Forks.Create("octokit", "octokit.net", new NewRepositoryFork());
Assert.NotNull(forkCreated);
Assert.Equal(String.Format("{0}/octokit.net", Helper.Credentials.Login), forkCreated.FullName);
Assert.Equal(String.Format("{0}/octokit.net", Helper.UserName), forkCreated.FullName);
Assert.Equal(true, forkCreated.Fork);
}
@@ -80,7 +80,7 @@ namespace Octokit.Tests.Integration.Clients
Secret = secret
};
var hook = await github.Repository.Hooks.Create(Helper.Credentials.Login, repository.Name, parameters.ToRequest());
var hook = await github.Repository.Hooks.Create(Helper.UserName, repository.Name, parameters.ToRequest());
var baseHookUrl = CreateExpectedBaseHookUrl(repository.Url, hook.Id);
var webHookConfig = CreateExpectedConfigDictionary(config, url, contentType, secret);
@@ -99,13 +99,13 @@ namespace Octokit.Tests.Integration.Clients
Dictionary<string, string> CreateExpectedConfigDictionary(Dictionary<string, string> config, string url, WebHookContentType contentType, string secret)
{
return config.Union(new Dictionary<string, string>
return new Dictionary<string, string>
{
{ "url", url },
{ "content_type", contentType.ToString().ToLowerInvariant() },
{ "secret", secret },
{ "insecure_ssl", "False" }
}).ToDictionary(k => k.Key, v => v.Value);
}.Union(config).ToDictionary(k => k.Key, v => v.Value);
}
string CreateExpectedBaseHookUrl(string url, int id)
+1 -1
View File
@@ -159,7 +159,7 @@ namespace Octokit.Tests.Integration
{
return new GitHubClient(new ProductHeaderValue("OctokitTests"))
{
Credentials = new Credentials(Credentials.Login, "bad-password")
Credentials = new Credentials(Guid.NewGuid().ToString(), "bad-password")
};
}
}
@@ -0,0 +1,33 @@
using System.Collections.Generic;
using System.Linq;
using Xunit;
using Xunit.Abstractions;
using Xunit.Sdk;
namespace Octokit.Tests.Integration
{
public class BasicAuthenticationTestDiscoverer : IXunitTestCaseDiscoverer
{
readonly IMessageSink diagnosticMessageSink;
public BasicAuthenticationTestDiscoverer(IMessageSink diagnosticMessageSink)
{
this.diagnosticMessageSink = diagnosticMessageSink;
}
public IEnumerable<IXunitTestCase> Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute)
{
if (Helper.Organization == null)
{
return Enumerable.Empty<IXunitTestCase>();
}
return new[] { new XunitTestCase(diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), testMethod) };
}
}
[XunitTestCaseDiscoverer("Octokit.Tests.Integration.BasicAuthenticationTestDiscoverer", "Octokit.Tests.Integration")]
public class BasicAuthenticationTestAttribute : FactAttribute
{
}
}
@@ -105,6 +105,7 @@
<Compile Include="fixtures\RepositoriesHooksFixture.cs" />
<Compile Include="Helpers\ApplicationTestAttribute.cs" />
<Compile Include="Helpers\GithubClientExtensions.cs" />
<Compile Include="Helpers\BasicAuthenticationTestAttribute.cs" />
<Compile Include="Helpers\PersonalAccessTokenTestAttribute.cs" />
<Compile Include="Helpers\PaidAccountTestAttribute.cs" />
<Compile Include="Helpers\RepositoryContext.cs" />
@@ -1,6 +1,5 @@
using System;
using System.Reactive.Linq;
using System.Runtime.Remoting;
using System.Threading.Tasks;
using Octokit;
using Octokit.Reactive;
@@ -26,7 +25,7 @@ public class ObservableRespositoryDeployKeysClientTests : IDisposable
_owner = _repository.Owner.Login;
}
[IntegrationTest(Skip = "see https://github.com/octokit/octokit.net/issues/533 for the resolution to this failing test")]
[IntegrationTest(Skip = "see https://github.com/octokit/octokit.net/issues/533 for investigating this failing test")]
public async Task CanCreateADeployKey()
{
var deployKey = new NewDeployKey()
@@ -43,7 +42,7 @@ public class ObservableRespositoryDeployKeysClientTests : IDisposable
Assert.Equal(_keyTitle, createdDeployKey.Title);
}
[IntegrationTest]
[IntegrationTest(Skip = "See https://github.com/octokit/octokit.net/issues/1003 for investigating this failing test")]
public async Task CanRetrieveAllDeployKeys()
{
var deployKeys = await _client.GetAll(_owner, _repository.Name).ToList();
@@ -62,7 +61,7 @@ public class ObservableRespositoryDeployKeysClientTests : IDisposable
Assert.Equal(_keyTitle, deployKeys[0].Title);
}
[IntegrationTest(Skip = "see https://github.com/octokit/octokit.net/issues/533 for the resolution to this failing test")]
[IntegrationTest(Skip = "see https://github.com/octokit/octokit.net/issues/533 for investigating this failing test")]
public async Task CanRetrieveADeployKey()
{
var newDeployKey = new NewDeployKey()
@@ -80,7 +79,7 @@ public class ObservableRespositoryDeployKeysClientTests : IDisposable
Assert.Equal(_keyTitle, deployKey.Title);
}
[IntegrationTest(Skip = "see https://github.com/octokit/octokit.net/issues/533 for the resolution to this failing test")]
[IntegrationTest(Skip = "see https://github.com/octokit/octokit.net/issues/533 for investigating this failing test")]
public async Task CanRemoveADeployKey()
{
var newDeployKey = new NewDeployKey()
+1 -1
View File
@@ -18,7 +18,7 @@ namespace Octokit.Tests.Integration
Assert.Equal(AccountType.User, repository.Owner.Type);
}
[IntegrationTest]
[IntegrationTest(Skip = "This test is super-unreliable right now - see https://github.com/octokit/octokit.net/issues/874 for discussion")]
public async Task CanCreateIssueOnRedirectedRepository()
{
var client = Helper.GetAuthenticatedClient();
@@ -43,7 +43,7 @@ namespace Octokit.Tests.Integration.fixtures
Events = new[] { "commit_comment" },
Active = false
};
var createdHook = github.Repository.Hooks.Create(Helper.Credentials.Login, repository.Name, parameters);
var createdHook = github.Repository.Hooks.Create(Helper.UserName, repository.Name, parameters);
return createdHook.Result;
}
-2
View File
@@ -46,8 +46,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Octokit-Portable", "Octokit
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Octokit.Tests-Portable", "Octokit.Tests\Octokit.Tests-Portable.csproj", "{CBE29DDD-F15C-46CC-A250-E6ECF55BEED4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{DB068FD2-F54C-48EB-A6FD-1AC9EA3F8F57}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
+2 -2
View File
@@ -110,7 +110,7 @@ namespace Octokit
/// <param name="number">The pull request number</param>
/// <param name="mergePullRequest">A <see cref="MergePullRequest"/> instance describing a pull request merge</param>
/// <returns>An <see cref="PullRequestMerge"/> result which indicates the merge result</returns>
public Task<PullRequestMerge> Merge(string owner, string name, int number, MergePullRequest mergePullRequest)
public async Task<PullRequestMerge> Merge(string owner, string name, int number, MergePullRequest mergePullRequest)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
@@ -118,7 +118,7 @@ namespace Octokit
try
{
return ApiConnection.Put<PullRequestMerge>(ApiUrls.MergePullRequest(owner, name, number), mergePullRequest);
return await ApiConnection.Put<PullRequestMerge>(ApiUrls.MergePullRequest(owner, name, number), mergePullRequest);
}
catch (ApiException ex)
{
@@ -22,7 +22,6 @@ namespace Octokit
/// Constructs an instance of ApiValidationException
/// </summary>
public InvalidGitIgnoreTemplateException()
: base()
{ }
/// <summary>
+4 -20
View File
@@ -16,34 +16,18 @@ namespace Octokit
public static IList<string> Clone(this IReadOnlyList<string> input)
{
List<string> output = null;
if (input == null)
return output;
return null;
output = new List<string>();
foreach (var item in input)
{
output.Add(new String(item.ToCharArray()));
}
return output;
return input.Select(item => new String(item.ToCharArray())).ToList();
}
public static IDictionary<string, Uri> Clone(this IReadOnlyDictionary<string, Uri> input)
{
Dictionary<string, Uri> output = null;
if (input == null)
return output;
return null;
output = new Dictionary<string, Uri>();
foreach (var item in input)
{
output.Add(new String(item.Key.ToCharArray()), new Uri(item.Value.ToString()));
}
return output;
return input.ToDictionary(item => new String(item.Key.ToCharArray()), item => new Uri(item.Value.ToString()));
}
}
}
+1 -1
View File
@@ -51,7 +51,7 @@ namespace Octokit
if (optionalQueryStringMatch.Success)
{
var expansion = string.Empty;
var parameters = optionalQueryStringMatch.Groups[1].Value.Split(new char[] { ',' });
var parameters = optionalQueryStringMatch.Groups[1].Value.Split(',');
foreach (var parameter in parameters)
{
+5 -5
View File
@@ -60,14 +60,14 @@ namespace Octokit
{
// Seem to have to do this to pass a whole bunch of tests (for example Octokit.Tests.Clients.EventsClientTests.DeserializesCommitCommentEventCorrectly)
// I believe this has something to do with the Mocking framework.
if (this.Links == null || this.OauthScopes == null || this.RateLimit == null || this.Etag == null)
if (Links == null || OauthScopes == null || RateLimit == null || Etag == null)
return null;
return new ApiInfo(this.Links.Clone(),
this.OauthScopes.Clone(),
this.AcceptedOauthScopes.Clone(),
return new ApiInfo(Links.Clone(),
OauthScopes.Clone(),
AcceptedOauthScopes.Clone(),
new String(this.Etag.ToCharArray()),
this.RateLimit.Clone());
RateLimit.Clone());
}
}
}
+1 -1
View File
@@ -230,7 +230,7 @@ namespace Octokit.Internal
{
newRequest.Headers.Authorization = null;
}
response = await this.SendAsync(newRequest, cancellationToken);
response = await SendAsync(newRequest, cancellationToken);
}
return response;
+3 -3
View File
@@ -108,9 +108,9 @@ namespace Octokit
{
return new RateLimit
{
Limit = this.Limit,
Remaining = this.Remaining,
ResetAsUtcEpochSeconds = this.ResetAsUtcEpochSeconds
Limit = Limit,
Remaining = Remaining,
ResetAsUtcEpochSeconds = ResetAsUtcEpochSeconds
};
}
}
@@ -10,7 +10,7 @@ namespace Octokit
internal string DebuggerDisplay
{
get { return this.Repository.FullName; }
get { return Repository.FullName; }
}
}
}
-61
View File
@@ -1,61 +0,0 @@
using System;
using System.Diagnostics;
using System.Globalization;
namespace Octokit
{
/// <summary>
/// Represents the author or committer to a Git commit. This is the information stored in Git and should not be
/// confused with GitHub account information.
/// </summary>
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class Committer
{
/// <summary>
/// Initializes a new instance of the <see cref="Committer"/> class.
/// </summary>
public Committer() { }
/// <summary>
/// Initializes a new instance of the <see cref="Committer"/> class.
/// </summary>
/// <param name="name">The full name of the author or committer.</param>
/// <param name="email">The email.</param>
/// <param name="date">The date.</param>
public Committer(string name, string email, DateTimeOffset date)
{
Name = name;
Email = email;
Date = date;
}
/// <summary>
/// Gets the name of the author or committer.
/// </summary>
/// <value>
/// The name.
/// </value>
public string Name { get; protected set; }
/// <summary>
/// Gets the email of the author or committer.
/// </summary>
/// <value>
/// The email.
/// </value>
public string Email { get; protected set; }
/// <summary>
/// Gets the date of the author or contributor's contributions.
/// </summary>
/// <value>
/// The date.
/// </value>
public DateTimeOffset Date { get; protected set; }
internal string DebuggerDisplay
{
get { return String.Format(CultureInfo.InvariantCulture, "Name: {0} Email: {1} Date: {2}", Name, Email, Date); }
}
}
}
+5 -9
View File
@@ -14,7 +14,7 @@ namespace Octokit
Number = number;
}
public PullRequest(Uri url, Uri htmlUrl, Uri diffUrl, Uri patchUrl, Uri issueUrl, Uri statusesUrl, int number, ItemState state, string title, string body, DateTimeOffset createdAt, DateTimeOffset updatedAt, DateTimeOffset? closedAt, DateTimeOffset? mergedAt, GitReference head, GitReference @base, User user, User assignee, string mergeCommitSha, bool merged, bool? mergeable, User mergedBy, int comments, int commits, int additions, int deletions, int changedFiles)
public PullRequest(Uri url, Uri htmlUrl, Uri diffUrl, Uri patchUrl, Uri issueUrl, Uri statusesUrl, int number, ItemState state, string title, string body, DateTimeOffset createdAt, DateTimeOffset updatedAt, DateTimeOffset? closedAt, DateTimeOffset? mergedAt, GitReference head, GitReference @base, User user, User assignee, bool? mergeable, User mergedBy, int comments, int commits, int additions, int deletions, int changedFiles)
{
Url = url;
HtmlUrl = htmlUrl;
@@ -34,8 +34,6 @@ namespace Octokit
Base = @base;
User = user;
Assignee = assignee;
MergeCommitSha = mergeCommitSha;
Merged = merged;
Mergeable = mergeable;
MergedBy = mergedBy;
Comments = comments;
@@ -135,15 +133,13 @@ namespace Octokit
/// </summary>
public User Assignee { get; protected set; }
/// <summary>
/// The SHA of the merge commit.
/// </summary>
public string MergeCommitSha { get; protected set; }
/// <summary>
/// Whether or not the pull request has been merged.
/// </summary>
public bool Merged { get; protected set; }
public bool Merged
{
get { return MergedAt.HasValue; }
}
/// <summary>
/// Whether or not the pull request can be merged.
+4 -2
View File
@@ -1,5 +1,6 @@
# Octokit - GitHub API Client Library for .NET
[![Build Status](https://ci.appveyor.com/api/projects/status/github/octokit/octokit.net?branch=master)](https://ci.appveyor.com/project/Haacked15676/octokit-net) [![Build Status]( https://travis-ci.org/octokit/octokit.net.svg)]( https://travis-ci.org/octokit/octokit.net) [![Join the chat at https://gitter.im/octokit/octokit.net](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/octokit/octokit.net?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build status](https://ci.appveyor.com/api/projects/status/cego2g42yw26th26/branch/master?svg=true)](https://ci.appveyor.com/project/github-windows/octokit-net/branch/master) [![Build Status]( https://travis-ci.org/octokit/octokit.net.svg)]( https://travis-ci.org/octokit/octokit.net) [![Join the chat at https://gitter.im/octokit/octokit.net](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/octokit/octokit.net?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
![logo](octokit-dotnet_2.png)
@@ -88,7 +89,8 @@ problem.
## Related Projects
- [ScriptCs.OctoKit](https://github.com/alfhenrik/ScriptCs.OctoKit) - a script pack to use Octokit in scriptcs
- [ScriptCs.OctoKit](https://github.com/alfhenrik/ScriptCs.OctoKit) - a [script pack](https://github.com/scriptcs/scriptcs/wiki/Script-Packs) to use Octokit in scriptcs
- [ScriptCs.OctokitLibrary](https://github.com/ryanrousseau/ScriptCs.OctokitLibrary) - a [script library](https://github.com/scriptcs/scriptcs/wiki/Script-Libraries) to use Octokit in scriptcs
## Copyright and License
+2 -1
View File
@@ -10,4 +10,5 @@ nuget:
account_feed: true
project_feed: true
artifacts:
- path: '**\octokit*.nupkg'
- path: 'packaging\octokit*.nupkg'
name: OctokitPackages
+2 -2
View File
@@ -228,7 +228,6 @@ Target "CreatePackages" DoNothing
"Clean"
==> "AssemblyInfo"
==> "CheckProjects"
==> "ValidateLINQPadSamples"
==> "BuildApp"
"Clean"
@@ -254,6 +253,7 @@ Target "CreatePackages" DoNothing
"CreateOctokitReactivePackage"
==> "CreatePackages"
"ValidateLINQPadSamples"
==> "CreatePackages"
RunTargetOrDefault "Default"
+79
View File
@@ -0,0 +1,79 @@
# TODO: this should indicate whether a variable is required or optional
function SetVariable([string]$key, [string]$value)
{
[environment]::SetEnvironmentVariable($key, $value, "User")
[environment]::SetEnvironmentVariable($key, $value)
}
function AskYesNoQuestion([string]$question, [string]$key)
{
$answer = Read-Host -Prompt ($question + " Press Y to set this, otherwise we'll skip it")
if ($answer -eq "Y")
{
SetVariable $key "YES"
}
else
{
SetVariable $key $null
}
Write-Host
}
function VerifyEnvironmentVariable([string]$friendlyName, [string]$key, [bool]$optional = $false)
{
if ($optional -eq $true)
{
$label = "(optional)"
}
else
{
$label = "(required)"
}
$existing_value = [environment]::GetEnvironmentVariable($key,"User")
if ($existing_value -eq $null)
{
$value = Read-Host -Prompt "Set the $friendlyName to use for the integration tests $label"
SetVariable $key $value
}
else
{
Write-Host "$existing_value found as the configured $friendlyName"
$reset = Read-Host -Prompt "Want to change this? Press Y, otherwise we'll move on"
if ($reset -eq "Y")
{
$value = Read-Host -Prompt "Change the $friendlyName to use for the integration tests"
SetVariable $key $value
}
if ($optional -eq $true)
{
$clear = Read-Host -Prompt 'Want to remove this optional value, press Y'
if ($clear -eq "Y")
{
SetVariable $key $null
}
}
}
Write-Host
}
Write-Host
Write-Host "BIG FREAKING WARNING!!!!!"
Write-Host "You should use a test account when running the Octokit integration tests!"
Write-Host
Write-Host
VerifyEnvironmentVariable "account name" "OCTOKIT_GITHUBUSERNAME"
VerifyEnvironmentVariable "account password" "OCTOKIT_GITHUBPASSWORD" $true
VerifyEnvironmentVariable "OAuth token" "OCTOKIT_OAUTHTOKEN"
AskYesNoQuestion "Do you have private repositories associated with your test account?" "OCTOKIT_PRIVATEREPOSITORIES"
VerifyEnvironmentVariable "organization name" "OCTOKIT_GITHUBORGANIZATION" $true
VerifyEnvironmentVariable "application ClientID" "OCTOKIT_CLIENTID" $true
VerifyEnvironmentVariable "application Secret" "OCTOKIT_CLIENTSECRET" $true