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

Commit

Permalink
There is no reason for version info to be duplicated in csq
Browse files Browse the repository at this point in the history
  • Loading branch information
caesay committed Aug 20, 2022
1 parent 35f177b commit 967c76b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/Squirrel.Tool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,17 @@
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
using Microsoft.Build.Construction;
using Mono.Options;
using NuGet.Common;
using NuGet.Versioning;
using Squirrel.CommandLine;
using LogLevel = Squirrel.SimpleSplat.LogLevel;

namespace Squirrel.Tool
{
class Program
{
#pragma warning disable CS0436
public static string SquirrelDisplayVersion => ThisAssembly.AssemblyInformationalVersion + (ThisAssembly.IsPublicRelease ? "" : " (prerelease)");
public static NuGetVersion SquirrelNugetVersion => NuGetVersion.Parse(ThisAssembly.AssemblyInformationalVersion);
#pragma warning restore CS0436

const string CLOWD_PACKAGE_NAME = "Clowd.Squirrel";

private static ConsoleLogger _logger;
Expand Down Expand Up @@ -57,7 +48,7 @@ static int MainInner(string[] inargs)
_logger.Level = LogLevel.Debug;
}

Console.WriteLine($"Squirrel Locator 'csq' {SquirrelDisplayVersion}");
Console.WriteLine($"Squirrel Locator 'csq' {SquirrelRuntimeInfo.SquirrelDisplayVersion}");
_logger.Write($"Entry EXE: {SquirrelRuntimeInfo.EntryExePath}", LogLevel.Debug);

CheckForUpdates();
Expand Down Expand Up @@ -142,7 +133,7 @@ int runSquirrel(string version)
static void CheckForUpdates()
{
try {
var myVer = SquirrelNugetVersion;
var myVer = SquirrelRuntimeInfo.SquirrelNugetVersion;
var dl = new NugetDownloader(_logger);
var package = dl.GetPackageMetadata("csq", (myVer.IsPrerelease || myVer.HasMetadata) ? "pre" : "latest");
if (package.Identity.Version > myVer)
Expand Down
4 changes: 4 additions & 0 deletions src/Squirrel/SquirrelRuntimeInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using NuGet.Versioning;
using Squirrel.SimpleSplat;

#if !NETFRAMEWORK
Expand Down Expand Up @@ -66,6 +67,9 @@ public static class SquirrelRuntimeInfo
/// <summary> The current compiled Squirrel display version. </summary>
public static string SquirrelDisplayVersion => ThisAssembly.AssemblyInformationalVersion + (ThisAssembly.IsPublicRelease ? "" : " (prerelease)");

/// <summary> The current compiled Squirrel NuGetVersion. </summary>
public static NuGetVersion SquirrelNugetVersion => NuGetVersion.Parse(ThisAssembly.AssemblyInformationalVersion);

/// <summary> The current compiled Squirrel assembly file version. </summary>
public static string SquirrelFileVersion => ThisAssembly.AssemblyFileVersion;

Expand Down

0 comments on commit 967c76b

Please sign in to comment.