diff --git a/doc/history.txt b/doc/history.txt
index f4afdcc..2ab482b 100644
--- a/doc/history.txt
+++ b/doc/history.txt
@@ -10,67 +10,4 @@ For more information about issues or new feature requests, please visit:
Project website: https://github.com/CatenaLogic/GitLink/
-**********************************************************
-
-==================
-Version 1.4.0
-==================
-
-Release date:
-=============
-2014/xx/xx
-
-Added/fixed:
-============
-(x) #8 Console stays red after an error occurs
-
-**********************************************************
-
-
-==================
-Version 1.2.0/1.3.0
-==================
-
-Release date:
-=============
-2014/04/20
-
-Added/fixed:
-============
-(*) #7 Show relative paths to make to file names easier to read
-(x) #5 When an error occurs, the console application will no longer wait for a key input press to prevent
- it from blocking a build
-
-**********************************************************
-
-
-==================
-Version 1.1.0
-==================
-
-Release date:
-=============
-2014/04/19
-
-Added/fixed:
-============
-(+) #1 Created Chocolatey package for easier deployment
-(+) #2 Added support for VB projects
-(+) #3 Created NuGet package for deployment when being referenced from code
-
-**********************************************************
-
-
-==================
-Version 1.0.0
-==================
-
-Release date:
-=============
-2014/04/17
-
-Added/fixed:
-============
-First initial release
-
-**********************************************************
+**********************************************************
\ No newline at end of file
diff --git a/src/GitLink.Tests/ContextFacts.cs b/src/GitLink.Tests/ContextFacts.cs
index 9458a6e..e5a771e 100644
--- a/src/GitLink.Tests/ContextFacts.cs
+++ b/src/GitLink.Tests/ContextFacts.cs
@@ -7,6 +7,7 @@
namespace GitLink.Tests
{
+ using System;
using Catel.Test;
using GitLink.Providers;
using NUnit.Framework;
@@ -72,6 +73,23 @@ public void SucceedsForValidContext()
// should not throw
context.ValidateContext();
}
+
+ [TestCase(@".", @"c:\")]
+ [TestCase(@"C:\MyDirectory\", @"C:\MyDirectory\")]
+ [TestCase(@"C:\MyDirectory\..", @"C:\")]
+ [TestCase(@"C:\MyDirectory\..\TestDirectory\", @"C:\TestDirectory\")]
+ public void ExpandsDirectoryIfRequired(string solutionDirectory, string expectedValue)
+ {
+ Environment.CurrentDirectory = @"c:\";
+
+ var context = new Context(new ProviderManager());
+ context.TargetUrl = "https://github.com/CatenaLogic/GitLink.git";
+ context.SolutionDirectory = solutionDirectory;
+
+ context.ValidateContext();
+
+ Assert.AreEqual(expectedValue, context.SolutionDirectory);
+ }
}
}
}
\ No newline at end of file
diff --git a/src/GitLink/Context.cs b/src/GitLink/Context.cs
index 5e4be67..f5c3af6 100644
--- a/src/GitLink/Context.cs
+++ b/src/GitLink/Context.cs
@@ -1,89 +1,96 @@
-// --------------------------------------------------------------------------------------------------------------------
-//
-// Copyright (c) 2014 - 2014 CatenaLogic. All rights reserved.
-//
-// --------------------------------------------------------------------------------------------------------------------
-
-
-namespace GitLink
-{
- using Catel;
- using Catel.Logging;
- using Providers;
-
- public class Context
- {
- private static readonly ILog Log = LogManager.GetCurrentClassLogger();
-
- private readonly IProviderManager _providerManager;
- private IProvider _provider;
-
- public Context(IProviderManager providerManager)
- {
- Argument.IsNotNull(() => providerManager);
-
- _providerManager = providerManager;
-
- Authentication = new Authentication();
- ConfigurationName = "Release";
- }
-
- public bool IsHelp { get; set; }
-
- public string LogFile { get; set; }
-
- public string SolutionDirectory { get; set; }
-
- public string ConfigurationName { get; set; }
-
- public Authentication Authentication { get; private set; }
-
- public IProvider Provider
- {
- get
- {
- if (_provider == null)
- {
- _provider = _providerManager.GetProvider(TargetUrl);
- }
-
- return _provider;
- }
- set
- {
- _provider = value;
- }
- }
-
- public string TargetUrl { get; set; }
-
- public string TargetBranch { get; set; }
-
+// --------------------------------------------------------------------------------------------------------------------
+//
+// Copyright (c) 2014 - 2014 CatenaLogic. All rights reserved.
+//
+// --------------------------------------------------------------------------------------------------------------------
+
+
+namespace GitLink
+{
+ using System;
+ using Catel;
+ using Catel.IO;
+ using Catel.Logging;
+ using Providers;
+
+ public class Context
+ {
+ private static readonly ILog Log = LogManager.GetCurrentClassLogger();
+
+ private readonly IProviderManager _providerManager;
+ private IProvider _provider;
+
+ public Context(IProviderManager providerManager)
+ {
+ Argument.IsNotNull(() => providerManager);
+
+ _providerManager = providerManager;
+
+ Authentication = new Authentication();
+ ConfigurationName = "Release";
+ }
+
+ public bool IsHelp { get; set; }
+
+ public string LogFile { get; set; }
+
+ public string SolutionDirectory { get; set; }
+
+ public string ConfigurationName { get; set; }
+
+ public Authentication Authentication { get; private set; }
+
+ public IProvider Provider
+ {
+ get
+ {
+ if (_provider == null)
+ {
+ _provider = _providerManager.GetProvider(TargetUrl);
+ }
+
+ return _provider;
+ }
+ set
+ {
+ _provider = value;
+ }
+ }
+
+ public string TargetUrl { get; set; }
+
+ public string TargetBranch { get; set; }
+
public string ShaHash { get; set; }
- public string SolutionFile { get; set; }
-
- public void ValidateContext()
- {
- if (string.IsNullOrEmpty(SolutionDirectory))
- {
- Log.ErrorAndThrowException("Solution directory is missing");
- }
-
- if (string.IsNullOrEmpty(ConfigurationName))
- {
- Log.ErrorAndThrowException("Configuration name is missing");
- }
-
- if (string.IsNullOrEmpty(TargetUrl))
- {
- Log.ErrorAndThrowException("Target url is missing");
- }
-
- if (Provider == null)
- {
- Log.ErrorAndThrowException("Cannot determine git provider");
- }
- }
- }
+ public string SolutionFile { get; set; }
+
+ public void ValidateContext()
+ {
+ if (!string.IsNullOrWhiteSpace(SolutionDirectory))
+ {
+ SolutionDirectory = Path.GetFullPath(SolutionDirectory, Environment.CurrentDirectory);
+ }
+
+ if (string.IsNullOrEmpty(SolutionDirectory))
+ {
+ Log.ErrorAndThrowException("Solution directory is missing");
+ }
+
+ if (string.IsNullOrEmpty(ConfigurationName))
+ {
+ Log.ErrorAndThrowException("Configuration name is missing");
+ }
+
+ if (string.IsNullOrEmpty(TargetUrl))
+ {
+ Log.ErrorAndThrowException("Target url is missing");
+ }
+
+ if (Provider == null)
+ {
+ Log.ErrorAndThrowException("Cannot determine git provider");
+ }
+ }
+ }
}
\ No newline at end of file