Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 0 additions & 132 deletions GitHub.Unity.OctokitDebugging.sln

This file was deleted.

25 changes: 0 additions & 25 deletions common/build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,6 @@
</ItemGroup>

<!-- Common includes and references -->
<Choose>
<When Condition="'$(SolutionType)' == 'OctokitDebugging'">
<ItemGroup>
<ProjectReference Include="$(SolutionDir)..\dotnet-httpclient35\System.Net.Http\System.Net.Http-net_3_5.csproj">
<Project>{9862694d-e4fa-418b-8692-a0280feddf36}</Project>
<Name>System.Net.Http-net_3_5</Name>
</ProjectReference>
<ProjectReference Include="$(SolutionDir)..\octokit.net\Octokit\Octokit-35.csproj">
<Project>{49ef16a2-5ed1-480f-80a1-d1d05d6c1be4}</Project>
<Name>Octokit-35</Name>
</ProjectReference>
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="Octokit">
<HintPath>$(SolutionDir)lib\octokit.net\Octokit.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http">
<HintPath>$(SolutionDir)lib\dotnet-httpclient35\DotNetHttp35.dll</HintPath>
</Reference>
</ItemGroup>
</Otherwise>
</Choose>

<Target Name="BeforeBuild">
<PropertyGroup>
<UnityDLLsMissingErrorText>Location of Unity dlls is not set. You'll need to install Unity in a known location (the default installation directory for your system), or copy UnityEngine.dll and UnityEditor.dll to the {0}lib folder</UnityDLLsMissingErrorText>
Expand Down
1 change: 0 additions & 1 deletion common/properties.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Build flags -->
<PropertyGroup>
<SolutionType Condition="'$(SolutionName)' == 'GitHub.Unity.OctokitDebugging'">OctokitDebugging</SolutionType>
<BuildType Condition="Exists('$(SolutionDir)script\src\MetricsService.cs')">Internal</BuildType>

<UnityDir Condition="$(UnityDir) == '' and Exists('$(SolutionDir)\script\lib\UnityEditor.dll')">$(SolutionDir)\script\lib\</UnityDir>
Expand Down
3 changes: 0 additions & 3 deletions lib/dotnet-httpClient35/DotNetHttp35.dll

This file was deleted.

3 changes: 0 additions & 3 deletions lib/dotnet-httpClient35/DotNetHttp35.dll.mdb

This file was deleted.

2 changes: 0 additions & 2 deletions lib/dotnet-httpClient35/md5sums.txt

This file was deleted.

1 change: 0 additions & 1 deletion lib/dotnet-httpClient35/version.txt

This file was deleted.

3 changes: 0 additions & 3 deletions lib/octokit.net/Octokit.dll

This file was deleted.

3 changes: 0 additions & 3 deletions lib/octokit.net/Octokit.dll.mdb

This file was deleted.

2 changes: 0 additions & 2 deletions lib/octokit.net/md5sums.txt

This file was deleted.

1 change: 0 additions & 1 deletion lib/octokit.net/version.txt

This file was deleted.

2 changes: 1 addition & 1 deletion script
19 changes: 8 additions & 11 deletions src/GitHub.Api/Application/ApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Octokit;
using GitHub.Logging;
using System.Runtime.Serialization;
using System.Text;
Expand All @@ -19,7 +18,6 @@ public static IApiClient Create(UriString repositoryUrl, IKeychain keychain, IPr
var hostAddress = HostAddress.Create(repositoryUrl);

return new ApiClient(repositoryUrl, keychain,
new GitHubClient(ApplicationConfiguration.ProductHeader, credentialStore, hostAddress.ApiUri),
processManager, taskManager, nodeJsExecutablePath, octorunScriptPath);
}

Expand All @@ -34,11 +32,10 @@ public static IApiClient Create(UriString repositoryUrl, IKeychain keychain, IPr
private readonly NPath octorunScriptPath;
private readonly ILoginManager loginManager;

public ApiClient(UriString hostUrl, IKeychain keychain, IGitHubClient githubClient, IProcessManager processManager, ITaskManager taskManager, NPath nodeJsExecutablePath, NPath octorunScriptPath)
public ApiClient(UriString hostUrl, IKeychain keychain, IProcessManager processManager, ITaskManager taskManager, NPath nodeJsExecutablePath, NPath octorunScriptPath)
{
Guard.ArgumentNotNull(hostUrl, nameof(hostUrl));
Guard.ArgumentNotNull(keychain, nameof(keychain));
Guard.ArgumentNotNull(githubClient, nameof(githubClient));

HostAddress = HostAddress.Create(hostUrl);
OriginalUrl = hostUrl;
Expand All @@ -64,12 +61,12 @@ private async Task LogoutInternal(UriString host)
await loginManager.Logout(host);
}

public async Task CreateRepository(NewRepository newRepository, Action<GitHubRepository, Exception> callback, string organization = null)
public async Task CreateRepository(string name, string description, bool isPrivate, Action<GitHubRepository, Exception> callback, string organization = null)
{
Guard.ArgumentNotNull(callback, "callback");
try
{
var repository = await CreateRepositoryInternal(newRepository, organization);
var repository = await CreateRepositoryInternal(name, organization, description, isPrivate);
callback(repository, null);
}
catch (Exception e)
Expand Down Expand Up @@ -201,7 +198,7 @@ public async Task<bool> ContinueLoginAsync(LoginResult loginResult, Func<LoginRe
return result.Code == LoginResultCodes.Success;
}

private async Task<GitHubRepository> CreateRepositoryInternal(NewRepository newRepository, string organization)
private async Task<GitHubRepository> CreateRepositoryInternal(string repositoryName, string organization, string description, bool isPrivate)
{
try
{
Expand All @@ -214,13 +211,13 @@ private async Task<GitHubRepository> CreateRepositoryInternal(NewRepository newR
var keychainAdapter = await keychain.Load(uriString);

var command = new StringBuilder("publish -r \"");
command.Append(newRepository.Name);
command.Append(repositoryName);
command.Append("\"");

if (!string.IsNullOrEmpty(newRepository.Description))
if (!string.IsNullOrEmpty(description))
{
command.Append(" -d \"");
command.Append(newRepository.Description);
command.Append(description);
command.Append("\"");
}

Expand All @@ -231,7 +228,7 @@ private async Task<GitHubRepository> CreateRepositoryInternal(NewRepository newR
command.Append("\"");
}

if (newRepository.Private ?? false)
if (isPrivate)
{
command.Append(" -p");
}
Expand Down
7 changes: 0 additions & 7 deletions src/GitHub.Api/Application/ApplicationConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Reflection;
using Octokit;

namespace GitHub.Unity
{
Expand All @@ -11,19 +10,13 @@ static ApplicationConfiguration()
{
var executingAssembly = typeof(ApplicationConfiguration).Assembly;
AssemblyName = executingAssembly.GetName();
ProductHeader = new ProductHeaderValue(ApplicationInfo.ApplicationSafeName, AssemblyName.Version.ToString());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related directly to this PR, but you should make sure this information is sent along with the requests in the node app, so you might need to set it in the environment as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tracked in #617

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be fixed in #599

}

/// <summary>
/// The currently executing assembly.
/// </summary>
public static AssemblyName AssemblyName { get; }

/// <summary>
/// The product header used in the user agent.
/// </summary>
public static ProductHeaderValue ProductHeader { get; private set; }

public static int WebTimeout { get; set; } = DefaultWebTimeout;
}
}
3 changes: 1 addition & 2 deletions src/GitHub.Api/Application/ApplicationManagerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ protected void SetupMetrics(string unityVersion, bool firstRun)
TaskManager,
Environment.FileSystem,
Environment.NodeJsExecutablePath,
Environment.OctorunScriptPath,
ApplicationConfiguration.ProductHeader);
Environment.OctorunScriptPath);

UsageTracker = new UsageTracker(metricsService, UserSettings, usagePath, id, unityVersion);

Expand Down
5 changes: 2 additions & 3 deletions src/GitHub.Api/Application/IApiClient.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
using System.Threading.Tasks;
using Octokit;
using System;
using System.Collections.Generic;

namespace GitHub.Unity
{
interface IApiClient
{
HostAddress HostAddress { get; }
UriString OriginalUrl { get; }
Task CreateRepository(NewRepository newRepository, Action<GitHubRepository, Exception> callback, string organization = null);
Task CreateRepository(string name, string description, bool isPrivate,
Action<GitHubRepository, Exception> callback, string organization = null);
Task GetOrganizations(Action<Organization[]> onSuccess, Action<Exception> onError = null);
Task Login(string username, string password, Action<LoginResult> need2faCode, Action<bool, string> result);
Task ContinueLogin(LoginResult loginResult, string code);
Expand Down
21 changes: 0 additions & 21 deletions src/GitHub.Api/Application/OctokitExtensions.cs

This file was deleted.

1 change: 0 additions & 1 deletion src/GitHub.Api/Authentication/ILoginManager.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Threading.Tasks;
using Octokit;

namespace GitHub.Unity
{
Expand Down
Loading