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 # # I'm not sure where in npm they come from, but we don't want them anyhow :P
*.tmp *.tmp
# Exclude the auto-generated git commit hash & build date text files
commit-hash.txt
build-date.txt
### Autogenerated by gitignore.io ### ### Autogenerated by gitignore.io ###
# Autosave files # 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.ActiveCfg = Release|x86
{B7F806D9-9C50-4BA8-A803-0FC2EC5F5932}.Release|x86.Build.0 = Release|x86 {B7F806D9-9C50-4BA8-A803-0FC2EC5F5932}.Release|x86.Build.0 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
description = @An infinite whiteeboard for those big ideas.\nThis is the main server binary.
version = 0.6
EndGlobalSection
EndGlobal EndGlobal

View file

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

View file

@ -5,6 +5,8 @@ using System.IO;
using Nibriboard.RippleSpace; using Nibriboard.RippleSpace;
using Nibriboard.Client; using Nibriboard.Client;
using System.Reflection;
using SBRL.Utilities;
namespace Nibriboard namespace Nibriboard
{ {
@ -14,6 +16,29 @@ namespace Nibriboard
/// </summary> /// </summary>
public class NibriboardServer 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 ClientSettings clientSettings;
private CommandConsole commandServer; 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: "); Log.WriteLine("[core] Detected embedded files: ");
EmbeddedFiles.WriteResourceList(); EmbeddedFiles.WriteResourceList();

View file

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