This repository has been archived by the owner on Feb 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#44 Added support for relative paths ($(MSBuildProjectDirectory)\..) …
…for the solution directory
- Loading branch information
1 parent
eaaef20
commit 47d3e06
Showing
3 changed files
with
112 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,96 @@ | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
// <copyright file="Context.cs" company="CatenaLogic"> | ||
// Copyright (c) 2014 - 2014 CatenaLogic. All rights reserved. | ||
// </copyright> | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
|
||
|
||
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 file="Context.cs" company="CatenaLogic"> | ||
// Copyright (c) 2014 - 2014 CatenaLogic. All rights reserved. | ||
// </copyright> | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
|
||
|
||
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<GitLinkException>("Solution directory is missing"); | ||
} | ||
|
||
if (string.IsNullOrEmpty(ConfigurationName)) | ||
{ | ||
Log.ErrorAndThrowException<GitLinkException>("Configuration name is missing"); | ||
} | ||
|
||
if (string.IsNullOrEmpty(TargetUrl)) | ||
{ | ||
Log.ErrorAndThrowException<GitLinkException>("Target url is missing"); | ||
} | ||
|
||
if (Provider == null) | ||
{ | ||
Log.ErrorAndThrowException<GitLinkException>("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<GitLinkException>("Solution directory is missing"); | ||
} | ||
|
||
if (string.IsNullOrEmpty(ConfigurationName)) | ||
{ | ||
Log.ErrorAndThrowException<GitLinkException>("Configuration name is missing"); | ||
} | ||
|
||
if (string.IsNullOrEmpty(TargetUrl)) | ||
{ | ||
Log.ErrorAndThrowException<GitLinkException>("Target url is missing"); | ||
} | ||
|
||
if (Provider == null) | ||
{ | ||
Log.ErrorAndThrowException<GitLinkException>("Cannot determine git provider"); | ||
} | ||
} | ||
} | ||
} |