From cd9e1b625fbe01f264c6d63a62186dc7cb82b2cd Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Fri, 23 Mar 2018 12:12:29 -0700 Subject: [PATCH 01/12] Change error log message to a trace message --- src/UnityExtension/Assets/Editor/GitHub.Unity/UI/GitPathView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/GitPathView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/GitPathView.cs index b2031f83e..56d1731b5 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/GitPathView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/GitPathView.cs @@ -253,7 +253,7 @@ private void ValidateAndSetGitInstallPath(string value) } else { - Logger.Warning("Software versions meet minimums Git:{0} GitLfs:{1}", + Logger.Trace("Software versions meet minimums Git:{0} GitLfs:{1}", result.GitVersion, result.GitLfsVersion); From 7abc1de531839caf270717160be14abaa384cf37 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Fri, 23 Mar 2018 11:06:20 -0700 Subject: [PATCH 02/12] FindOrCreateAdapter may return an Adapter with a null credential --- src/GitHub.Api/Authentication/Keychain.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GitHub.Api/Authentication/Keychain.cs b/src/GitHub.Api/Authentication/Keychain.cs index 5e93f488c..542904020 100644 --- a/src/GitHub.Api/Authentication/Keychain.cs +++ b/src/GitHub.Api/Authentication/Keychain.cs @@ -323,6 +323,6 @@ private void UpdateConnections(Connection[] conns) public Connection[] Connections => connections.Values.ToArray(); public IList Hosts => connections.Keys.ToArray(); public bool HasKeys => connections.Any(); - public bool NeedsLoad => HasKeys && !string.IsNullOrEmpty(FindOrCreateAdapter(connections.First().Value.Host).Credential.Token); + public bool NeedsLoad => HasKeys && !string.IsNullOrEmpty(FindOrCreateAdapter(connections.First().Value.Host).Credential?.Token); } } \ No newline at end of file From 4c3e0015fb4318036b3b2af4ba0fe019e25498c5 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Mon, 26 Mar 2018 11:31:58 -0400 Subject: [PATCH 03/12] Refactor commands to use output module - Moved the process.exit to output.js - Updated command scripts to use output module correctly - Updated version and zip --- octorun/src/bin/app-login.js | 5 --- octorun/src/bin/app-organizations.js | 3 -- octorun/src/bin/app-publish.js | 43 ++------------------ octorun/src/bin/app-usage.js | 27 +++--------- octorun/src/output.js | 14 +++++-- octorun/version | 2 +- src/GitHub.Api/Installer/OctorunInstaller.cs | 2 +- src/GitHub.Api/Resources/octorun.zip | 4 +- 8 files changed, 24 insertions(+), 76 deletions(-) diff --git a/octorun/src/bin/app-login.js b/octorun/src/bin/app-login.js index 98137e7a9..f3484c31b 100644 --- a/octorun/src/bin/app-login.js +++ b/octorun/src/bin/app-login.js @@ -13,15 +13,12 @@ var handleAuthentication = function (username, password, twoFactor) { authentication.handleAuthentication(username, password, function (token, status) { if (status) { output.custom(status, token); - process.exit(); } else { output.success(token); - process.exit(); } }, function (error) { output.error(error); - process.exit(); }, twoFactor); } @@ -41,7 +38,6 @@ if (commander.twoFactor) { } catch (error) { output.error(error); - process.exit(); } } else { @@ -108,7 +104,6 @@ else { } catch (error) { output.error(error); - process.exit(); } }); } diff --git a/octorun/src/bin/app-organizations.js b/octorun/src/bin/app-organizations.js index 401c977ae..7c7d6136f 100644 --- a/octorun/src/bin/app-organizations.js +++ b/octorun/src/bin/app-organizations.js @@ -14,7 +14,6 @@ try { apiWrapper.getOrgs(function (error, result) { if (error) { output.error(error); - process.exit(); } else { results = []; @@ -24,11 +23,9 @@ try { } output.success(results); - process.exit(); } }); } catch (error) { output.error(error); - process.exit(); } \ No newline at end of file diff --git a/octorun/src/bin/app-publish.js b/octorun/src/bin/app-publish.js index 1b3257da2..7e60dd697 100644 --- a/octorun/src/bin/app-publish.js +++ b/octorun/src/bin/app-publish.js @@ -2,6 +2,7 @@ var commander = require("commander"); var package = require('../../package.json') var ApiWrapper = require('../api') var endOfLine = require('os').EOL; +var output = require('../output'); commander .version(package.version) @@ -13,11 +14,8 @@ commander if(!commander.repository) { - process.stdout.write("repository required"); - process.stdout.write(endOfLine); commander.help(); process.exit(-1); - return; } var private = false; @@ -31,46 +29,13 @@ try { apiWrapper.publish(commander.repository, commander.description, private, commander.organization, function (error, result) { if (error) { - process.stdout.write("error"); - process.stdout.write(endOfLine); - - process.stdout.write(""); - process.stdout.write(endOfLine); - - process.stdout.write(""); - process.stdout.write(endOfLine); - - if (error) { - process.stdout.write(error.toString()); - process.stdout.write(endOfLine); - } - - process.exit(); + output.error(error); } else { - process.stdout.write("success"); - process.stdout.write(endOfLine); - - process.stdout.write(commander.repository); - process.stdout.write(endOfLine); - - process.stdout.write(result); - process.stdout.write(endOfLine); - process.exit(); + output.success(commander.repository); } }); } catch (error) { - process.stdout.write("error"); - process.stdout.write(endOfLine); - - process.stdout.write(""); - process.stdout.write(endOfLine); - - if (error) { - process.stdout.write(error.toString()); - process.stdout.write(endOfLine); - } - - process.exit(); + output.error(error); } \ No newline at end of file diff --git a/octorun/src/bin/app-usage.js b/octorun/src/bin/app-usage.js index b13a23a88..07bd3b91c 100644 --- a/octorun/src/bin/app-usage.js +++ b/octorun/src/bin/app-usage.js @@ -3,6 +3,7 @@ var package = require('../../package.json') var endOfLine = require('os').EOL; var fs = require('fs'); var util = require('util'); +var output = require('../output'); commander .version(package.version) @@ -50,38 +51,20 @@ if (fileContents && host) { res.on('data', function (d) { if (success) { - process.stdout.write("success"); - process.stdout.write(endOfLine); - process.stdout.write(d); - process.stdout.write(endOfLine); + output.custom("success", d, true); } else { - process.stdout.write("error"); - process.stdout.write(endOfLine); - - process.stdout.write(""); - process.stdout.write(endOfLine); - - process.stdout.write(d); - process.stdout.write(endOfLine); + output.custom("error", "", true); } }); res.on('end', function (d) { - process.exit(success ? 0 : -1); + process.exit(); }); }); req.on('error', function (error) { - process.stdout.write("Error"); - process.stdout.write(endOfLine); - - if (error) { - process.stdout.write(error.toString()); - process.stdout.write(endOfLine); - } - - process.exit(-1); + output.error(error); }); req.write(fileContents); diff --git a/octorun/src/output.js b/octorun/src/output.js index 22b19bdcb..302ba76bf 100644 --- a/octorun/src/output.js +++ b/octorun/src/output.js @@ -1,6 +1,6 @@ var endOfLine = require('os').EOL; -var outputResult = function (status, results, errors) { +var outputResult = function (status, results, errors, preventExit) { process.stdout.write(status); process.stdout.write(endOfLine); @@ -44,19 +44,27 @@ var outputResult = function (status, results, errors) { process.stdout.write(endOfLine); } } + else if (errors.toString) { + process.stdout.write(errors.toString()); + process.stdout.write(endOfLine); + } else { process.stdout.write(errors); process.stdout.write(endOfLine); } } + + if(!preventExit) { + process.exit(); + } } var outputSuccess = function (results) { outputResult("success", results); } -var outputCustom = function (status, results) { - outputResult(status, results); +var outputCustom = function (status, results, preventExit) { + outputResult(status, results, undefined, preventExit); } var outputError = function (errors) { diff --git a/octorun/version b/octorun/version index 226095832..c73fafc49 100644 --- a/octorun/version +++ b/octorun/version @@ -1 +1 @@ -b91b7b60 \ No newline at end of file +560d8963 \ No newline at end of file diff --git a/src/GitHub.Api/Installer/OctorunInstaller.cs b/src/GitHub.Api/Installer/OctorunInstaller.cs index 1ee139c96..947ed4d71 100644 --- a/src/GitHub.Api/Installer/OctorunInstaller.cs +++ b/src/GitHub.Api/Installer/OctorunInstaller.cs @@ -102,7 +102,7 @@ public class OctorunInstallDetails public const string DefaultZipMd5Url = "https://ghfvs-installer.github.com/unity/octorun/octorun.zip.md5"; public const string DefaultZipUrl = "https://ghfvs-installer.github.com/unity/octorun/octorun.zip"; - public const string PackageVersion = "b91b7b60"; + public const string PackageVersion = "560d8963"; private const string PackageName = "octorun"; private const string zipFile = "octorun.zip"; diff --git a/src/GitHub.Api/Resources/octorun.zip b/src/GitHub.Api/Resources/octorun.zip index 24097006a..715f01787 100644 --- a/src/GitHub.Api/Resources/octorun.zip +++ b/src/GitHub.Api/Resources/octorun.zip @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dcdf06517450ccbad14e1bea863387bef84b24d3709eec50c371f918839606e6 -size 212554 +oid sha256:30effaa61535bb2456a2bbbd1fcfa506f22446da329a0df2a3bb9b1c1a4a9b22 +size 211928 From 1bc5aebd33e166aa92dd4dcd2300901557b8395b Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Mon, 26 Mar 2018 12:21:46 -0400 Subject: [PATCH 04/12] Missing variable declaration --- octorun/src/bin/app-organizations.js | 2 +- octorun/version | 2 +- src/GitHub.Api/Installer/OctorunInstaller.cs | 2 +- src/GitHub.Api/Resources/octorun.zip | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/octorun/src/bin/app-organizations.js b/octorun/src/bin/app-organizations.js index 7c7d6136f..480289aa1 100644 --- a/octorun/src/bin/app-organizations.js +++ b/octorun/src/bin/app-organizations.js @@ -16,7 +16,7 @@ try { output.error(error); } else { - results = []; + var results = []; for (var i = 0; i < result.length; i++) { results.push(result[i].name); results.push(result[i].login); diff --git a/octorun/version b/octorun/version index c73fafc49..015b922f5 100644 --- a/octorun/version +++ b/octorun/version @@ -1 +1 @@ -560d8963 \ No newline at end of file +8bc23505 \ No newline at end of file diff --git a/src/GitHub.Api/Installer/OctorunInstaller.cs b/src/GitHub.Api/Installer/OctorunInstaller.cs index 947ed4d71..891450f34 100644 --- a/src/GitHub.Api/Installer/OctorunInstaller.cs +++ b/src/GitHub.Api/Installer/OctorunInstaller.cs @@ -102,7 +102,7 @@ public class OctorunInstallDetails public const string DefaultZipMd5Url = "https://ghfvs-installer.github.com/unity/octorun/octorun.zip.md5"; public const string DefaultZipUrl = "https://ghfvs-installer.github.com/unity/octorun/octorun.zip"; - public const string PackageVersion = "560d8963"; + public const string PackageVersion = "8bc23505"; private const string PackageName = "octorun"; private const string zipFile = "octorun.zip"; diff --git a/src/GitHub.Api/Resources/octorun.zip b/src/GitHub.Api/Resources/octorun.zip index 715f01787..98a8b6f12 100644 --- a/src/GitHub.Api/Resources/octorun.zip +++ b/src/GitHub.Api/Resources/octorun.zip @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:30effaa61535bb2456a2bbbd1fcfa506f22446da329a0df2a3bb9b1c1a4a9b22 -size 211928 +oid sha256:c56b2f70a9449004489117844e6894a4541001ed20a6fb63bfc9aeacfd419010 +size 211930 From 484cd812dc67b14139c180473d6a43bb36222fd5 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Mon, 26 Mar 2018 12:29:37 -0400 Subject: [PATCH 05/12] Remove regex processing of special error cases --- octorun/src/authentication.js | 8 -------- octorun/version | 2 +- src/GitHub.Api/Authentication/LoginManager.cs | 12 +----------- src/GitHub.Api/Installer/OctorunInstaller.cs | 2 +- src/GitHub.Api/Resources/octorun.zip | 4 ++-- src/GitHub.Api/Tasks/OctorunTask.cs | 2 -- 6 files changed, 5 insertions(+), 25 deletions(-) diff --git a/octorun/src/authentication.js b/octorun/src/authentication.js index d724fca8f..43a2de5bb 100644 --- a/octorun/src/authentication.js +++ b/octorun/src/authentication.js @@ -2,9 +2,7 @@ var endOfLine = require('os').EOL; var config = require("./configuration"); var octokitWrapper = require("./octokit"); -var lockedRegex = new RegExp("number of login attempts exceeded", "gi"); var twoFactorRegex = new RegExp("must specify two-factor authentication otp code", "gi"); -var badCredentialsRegex = new RegExp("bad credentials", "gi"); var scopes = ["user", "repo", "gist", "write:public_key"]; @@ -48,12 +46,6 @@ var handleAuthentication = function (username, password, onSuccess, onFailure, t else if (twoFactorRegex.test(err.message)) { onSuccess(password, "2fa"); } - else if (lockedRegex.test(err.message)) { - onFailure("locked") - } - else if (badCredentialsRegex.test(err.message)) { - onFailure("badcredentials") - } else { onFailure(err) } diff --git a/octorun/version b/octorun/version index 015b922f5..338ffffd1 100644 --- a/octorun/version +++ b/octorun/version @@ -1 +1 @@ -8bc23505 \ No newline at end of file +196e9867 \ No newline at end of file diff --git a/src/GitHub.Api/Authentication/LoginManager.cs b/src/GitHub.Api/Authentication/LoginManager.cs index 269458668..437049c91 100644 --- a/src/GitHub.Api/Authentication/LoginManager.cs +++ b/src/GitHub.Api/Authentication/LoginManager.cs @@ -193,19 +193,9 @@ private async Task TryLogin( return new LoginResultData(resultCodes, message, host, ret.Output[0]); } - if (ret.IsBadCredentials) - { - return new LoginResultData(LoginResultCodes.Failed, "Bad credentials.", host, ret.Output[0]); - } - - if (ret.IsLocked) - { - return new LoginResultData(LoginResultCodes.LockedOut, "Account locked.", host, ret.Output[0]); - } - if (ret.Output.Any()) { - return new LoginResultData(LoginResultCodes.Failed, "Failed.", host, ret.Output[0]); + return new LoginResultData(LoginResultCodes.Failed, ret.Output[0], host); } return new LoginResultData(LoginResultCodes.Failed, "Failed.", host); diff --git a/src/GitHub.Api/Installer/OctorunInstaller.cs b/src/GitHub.Api/Installer/OctorunInstaller.cs index 891450f34..523fe392e 100644 --- a/src/GitHub.Api/Installer/OctorunInstaller.cs +++ b/src/GitHub.Api/Installer/OctorunInstaller.cs @@ -102,7 +102,7 @@ public class OctorunInstallDetails public const string DefaultZipMd5Url = "https://ghfvs-installer.github.com/unity/octorun/octorun.zip.md5"; public const string DefaultZipUrl = "https://ghfvs-installer.github.com/unity/octorun/octorun.zip"; - public const string PackageVersion = "8bc23505"; + public const string PackageVersion = "196e9867"; private const string PackageName = "octorun"; private const string zipFile = "octorun.zip"; diff --git a/src/GitHub.Api/Resources/octorun.zip b/src/GitHub.Api/Resources/octorun.zip index 98a8b6f12..290bf9eff 100644 --- a/src/GitHub.Api/Resources/octorun.zip +++ b/src/GitHub.Api/Resources/octorun.zip @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c56b2f70a9449004489117844e6894a4541001ed20a6fb63bfc9aeacfd419010 -size 211930 +oid sha256:b88a832fae41b944798323b91a745909bbf7d083fdf2455e2ec71dd51030523a +size 211853 diff --git a/src/GitHub.Api/Tasks/OctorunTask.cs b/src/GitHub.Api/Tasks/OctorunTask.cs index 1a0e04c58..2a28e824c 100644 --- a/src/GitHub.Api/Tasks/OctorunTask.cs +++ b/src/GitHub.Api/Tasks/OctorunTask.cs @@ -132,7 +132,5 @@ public OctorunResult(string status, string[] output) public bool IsSuccess => Status.Equals("success", StringComparison.InvariantCultureIgnoreCase); public bool IsError => Status.Equals("error", StringComparison.InvariantCultureIgnoreCase); public bool IsTwoFactorRequired => Status.Equals("2fa", StringComparison.InvariantCultureIgnoreCase); - public bool IsLocked => Output.First().Equals("locked", StringComparison.InvariantCultureIgnoreCase); - public bool IsBadCredentials => Output.First().Equals("badcredentials", StringComparison.InvariantCultureIgnoreCase); } } \ No newline at end of file From 804a8152cfc6eb2154665d2a3b03ecedfc4e8164 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Mon, 26 Mar 2018 12:55:06 -0400 Subject: [PATCH 06/12] Rename output processor --- src/GitHub.Api/Tasks/OctorunTask.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GitHub.Api/Tasks/OctorunTask.cs b/src/GitHub.Api/Tasks/OctorunTask.cs index 2a28e824c..9ebe258b9 100644 --- a/src/GitHub.Api/Tasks/OctorunTask.cs +++ b/src/GitHub.Api/Tasks/OctorunTask.cs @@ -8,7 +8,7 @@ namespace GitHub.Unity { - class OctorunTaskOutputProcessor : BaseOutputProcessor + class OctorunResultOutputProcessor : BaseOutputProcessor { private int lineCount; private string status; @@ -68,7 +68,7 @@ public OctorunTask(CancellationToken token, NPath pathToNodeJs, NPath pathToOcto string user = null, string userToken = null, IOutputProcessor processor = null) - : base(token, processor ?? new OctorunTaskOutputProcessor()) + : base(token, processor ?? new OctorunResultOutputProcessor()) { this.clientId = clientId; this.clientSecret = clientSecret; From 687e162c03e62b0aeaed9d047ee5a5abdefae7ea Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Mon, 26 Mar 2018 13:35:31 -0400 Subject: [PATCH 07/12] Adding an extension method to easily parse error api output --- src/GitHub.Api/Application/ApiClient.cs | 21 +++---------------- src/GitHub.Api/Authentication/LoginManager.cs | 7 +------ src/GitHub.Api/Tasks/OctorunTask.cs | 16 ++++++++++++++ 3 files changed, 20 insertions(+), 24 deletions(-) diff --git a/src/GitHub.Api/Application/ApiClient.cs b/src/GitHub.Api/Application/ApiClient.cs index 10a01e0f3..bf237ef48 100644 --- a/src/GitHub.Api/Application/ApiClient.cs +++ b/src/GitHub.Api/Application/ApiClient.cs @@ -247,12 +247,7 @@ private async Task CreateRepositoryInternal(string repositoryN }; } - if (ret.Output.Any()) - { - throw new ApiClientException(string.Join(Environment.NewLine, ret.Output)); - } - - throw new ApiClientException("Publish failed"); + throw new ApiClientException(ret.GetApiErrorMessage() ?? "Publish failed"); } catch (Exception ex) { @@ -294,12 +289,7 @@ private async Task GetOrganizationInternal(Action onSuccess, Act return; } - if (ret.Output.Any()) - { - throw new ApiClientException(string.Join(Environment.NewLine, ret.Output)); - } - - throw new ApiClientException("Error getting organizations"); + throw new ApiClientException(ret.GetApiErrorMessage() ?? "Error getting organizations"); } catch (Exception ex) { @@ -332,12 +322,7 @@ private async Task GetCurrentUserInternal() }; } - if (ret.Output.Any()) - { - throw new ApiClientException(string.Join(Environment.NewLine, ret.Output)); - } - - throw new ApiClientException("Error validating current user"); + throw new ApiClientException(ret.GetApiErrorMessage() ?? "Error validating current user"); } catch (KeychainEmptyException) { diff --git a/src/GitHub.Api/Authentication/LoginManager.cs b/src/GitHub.Api/Authentication/LoginManager.cs index 437049c91..ce0a85ad2 100644 --- a/src/GitHub.Api/Authentication/LoginManager.cs +++ b/src/GitHub.Api/Authentication/LoginManager.cs @@ -193,12 +193,7 @@ private async Task TryLogin( return new LoginResultData(resultCodes, message, host, ret.Output[0]); } - if (ret.Output.Any()) - { - return new LoginResultData(LoginResultCodes.Failed, ret.Output[0], host); - } - - return new LoginResultData(LoginResultCodes.Failed, "Failed.", host); + return new LoginResultData(LoginResultCodes.Failed, ret.GetApiErrorMessage() ?? "Failed.", host); } } diff --git a/src/GitHub.Api/Tasks/OctorunTask.cs b/src/GitHub.Api/Tasks/OctorunTask.cs index 9ebe258b9..34de2eae7 100644 --- a/src/GitHub.Api/Tasks/OctorunTask.cs +++ b/src/GitHub.Api/Tasks/OctorunTask.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using System.Linq; using System.Reflection; +using System.Text.RegularExpressions; using System.Threading; using GitHub.Logging; @@ -133,4 +134,19 @@ public OctorunResult(string status, string[] output) public bool IsError => Status.Equals("error", StringComparison.InvariantCultureIgnoreCase); public bool IsTwoFactorRequired => Status.Equals("2fa", StringComparison.InvariantCultureIgnoreCase); } + + static class OctorunResultExtensions { + private static Regex ApiErrorMessageRegex = new Regex(@"\""message\"":\""(.*?)\""", RegexOptions.Compiled); + + internal static string GetApiErrorMessage(this OctorunResult octorunResult) + { + if (!octorunResult.IsError || !octorunResult.Output.Any()) + { + return null; + } + + var match = ApiErrorMessageRegex.Match(octorunResult.Output[0]); + return match.Success ? match.Groups[1].Value : octorunResult.Output[0]; + } + } } \ No newline at end of file From a05f584a4d240551b0958abc41bef04abd3d1b0e Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Mon, 2 Apr 2018 13:54:03 -0400 Subject: [PATCH 08/12] Tweaking octorun output --- octorun/src/output.js | 11 ++++++----- octorun/version | 2 +- src/GitHub.Api/Installer/OctorunInstaller.cs | 2 +- src/GitHub.Api/Resources/octorun.zip | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/octorun/src/output.js b/octorun/src/output.js index 302ba76bf..cad4e002b 100644 --- a/octorun/src/output.js +++ b/octorun/src/output.js @@ -24,8 +24,9 @@ var outputResult = function (status, results, errors, preventExit) { process.stdout.write(endOfLine); } } - - throw "Unsupported result output"; + else { + throw "Unsupported result output"; + } } if (errors) { @@ -37,7 +38,7 @@ var outputResult = function (status, results, errors, preventExit) { for (var errorIndex = 0; errorIndex < errors.length; errorIndex++) { var error = errors[errorIndex]; if (typeof error !== 'string') { - throw "Unsupported result output"; + throw "Unsupported error output"; } process.stdout.write(error); @@ -47,14 +48,14 @@ var outputResult = function (status, results, errors, preventExit) { else if (errors.toString) { process.stdout.write(errors.toString()); process.stdout.write(endOfLine); - } + } else { process.stdout.write(errors); process.stdout.write(endOfLine); } } - if(!preventExit) { + if (!preventExit) { process.exit(); } } diff --git a/octorun/version b/octorun/version index 338ffffd1..cafd28a62 100644 --- a/octorun/version +++ b/octorun/version @@ -1 +1 @@ -196e9867 \ No newline at end of file +687e162c \ No newline at end of file diff --git a/src/GitHub.Api/Installer/OctorunInstaller.cs b/src/GitHub.Api/Installer/OctorunInstaller.cs index 523fe392e..0af4325ec 100644 --- a/src/GitHub.Api/Installer/OctorunInstaller.cs +++ b/src/GitHub.Api/Installer/OctorunInstaller.cs @@ -102,7 +102,7 @@ public class OctorunInstallDetails public const string DefaultZipMd5Url = "https://ghfvs-installer.github.com/unity/octorun/octorun.zip.md5"; public const string DefaultZipUrl = "https://ghfvs-installer.github.com/unity/octorun/octorun.zip"; - public const string PackageVersion = "196e9867"; + public const string PackageVersion = "687e162c"; private const string PackageName = "octorun"; private const string zipFile = "octorun.zip"; diff --git a/src/GitHub.Api/Resources/octorun.zip b/src/GitHub.Api/Resources/octorun.zip index 290bf9eff..e3ef894fb 100644 --- a/src/GitHub.Api/Resources/octorun.zip +++ b/src/GitHub.Api/Resources/octorun.zip @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b88a832fae41b944798323b91a745909bbf7d083fdf2455e2ec71dd51030523a -size 211853 +oid sha256:f24e7067d57002e10976a064f3c6753f253fb76fa1d67b4d9acfa4a1566b4962 +size 212470 From 46811135ee179e4f4f0288e6c59c9115a85217fc Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Mon, 2 Apr 2018 15:40:48 -0400 Subject: [PATCH 09/12] Updating octorun package --- octorun/src/bin/app-publish.js | 2 +- octorun/version | 2 +- src/GitHub.Api/Installer/OctorunInstaller.cs | 2 +- src/GitHub.Api/Resources/octorun.zip | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/octorun/src/bin/app-publish.js b/octorun/src/bin/app-publish.js index 7e60dd697..5fe602390 100644 --- a/octorun/src/bin/app-publish.js +++ b/octorun/src/bin/app-publish.js @@ -32,7 +32,7 @@ try { output.error(error); } else { - output.success(commander.repository); + output.success(result); } }); } diff --git a/octorun/version b/octorun/version index cafd28a62..5147e0be3 100644 --- a/octorun/version +++ b/octorun/version @@ -1 +1 @@ -687e162c \ No newline at end of file +0933c352 \ No newline at end of file diff --git a/src/GitHub.Api/Installer/OctorunInstaller.cs b/src/GitHub.Api/Installer/OctorunInstaller.cs index 2666bf17f..540b1ef51 100644 --- a/src/GitHub.Api/Installer/OctorunInstaller.cs +++ b/src/GitHub.Api/Installer/OctorunInstaller.cs @@ -102,7 +102,7 @@ public class OctorunInstallDetails public const string DefaultZipMd5Url = "https://ghfvs-installer.github.com/unity/octorun/octorun.zip.md5"; public const string DefaultZipUrl = "https://ghfvs-installer.github.com/unity/octorun/octorun.zip"; - public const string PackageVersion = "687e162c"; + public const string PackageVersion = "0933c352"; private const string PackageName = "octorun"; private const string zipFile = "octorun.zip"; diff --git a/src/GitHub.Api/Resources/octorun.zip b/src/GitHub.Api/Resources/octorun.zip index e3ef894fb..a31d06f40 100644 --- a/src/GitHub.Api/Resources/octorun.zip +++ b/src/GitHub.Api/Resources/octorun.zip @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f24e7067d57002e10976a064f3c6753f253fb76fa1d67b4d9acfa4a1566b4962 -size 212470 +oid sha256:77fbfa6bc9f87d1b999cec11de36d6d9d000aad8b5025120452fd9099e889947 +size 219625 From c05d41a65bf22f7f49a8c5a6c3d16ab5fd3a73cf Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Mon, 2 Apr 2018 15:52:42 -0400 Subject: [PATCH 10/12] Updating output of publish operation --- octorun/src/api.js | 12 ++++++------ octorun/version | 2 +- src/GitHub.Api/Installer/OctorunInstaller.cs | 2 +- src/GitHub.Api/Resources/octorun.zip | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/octorun/src/api.js b/octorun/src/api.js index 32322ef6a..fcaf96c50 100644 --- a/octorun/src/api.js +++ b/octorun/src/api.js @@ -65,24 +65,24 @@ ApiWrapper.prototype.getOrgs = function (callback) { }; ApiWrapper.prototype.publish = function (name, desc, private, organization, callback) { + var callbackHandler = function (error, result) { + callback(error, (!result) ? null : [result.data.name, result.data.clone_url]); + }; + if (organization) { this.octokit.repos.createForOrg({ org: organization, name: name, description: desc, private: private - }, function (error, result) { - callback(error, (!result) ? null : result.data.clone_url); - }); + }, callbackHandler); } else { this.octokit.repos.create({ name: name, description: desc, private: private - }, function (error, result) { - callback(error, (!result) ? null : result.data.clone_url); - }); + }, callbackHandler); } }; diff --git a/octorun/version b/octorun/version index 5147e0be3..0af082cdd 100644 --- a/octorun/version +++ b/octorun/version @@ -1 +1 @@ -0933c352 \ No newline at end of file +46811135 \ No newline at end of file diff --git a/src/GitHub.Api/Installer/OctorunInstaller.cs b/src/GitHub.Api/Installer/OctorunInstaller.cs index 540b1ef51..8b93c49d8 100644 --- a/src/GitHub.Api/Installer/OctorunInstaller.cs +++ b/src/GitHub.Api/Installer/OctorunInstaller.cs @@ -102,7 +102,7 @@ public class OctorunInstallDetails public const string DefaultZipMd5Url = "https://ghfvs-installer.github.com/unity/octorun/octorun.zip.md5"; public const string DefaultZipUrl = "https://ghfvs-installer.github.com/unity/octorun/octorun.zip"; - public const string PackageVersion = "0933c352"; + public const string PackageVersion = "46811135"; private const string PackageName = "octorun"; private const string zipFile = "octorun.zip"; diff --git a/src/GitHub.Api/Resources/octorun.zip b/src/GitHub.Api/Resources/octorun.zip index a31d06f40..8e580d84c 100644 --- a/src/GitHub.Api/Resources/octorun.zip +++ b/src/GitHub.Api/Resources/octorun.zip @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:77fbfa6bc9f87d1b999cec11de36d6d9d000aad8b5025120452fd9099e889947 -size 219625 +oid sha256:88514fe0aa33af8ccf81f31f4ca2d4e3b2e08df2f890bb1f18f8d9d5409f7a80 +size 219645 From 3cb4faf18842f6837de3cfa9f4a7ce334e6a233d Mon Sep 17 00:00:00 2001 From: Andreia Gaita Date: Tue, 3 Apr 2018 14:54:59 +0200 Subject: [PATCH 11/12] :art: Fix code style --- src/GitHub.Api/Tasks/OctorunTask.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/GitHub.Api/Tasks/OctorunTask.cs b/src/GitHub.Api/Tasks/OctorunTask.cs index 34de2eae7..f64fcc0cc 100644 --- a/src/GitHub.Api/Tasks/OctorunTask.cs +++ b/src/GitHub.Api/Tasks/OctorunTask.cs @@ -2,10 +2,8 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; -using System.Reflection; using System.Text.RegularExpressions; using System.Threading; -using GitHub.Logging; namespace GitHub.Unity { @@ -115,9 +113,6 @@ public override void Configure(ProcessStartInfo psi) class OctorunResult { - public string Status { get; } - public string[] Output { get; } - public OctorunResult() { Status = "error"; @@ -130,12 +125,15 @@ public OctorunResult(string status, string[] output) Output = output; } + public string Status { get; } + public string[] Output { get; } public bool IsSuccess => Status.Equals("success", StringComparison.InvariantCultureIgnoreCase); public bool IsError => Status.Equals("error", StringComparison.InvariantCultureIgnoreCase); public bool IsTwoFactorRequired => Status.Equals("2fa", StringComparison.InvariantCultureIgnoreCase); } - static class OctorunResultExtensions { + static class OctorunResultExtensions + { private static Regex ApiErrorMessageRegex = new Regex(@"\""message\"":\""(.*?)\""", RegexOptions.Compiled); internal static string GetApiErrorMessage(this OctorunResult octorunResult) @@ -149,4 +147,4 @@ internal static string GetApiErrorMessage(this OctorunResult octorunResult) return match.Success ? match.Groups[1].Value : octorunResult.Output[0]; } } -} \ No newline at end of file +} From 8d94815e1a8ccbd805b5c34c414daf896b8eccd3 Mon Sep 17 00:00:00 2001 From: Andreia Gaita Date: Tue, 3 Apr 2018 14:56:07 +0200 Subject: [PATCH 12/12] octorun.zip.md5 needs to always match octorun.zip --- src/GitHub.Api/Resources/octorun.zip.md5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GitHub.Api/Resources/octorun.zip.md5 b/src/GitHub.Api/Resources/octorun.zip.md5 index b10619984..e4f79b239 100644 --- a/src/GitHub.Api/Resources/octorun.zip.md5 +++ b/src/GitHub.Api/Resources/octorun.zip.md5 @@ -1 +1 @@ -7cdaa49008b8c996343e07670100bce2 \ No newline at end of file +070a4561bf70031ad54ca5884f97f546 \ No newline at end of file