Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 0fac09d

Browse files
Merge branch 'master' into fixes/locks-in-usage-tracker
# Conflicts: # src/GitHub.Api/Metrics/UsageTracker.cs
2 parents df0703c + 8cd070a commit 0fac09d

File tree

22 files changed

+245
-158
lines changed

22 files changed

+245
-158
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ You can reach the team right here by opening a [new issue](https://github.com/gi
66

77
[![Build Status](https://ci.appveyor.com/api/projects/status/github/github-for-unity/Unity?branch=master&svg=true)](https://ci.appveyor.com/project/github-windows/unity)
88

9-
[![Join the chat at https://gitter.im/github-for-unity/Unity](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/github-for-unity/Unity?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
109
[![Join the chat at https://discord.gg/5zH8hVx](https://img.shields.io/badge/discord-join%20chat-7289DA.svg)](https://discord.gg/5zH8hVx)
1110
[![GitHub for Unity live coding on Twitch](https://img.shields.io/badge/twitch-live%20coding-6441A4.svg)](https://www.twitch.tv/sh4na)
1211

common/SolutionInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ internal static class AssemblyVersionInformation {
3434
// this is for the AssemblyVersion and AssemblyVersion attributes, which can't handle alphanumerics
3535
internal const string VersionForAssembly = "1.0.0";
3636
// Actual real version
37-
internal const string Version = "1.0.0rc2";
37+
internal const string Version = "1.0.0rc3";
3838
}
3939
}

octorun/src/bin/app-usage.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var commander = require("commander");
22
var package = require('../../package.json')
3+
var config = require("../configuration");
34
var endOfLine = require('os').EOL;
45
var fs = require('fs');
56
var util = require('util');
@@ -45,6 +46,9 @@ if (fileContents && host) {
4546
'Content-Type': 'application/json'
4647
}
4748
};
49+
if (config.token) {
50+
options.headers['Authorization'] = 'token ' + config.token;
51+
}
4852

4953
var req = https.request(options, function (res) {
5054
var success = res.statusCode == 200;

octorun/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9fcd9faa
1+
b4b80eb4ac

src/GitHub.Api/Application/ApplicationManagerBase.cs

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ protected void Initialize()
4747
ApplicationConfiguration.WebTimeout = UserSettings.Get(Constants.WebTimeoutKey, ApplicationConfiguration.WebTimeout);
4848
Platform.Initialize(ProcessManager, TaskManager);
4949
progress.OnProgress += progressReporter.UpdateProgress;
50+
UsageTracker = new UsageTracker(UserSettings, Environment, InstanceId.ToString());
51+
52+
#if ENABLE_METRICS
53+
var metricsService = new MetricsService(ProcessManager,
54+
TaskManager,
55+
Environment.FileSystem,
56+
Environment.NodeJsExecutablePath,
57+
Environment.OctorunScriptPath);
58+
UsageTracker.MetricsService = metricsService;
59+
#endif
5060
}
5161

5262
public void Run()
@@ -59,8 +69,7 @@ public void Run()
5969
GitInstallationState state = new GitInstallationState();
6070
try
6171
{
62-
SetupMetrics(Environment.UnityVersion);
63-
72+
SetupMetrics();
6473
if (Environment.IsMac)
6574
{
6675
var getEnvPath = new SimpleProcessTask(TaskManager.Token, "bash".ToNPath(), "-c \"/usr/libexec/path_helper\"")
@@ -301,35 +310,14 @@ public void RestartRepository()
301310
Logger.Trace($"Got a repository? {(Environment.Repository != null ? Environment.Repository.LocalPath : "null")}");
302311
}
303312

304-
protected void SetupMetrics(string unityVersion)
313+
protected void SetupMetrics()
305314
{
306-
string userId = null;
307-
if (UserSettings.Exists(Constants.GuidKey))
308-
{
309-
userId = UserSettings.Get(Constants.GuidKey);
310-
}
311-
312-
if (String.IsNullOrEmpty(userId))
313-
{
314-
userId = Guid.NewGuid().ToString();
315-
UserSettings.Set(Constants.GuidKey, userId);
316-
}
317-
318-
#if ENABLE_METRICS
319-
var metricsService = new MetricsService(ProcessManager,
320-
TaskManager,
321-
Environment.FileSystem,
322-
Environment.NodeJsExecutablePath,
323-
Environment.OctorunScriptPath);
324-
325-
UsageTracker = new UsageTracker(metricsService, UserSettings, Environment, userId, unityVersion, InstanceId.ToString());
326-
327315
if (firstRun)
328316
{
329317
UsageTracker.IncrementNumberOfStartups();
330318
}
331-
#endif
332319
}
320+
333321
protected abstract void InitializeUI();
334322
protected abstract void InitializationComplete();
335323

src/GitHub.Api/IO/NiceIO.cs

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -688,20 +688,27 @@ public void Delete(DeleteMode deleteMode = DeleteMode.Normal)
688688
if (IsRoot)
689689
throw new NotSupportedException("Delete is not supported on a root level directory because it would be dangerous:" + ToString());
690690

691-
if (FileExists())
692-
FileSystem.FileDelete(ToString());
693-
else if (DirectoryExists())
694-
try
691+
var isFile = FileExists();
692+
var isDir = DirectoryExists();
693+
if (!isFile && !isDir)
694+
throw new InvalidOperationException("Trying to delete a path that does not exist: " + ToString());
695+
696+
try
697+
{
698+
if (isFile)
695699
{
696-
FileSystem.DirectoryDelete(ToString(), true);
700+
FileSystem.FileDelete(ToString());
697701
}
698-
catch (IOException)
702+
else
699703
{
700-
if (deleteMode == DeleteMode.Normal)
701-
throw;
704+
FileSystem.DirectoryDelete(ToString(), true);
702705
}
703-
else
704-
throw new InvalidOperationException("Trying to delete a path that does not exist: " + ToString());
706+
}
707+
catch (IOException)
708+
{
709+
if (deleteMode == DeleteMode.Normal)
710+
throw;
711+
}
705712
}
706713

707714
public void DeleteIfExists(DeleteMode deleteMode = DeleteMode.Normal)

src/GitHub.Api/Installer/OctorunInstaller.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public class OctorunInstallDetails
8585
public const string DefaultZipMd5Url = "http://github-vs.s3.amazonaws.com/unity/octorun/octorun.zip.md5";
8686
public const string DefaultZipUrl = "http://github-vs.s3.amazonaws.com/unity/octorun/octorun.zip";
8787

88-
public const string PackageVersion = "9fcd9faa";
88+
public const string PackageVersion = "b4b80eb4ac";
8989
private const string PackageName = "octorun";
9090
private const string zipFile = "octorun.zip";
9191

src/GitHub.Api/Localization.Designer.cs

Lines changed: 46 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)