1
0
Fork 0
mirror of https://github.com/sbrl/Nibriboard.git synced 2018-01-10 21:33:49 +00:00

[server] Add git commit hash & build daate & time to assembly, and add header when starting the server

This commit is contained in:
Starbeamrainbowlabs 2017-12-23 13:33:00 +00:00
parent 22ba2c42e4
commit cc4ebc6c65
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
6 changed files with 49 additions and 8 deletions

4
.gitignore vendored
View file

@ -11,6 +11,10 @@ Nibriboard/ClientFiles/NibriClient.js
# # I'm not sure where in npm they come from, but we don't want them anyhow :P
*.tmp
# Exclude the auto-generated git commit hash & build date text files
commit-hash.txt
build-date.txt
### Autogenerated by gitignore.io ###
# Autosave files

View file

@ -19,4 +19,8 @@ Global
{B7F806D9-9C50-4BA8-A803-0FC2EC5F5932}.Release|x86.ActiveCfg = Release|x86
{B7F806D9-9C50-4BA8-A803-0FC2EC5F5932}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
description = @An infinite whiteeboard for those big ideas.\nThis is the main server binary.
version = 0.6
EndGlobalSection
EndGlobal

View file

@ -8,6 +8,7 @@
<RootNamespace>Nibriboard</RootNamespace>
<AssemblyName>Nibriboard</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<ReleaseVersion>0.6</ReleaseVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
@ -60,8 +61,6 @@
<Exec IgnoreExitCode="true" WorkingDirectory="$(ProjectDir)" Command="git submodule update --init" />
<MakeDir Directories="$(ProjectDir)/obj/client_dist" />
<Message Importance="high" Text="------[ Gliding Squirrel ]------" />
<MSBuild Projects="$(ProjectDir)/lib/GlidingSquirrel/GlidingSquirrel/GlidingSquirrel.csproj" Properties="Configuration=$(Configuration)" />
<Message Importance="high" Text="----------[ npm build ]----------" />
<Exec WorkingDirectory="$(ProjectDir)/ClientFiles" Condition="!Exists('node_modules/')" Command="npm install" />
@ -81,12 +80,14 @@
<Output ItemName="EmbeddedResource" TaskParameter="Include" />
</CreateItem>
<Exec WorkingDirectory="$(ProjectDir)" Command="git rev-parse HEAD &gt;commit-hash.txt" />
<Exec WorkingDirectory="$(ProjectDir)" Command="date --rfc-3339 seconds &gt;build-date.txt" />
</Target>
<!-- todo: try a RemoveDir in a Before/After Clean -->
<ItemGroup>
<FileWrites Include="$(ProjectDir)/ClientFiles/node_modules/**/*" />
</ItemGroup>
</Target>
<ItemGroup>
<Compile Include="Program.cs" />
@ -144,6 +145,10 @@
<Compile Include="Client\Messages\LineRemoveMessage.cs" />
<Compile Include="CommandConsole.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="commit-hash.txt" />
<EmbeddedResource Include="build-date.txt" />
</ItemGroup>
<!--
<ItemGroup>
<EmbeddedResource Include="ClientFiles\index.html" />

View file

@ -5,6 +5,8 @@ using System.IO;
using Nibriboard.RippleSpace;
using Nibriboard.Client;
using System.Reflection;
using SBRL.Utilities;
namespace Nibriboard
{
@ -14,6 +16,29 @@ namespace Nibriboard
/// </summary>
public class NibriboardServer
{
/// <summary>
/// Gets the version of this Nibriboard Server instance.
/// </summary>
/// <value>The version.</value>
public static string Version {
get {
Version asmVersion = Assembly.GetExecutingAssembly().GetName().Version;
string commit = EmbeddedFiles.ReadAllText("Nibriboard.commit-hash.txt");
return $"{asmVersion.Major}.{asmVersion.Minor}.{asmVersion.Build}-{commit.Substring(0, 7)}";
}
}
/// <summary>
/// Gets the date on which this Nibriboard server instance was built.
/// </summary>
/// <value>The build date.</value>
public static DateTime BuildDate {
get {
DateTime result = DateTime.MinValue;
DateTime.TryParse(EmbeddedFiles.ReadAllText("Nibriboard.build-date.txt"), out result);
return result;
}
}
private ClientSettings clientSettings;
private CommandConsole commandServer;

View file

@ -37,7 +37,10 @@ namespace Nibriboard
}
}
Log.WriteLine("[core] Starting Nibriboard.");
Log.WriteLine($"[core] Nibriboard Server {NibriboardServer.Version}, built on {NibriboardServer.BuildDate.ToString("R")}");
Log.WriteLine("[core] An infinite whiteboard for those big ideas.");
Log.WriteLine("[core] By Starbeamrainbowlabs");
Log.WriteLine("[core] Starting");
Log.WriteLine("[core] Detected embedded files: ");
EmbeddedFiles.WriteResourceList();

View file

@ -11,7 +11,7 @@ namespace SBRL.Utilities
/// A collection of static methods for manipulating embedded resources.
/// </summary>
/// <description>
/// v0.3, by Starbeamrainbowlabs <feedback@starbeamrainbowlabs.com>
/// v0.3, by Starbeamrainbowlabs &gt;feedback@starbeamrainbowlabs.com&lt;
/// Last updated 8th August 2016.
/// Licensed under MPL-2.0.
///