Permalink
Browse files

Reduces size of vanity message (closes #24)

  • Loading branch information...
1 parent eff3f24 commit 12c91d7ed739fc64fc77599adb0aecbf3515d429 @serialseb serialseb committed Apr 6, 2012
Showing with 21 additions and 9 deletions.
  1. +11 −3 src/OpenWrap.Shell/BootstrapRunner.cs
  2. +9 −5 src/OpenWrap.Shell/ConsoleNotifier.cs
  3. +1 −1 src/OpenWrap.Shell/INotifier.cs
View
14 src/OpenWrap.Shell/BootstrapRunner.cs
@@ -159,16 +159,24 @@ void LogFoundPackages(IEnumerable<string> bootstrapPackages)
void NotifyVersion(Assembly assembly)
{
- Version fileVersion = null;
+ SemanticVersion fileVersion = null;
try
{
var version = FileVersionInfo.GetVersionInfo(assembly.Location);
- fileVersion = new Version(version.FileVersion);
+ fileVersion = SemanticVersion.TryParseExact(version.FileVersion);
}
catch
{
}
- _notifier.BootstraperIs(assembly.Location, fileVersion ?? assembly.GetName().Version);
+ if (fileVersion == null)
+ {
+ var attrib = Attribute.GetCustomAttribute(assembly, typeof(AssemblyInformationalVersionAttribute));
+ if (attrib != null)
+ fileVersion = SemanticVersion.TryParseExact(((AssemblyInformationalVersionAttribute)attrib).InformationalVersion);
+ }
+ if (fileVersion == null)
+ fileVersion = SemanticVersion.TryParseExact(assembly.GetName().Version.ToString());
+ _notifier.BootstraperIs(assembly.Location, fileVersion);
}
BootstrapResult ExecuteEntrypoint(string[] args, KeyValuePair<Type, Func<string[], int>> entryPoint)
{
View
14 src/OpenWrap.Shell/ConsoleNotifier.cs
@@ -1,19 +1,23 @@
using System;
using System.Diagnostics;
+using System.IO;
+using System.Reflection;
namespace OpenWrap
{
public class ConsoleNotifier : INotifier
{
int _downloadProgress;
- public void BootstraperIs(string entrypointFile, Version entrypointVersion)
+ public void BootstraperIs(string entrypointFile, SemanticVersion entrypointVersion)
{
var version = FileVersionInfo.GetVersionInfo(typeof(ConsoleNotifier).Assembly.Location);
- Console.WriteLine("# OpenWrap Shell {0}", version.FileVersion);
- Console.WriteLine("# " + version.LegalCopyright);
- Console.WriteLine("# Using {0} ({1})", entrypointFile, entrypointVersion);
- Console.WriteLine();
+ var entrypointName = AssemblyName.GetAssemblyName(entrypointFile).Name;
+ Console.WriteLine("# {0} v{1} (shell v{2})", entrypointName, entrypointVersion, version.FileVersion);
+ //Console.WriteLine("# OpenWrap Shell {0}", version.FileVersion);
+ //Console.WriteLine("# " + version.LegalCopyright);
+ //Console.WriteLine("# Using {0} ({1})", entrypointFile, entrypointVersion);
+ //Console.WriteLine();
}
public BootstrapResult BootstrappingFailed(Exception exception)
View
2 src/OpenWrap.Shell/INotifier.cs
@@ -7,7 +7,7 @@ public interface INotifier : INotifyDownload
{
BootstrapResult BootstrappingFailed(Exception exception);
BootstrapResult RunFailed(Exception e);
- void BootstraperIs(string entrypointFile, Version entrypointVersion);
+ void BootstraperIs(string entrypointFile, SemanticVersion entrypointVersion);
void Message(string message, params object[] messageParameters);
InstallAction InstallOptions();
}

0 comments on commit 12c91d7

Please sign in to comment.