本文整理汇总了C#中IIntegrationResult.BaseFromWorkingDirectory方法的典型用法代码示例。如果您正苦于以下问题:C# IIntegrationResult.BaseFromWorkingDirectory方法的具体用法?C# IIntegrationResult.BaseFromWorkingDirectory怎么用?C# IIntegrationResult.BaseFromWorkingDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IIntegrationResult
的用法示例。
在下文中一共展示了IIntegrationResult.BaseFromWorkingDirectory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSource
public override void GetSource(IIntegrationResult result)
{
result.BuildProgressInformation.SignalStartRunTask("Getting source from Vault");
if (!_shim.AutoGetSource) return;
if (_folderVersion <= 0)
{
throw new CruiseControlException("_folderVersion <= 0 when attempting to get source. This shouldn't happen.");
}
if (_shim.CleanCopy)
{
string cleanCopyWorkingFolder = null;
if (string.IsNullOrEmpty(_shim.WorkingDirectory))
{
cleanCopyWorkingFolder = GetVaultWorkingFolder(result);
if (string.IsNullOrEmpty(cleanCopyWorkingFolder))
throw new VaultException(
string.Format("Vault user {0} has no working folder set for {1} in repository {2} and no working directory has been specified.",
_shim.Username, _shim.Folder, _shim.Repository));
}
else
cleanCopyWorkingFolder = result.BaseFromWorkingDirectory(_shim.WorkingDirectory);
Log.Debug("Cleaning out source folder: " + cleanCopyWorkingFolder);
fileDirectoryDeleter.DeleteIncludingReadOnlyObjects(cleanCopyWorkingFolder);
}
Log.Info("Getting source from Vault");
Execute(GetSourceProcessInfo(result));
}
示例2: GetSource
public override void GetSource(IIntegrationResult result)
{
if (!_shim.AutoGetSource) return;
Debug.Assert(_folderVersion > 0, "_folderVersion <= 0 when attempting to get source. This shouldn't happen.");
if (_shim.CleanCopy)
{
string cleanCopyWorkingFolder = null;
if (StringUtil.IsBlank(_shim.WorkingDirectory))
{
cleanCopyWorkingFolder = GetVaultWorkingFolder(result);
if (StringUtil.IsBlank(cleanCopyWorkingFolder))
throw new VaultException(
string.Format("Vault user {0} has no working folder set for {1} in repository {2} and no working directory has been specified.",
_shim.Username, _shim.Folder, _shim.Repository));
}
else
cleanCopyWorkingFolder = result.BaseFromWorkingDirectory(_shim.WorkingDirectory);
Log.Debug("Cleaning out source folder: " + cleanCopyWorkingFolder);
new IoService().EmptyDirectoryIncludingReadOnlyObjects(cleanCopyWorkingFolder);
}
Log.Info("Getting source from Vault");
Execute(GetSourceProcessInfo(result));
}
示例3: Evaluate
/// <summary>
/// Performs the actual evaluation.
/// </summary>
/// <param name="result">The result.</param>
/// <returns>
/// <c>true</c> if the condition is true; <c>false</c> otherwise.
/// </returns>
protected override bool Evaluate(IIntegrationResult result)
{
var folderName = result.BaseFromWorkingDirectory(this.FolderName);
this.LogDescriptionOrMessage("Checking for folder '" + folderName + "'");
var fileSystem = this.FileSystem ?? new SystemIoFileSystem();
var exists = fileSystem.DirectoryExists(folderName);
return exists;
}
示例4: GetModifications
public Modification[] GetModifications(IIntegrationResult from, IIntegrationResult to)
{
var path = to.BaseFromWorkingDirectory(this.FileName);
using (var reader = new StreamReader(path))
{
var parser = new IndexFileHistoryParser();
return parser.Parse(reader, from.StartTime, to.StartTime);
}
}
示例5: Generate
/// <summary>
/// Generate a manifest for a package.
/// </summary>
/// <param name="result">The result of the build.</param>
/// <param name="packagedFiles">The files that were packaged.</param>
/// <returns>An <see cref="XmlDocument"/> containing the manifest.</returns>
public XmlDocument Generate(IIntegrationResult result, string[] packagedFiles)
{
if (string.IsNullOrEmpty(fileName)) throw new ArgumentOutOfRangeException("FileName");
XmlDocument manifest = new XmlDocument();
string actualFile = fileName;
if (!Path.IsPathRooted(actualFile)) actualFile = result.BaseFromWorkingDirectory(actualFile);
manifest.Load(actualFile);
return manifest;
}
示例6: GetSource
public void GetSource(IIntegrationResult result)
{
foreach (var modification in result.Modifications)
{
var source = Path.Combine(
modification.FolderName,
modification.FileName);
var destination = result.BaseFromWorkingDirectory(
modification.FileName);
if (File.Exists(source))
{
File.Copy(source, destination, true);
}
else
{
File.Delete(destination);
}
}
}
示例7: ExecuteCommand
private ProcessResult ExecuteCommand(IIntegrationResult result,
string command, params string[] args)
{
var buffer = new PrivateArguments(command);
buffer.Add(this.Source);
foreach (var arg in args)
{
buffer.Add(string.Empty,
arg,
true);
}
var executable = string.IsNullOrEmpty(this.Executable) ?
"GetMyCode" : this.Executable;
var processInfo = new ProcessInfo(
result.BaseFromWorkingDirectory(executable),
buffer,
result.WorkingDirectory);
var processResult = this.Execute(processInfo);
return processResult;
}
示例8: NewProcessInfo
private ProcessInfo NewProcessInfo(string args, IIntegrationResult result)
{
ProcessInfo pi = new ProcessInfo(Executable, args, result.BaseFromWorkingDirectory(WorkingDirectory));
// Needed to disable the pager for bk commands, which causes infinite hangs
pi.EnvironmentVariables.Add("PAGER", "cat");
return pi;
}
示例9: Execute
/// <summary>
/// Execute the actual task functionality.
/// </summary>
/// <param name="result"></param>
/// <returns>
/// True if the task was successful, false otherwise.
/// </returns>
protected override bool Execute(IIntegrationResult result)
{
result.BuildProgressInformation.SignalStartRunTask(!string.IsNullOrEmpty(Description) ? Description : "Publishing build results");
if (result.Succeeded || AlwaysPublish)
{
var srcDir = new DirectoryInfo(result.BaseFromWorkingDirectory(SourceDir));
var pubDir = new DirectoryInfo(result.BaseFromArtifactsDirectory(PublishDir));
Log.Debug("Publish directory is '{0}'", pubDir.FullName);
Log.Debug("Source directory is '{0}'", srcDir.FullName);
if (!srcDir.Exists)
{
Log.Warning("Source directory '{0}' does not exist - cancelling task", srcDir.FullName);
var errorResult = new GeneralTaskResult(
false,
"Unable to find source directory '" + srcDir.FullName + "'");
result.AddTaskResult(errorResult);
return false;
}
if (!pubDir.Exists)
{
Log.Info("Publish directory '{0}' does not exist - creating", pubDir.FullName);
pubDir.Create();
}
else
{
if (CleanPublishDirPriorToCopy)
{
DeleteFolder(pubDir.FullName);
pubDir.Create();
}
}
if (UseLabelSubDirectory)
pubDir = pubDir.CreateSubdirectory(result.Label);
RecurseSubDirectories(srcDir, pubDir, this.Recurse);
switch (CleanUpMethod)
{
case CleanupPolicy.NoCleaning:
break;
case CleanupPolicy.DeleteBuildsOlderThanXDays:
DeleteSubDirsOlderThanXDays(new DirectoryInfo(result.BaseFromArtifactsDirectory(PublishDir)).FullName,
CleanUpValue, result.BuildLogDirectory);
break;
case CleanupPolicy.KeepLastXBuilds:
KeepLastXSubDirs(new DirectoryInfo(result.BaseFromArtifactsDirectory(PublishDir)).FullName,
CleanUpValue, result.BuildLogDirectory);
break;
default:
throw new System.Exception(string.Format(System.Globalization.CultureInfo.CurrentCulture, "unmapped cleaning method choosen {0}", CleanUpMethod));
}
}
return true;
}
示例10: GetProcessBaseDirectory
protected override string GetProcessBaseDirectory(IIntegrationResult result)
{
return result.BaseFromWorkingDirectory(BaseDirectory);
}
示例11: BaseDirectory
private string BaseDirectory(IIntegrationResult result)
{
return result.BaseFromWorkingDirectory(ConfiguredScriptsDirectory);
}
示例12: GetProcessArguments
/// <summary>
/// Retrieve the arguments
/// </summary>
/// <param name="result">The result.</param>
/// <returns>A <c>string</c> containing the arguments.</returns>
protected override string GetProcessArguments(IIntegrationResult result)
{
ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
buffer.AddArgument("/quiet");
buffer.AddArgument("/severityThreshold:\"" + this.ReportingThreshold.ToString() + "\"");
buffer.AddArgument("/out:\"" + result.BaseFromWorkingDirectory("codeitright.xml") + "\"");
if (!string.IsNullOrEmpty(this.Solution))
{
buffer.AddArgument("/Solution:\"" + this.EnsurePathIsRooted(result, this.Solution) + "\"");
}
else if (!string.IsNullOrEmpty(this.Project))
{
buffer.AddArgument("/Project:\"" + this.EnsurePathIsRooted(result, this.Project) + "\"");
}
else
{
throw new CruiseControlException("Either a solution or a project must be specified for analysis.");
}
if (!string.IsNullOrEmpty(this.Xsl))
{
buffer.AddArgument("/outxsl:\"" + this.EnsurePathIsRooted(result, this.Xsl) + "\"");
}
if (!string.IsNullOrEmpty(this.CRData))
{
buffer.AddArgument("/crdata:\"" + this.EnsurePathIsRooted(result, this.CRData) + "\"");
}
if (!string.IsNullOrEmpty(this.Profile))
{
buffer.AddArgument("/profile:\"" + this.Profile + "\"");
}
return buffer.ToString();
}
示例13: NewProcessInfoWithArgs
private ProcessInfo NewProcessInfoWithArgs(IIntegrationResult result, string args)
{
var wd = result.BaseFromWorkingDirectory(WorkingDirectory);
// ensure working directory exists
fileSystem.EnsureFolderExists(wd);
var pi = new ProcessInfo(Executable, args, wd);
SetEnvironmentVariables(pi, result);
return pi;
}
示例14: NewCheckoutProcessInfo
private ProcessInfo NewCheckoutProcessInfo(IIntegrationResult result)
{
var buffer = new PrivateArguments("checkout");
buffer.Add(string.Empty, TrunkUrl, true);
buffer.Add(null, Path.GetFullPath(result.BaseFromWorkingDirectory(WorkingDirectory)), true);
AppendCommonSwitches(buffer);
return NewProcessInfo(buffer, result);
}
示例15: DoesSvnDirectoryExist
private bool DoesSvnDirectoryExist(IIntegrationResult result)
{
string svnDirectory = Path.Combine(result.BaseFromWorkingDirectory(WorkingDirectory), ".svn");
string underscoreSvnDirectory = Path.Combine(result.BaseFromWorkingDirectory(WorkingDirectory), "_svn");
return fileSystem.DirectoryExists(svnDirectory) || fileSystem.DirectoryExists(underscoreSvnDirectory);
}