internal static DirectoryPath MakeRelativePath(this DirectoryPath directoryPath, ICakeEnvironment environment, DirectoryPath rootDirectoryPath) { if (directoryPath == null) { throw new ArgumentNullException(nameof(directoryPath)); } if (environment == null) { throw new ArgumentNullException(nameof(environment)); } if (rootDirectoryPath == null) { throw new ArgumentNullException(nameof(rootDirectoryPath)); } var dirUri = new Uri(directoryPath.MakeAbsolute(environment).FullPath); var rootUri = new Uri($"{rootDirectoryPath.MakeAbsolute(environment).FullPath}/"); var relativeUri = rootUri.MakeRelativeUri(dirUri); var relativePath = Uri.UnescapeDataString(relativeUri.ToString()); var relativeDirectoryPath = new DirectoryPath(relativePath); return relativeDirectoryPath; }
public static WebFarmManager Using(ICakeEnvironment environment, ICakeLog log, ServerManager server) { WebFarmManager manager = new WebFarmManager(environment, log); manager.SetServer(server); return manager; }
public NuGetPackageConfigurationCreator(IFileSystem fileSystem, ICakeEnvironment environment, ICakeLog log, INugetPackageVersionProber prober) { _fileSystem = fileSystem; _environment = environment; _log = log; _prober = prober; }
public static FtpsiteManager Using(ICakeEnvironment environment, ICakeLog log, ServerManager server) { FtpsiteManager manager = new FtpsiteManager(environment, log); manager.SetServer(server); return manager; }
public static ApplicationPoolManager Using(ICakeEnvironment environment, ICakeLog log, ServerManager server) { ApplicationPoolManager manager = new ApplicationPoolManager(environment, log); manager.SetServer(server); return manager; }
public InstallCommand(IRuntime runtime, IFileSystem fileSystem, ICakeEnvironment environment, ICakeLog log, INuGetPackageConfigurationCreator packageConfigCreator, IFileCopier fileCopier, IHttpDownloader downloader, IGitIgnorePatcher gitIgnorePatcher) { _runtime = runtime; _fileSystem = fileSystem; _environment = environment; _log = log; _packageConfigCreator = packageConfigCreator; _fileCopier = fileCopier; _downloader = downloader; _gitIgnorePatcher = gitIgnorePatcher; }
/// <summary> /// Initializes a new instance of the <see cref="ProcessRunner" /> class. /// </summary> /// <param name="environment">The environment.</param> /// <param name="log">The log.</param> public AdvProcessRunner(ICakeEnvironment environment, ICakeLog log) { if (environment == null) { throw new ArgumentNullException("environment"); } if (log == null) { throw new ArgumentNullException("log"); } _environment = environment; _log = log; }
/// <summary> /// Initializes a new instance of the <see cref="CloudFrontManager" /> class. /// </summary> /// <param name="environment">The environment.</param> /// <param name="log">The log.</param> public CloudFrontManager(ICakeEnvironment environment, ICakeLog log) { if (environment == null) { throw new ArgumentNullException("environment"); } if (log == null) { throw new ArgumentNullException("log"); } _Environment = environment; _Log = log; }
/// <summary> /// Initializes a new instance of the <see cref="VsceToolResolver" /> class. /// </summary> /// <param name="fileSystem">The file system.</param> /// <param name="environment">The environment.</param> public VsceToolResolver(IFileSystem fileSystem, ICakeEnvironment environment) { _fileSystem = fileSystem; _environment = environment; if (fileSystem == null) { throw new ArgumentNullException("fileSystem"); } if (environment == null) { throw new ArgumentNullException("environment"); } }
/// <summary> /// Initializes a new instance of the <see cref="TopshelfManager" /> class. /// </summary> /// <param name="environment">The environment.</param> /// <param name="runner">The process runner.</param> /// <param name="log">The log.</param> public TopshelfManager(ICakeEnvironment environment, IProcessRunner runner, ICakeLog log) { if (environment == null) { throw new ArgumentNullException("environment"); } if (runner == null) { throw new ArgumentNullException("runner"); } if (log == null) { throw new ArgumentNullException("log"); } _Environment = environment; _Runner = runner; _Log = log; }
/// <summary> /// Initializes a new instance of the <see cref="S3Manager" /> class. /// </summary> /// <param name="fileSystem">The file System.</param> /// <param name="environment">The environment.</param> /// <param name="log">The log.</param> public S3Manager(IFileSystem fileSystem, ICakeEnvironment environment, ICakeLog log) { if (fileSystem == null) { throw new ArgumentNullException("fileSystem"); } if (environment == null) { throw new ArgumentNullException("environment"); } if (log == null) { throw new ArgumentNullException("log"); } _FileSystem = fileSystem; _Environment = environment; _Log = log; this.LogProgress = true; }
internal static Path MakeRelativePath(this Path path, ICakeEnvironment environment, DirectoryPath rootDirectoryPath) { if (path == null) { throw new ArgumentNullException(nameof(path)); } if (environment == null) { throw new ArgumentNullException(nameof(environment)); } if (rootDirectoryPath == null) { throw new ArgumentNullException(nameof(rootDirectoryPath)); } return (path as FilePath)?.MakeRelativePath(environment, rootDirectoryPath) ?? (path as DirectoryPath)?.MakeRelativePath(environment, rootDirectoryPath) as Path; }
/// <summary> /// Initializes a new instance of the <see cref="StartInDebugMode" /> class. /// </summary> /// <param name="fileSystem">The file system.</param> /// <param name="environment">The environment.</param> /// <param name="processRunner">The process runner.</param> /// <param name="tools">The tools.</param> /// <param name="resolver">The resolver.</param> public StartInDebugMode(IFileSystem fileSystem, ICakeEnvironment environment, IProcessRunner processRunner, IToolLocator tools, ICloudShellToolResolver resolver) : base(fileSystem, environment, processRunner, tools, resolver) { }
/// <summary> /// Initializes a new instance of the <see cref="OctopusDeployPacker"/> class. /// </summary> /// <param name="fileSystem">The file system.</param> /// <param name="environment">The environment.</param> /// <param name="processRunner">The process runner.</param> /// <param name="tools">The tool locator.</param> public OctopusDeployPacker(IFileSystem fileSystem, ICakeEnvironment environment, IProcessRunner processRunner, IToolLocator tools) : base(fileSystem, environment, processRunner, tools) { _environment = environment; }
/// <summary> /// Initializes a new instance of the <see cref="AliaSqlRunner"/> class. /// </summary> /// <param name="fileSystem"></param> /// <param name="environment"></param> /// <param name="processRunner"></param> /// <param name="tools"></param> public AliaSqlRunner(IFileSystem fileSystem, ICakeEnvironment environment, IProcessRunner processRunner, IToolLocator tools) : base(fileSystem, environment, processRunner, tools) { _fileSystem = fileSystem; }
public ConfigurationParser(IFileSystem fileSystem, ICakeEnvironment environment) { _fileSystem = fileSystem; _environment = environment; }
/// <summary> /// Initializes a new instance of the <see cref="BitriseWorkflowInfo"/> class. /// </summary> /// <param name="environment">The environment.</param> public BitriseWorkflowInfo(ICakeEnvironment environment) : base(environment) { }
/// <inheritdoc /> public TravisCIRunner(IFileSystem fileSystem, ICakeEnvironment environment, IProcessRunner processRunner, IToolLocator tools) : base(fileSystem, environment, processRunner, tools) { }
public OSXSeekerOfEditors(ICakeEnvironment environment, IGlobber globber, ICakeLog log, IFileSystem fileSystem) : base(environment, globber, log) { this.fileSystem = fileSystem; }
/// <summary> /// Initializes a new instance of the <see cref="MSBuildRunner"/> class. /// </summary> /// <param name="fileSystem">The file system.</param> /// <param name="environment">The environment.</param> /// <param name="runner">The runner.</param> public MSBuildRunner(IFileSystem fileSystem, ICakeEnvironment environment, IProcessRunner runner) : base(fileSystem, environment, runner) { _fileSystem = fileSystem; _environment = environment; }
/// <summary> /// Initializes a new instance of the <see cref="GitLabCIBuildInfo"/> class. /// </summary> /// <param name="environment">The environment.</param> public GitLabCIBuildInfo(ICakeEnvironment environment) : base(environment) { }
/// <summary> /// Adds MSBuild arguments /// </summary> /// <param name="builder">Argument builder.</param> /// <param name="settings">MSBuild settings to add.</param> /// <param name="environment">The environment.</param> /// <exception cref="InvalidOperationException">Throws if 10 or more file loggers specified.</exception> public static void AppendMSBuildSettings(this ProcessArgumentBuilder builder, DotNetCoreMSBuildSettings settings, ICakeEnvironment environment) { // Got any targets? if (settings.Targets.Any()) { if (settings.Targets.All(string.IsNullOrWhiteSpace)) { throw new ArgumentException("Specify the name of the target", nameof(settings.Targets)); } builder.AppendMSBuildSwitch("target", string.Join(";", settings.Targets)); } // Got any properties? foreach (var property in settings.Properties) { if (property.Value == null || property.Value.All(string.IsNullOrWhiteSpace)) { throw new ArgumentException("A property must have at least one non-empty value", nameof(settings.Properties)); } foreach (var value in property.Value) { if (string.IsNullOrWhiteSpace(value)) { continue; } builder.AppendMSBuildSwitch("property", $"{property.Key}={value.EscapeMSBuildPropertySpecialCharacters()}"); } } // Set the maximum number of processors? if (settings.MaxCpuCount.HasValue) { builder.AppendMSBuildSwitchWithOptionalValue("maxcpucount", settings.MaxCpuCount.Value, maxCpuCount => maxCpuCount > 0); } // use different version of msbuild? if (settings.ToolVersion.HasValue) { builder.AppendMSBuildSwitch("toolsversion", GetToolVersionValue(settings.ToolVersion.Value)); } // configure console logger? if (!settings.DisableConsoleLogger && settings.ConsoleLoggerSettings != null) { var arguments = GetLoggerSettings(settings.ConsoleLoggerSettings); if (arguments.Any()) { builder.AppendMSBuildSwitch("consoleloggerparameters", arguments); } } // disable console logger? if (settings.DisableConsoleLogger) { builder.AppendMSBuildSwitch("noconsolelogger"); } // Got any file loggers? if (settings.FileLoggers.Any()) { if (settings.FileLoggers.Count >= 10) { throw new InvalidOperationException("Too Many FileLoggers"); } var arguments = settings .FileLoggers .Select((logger, index) => GetLoggerArgument(index, logger, environment)) .Where(arg => !string.IsNullOrEmpty(arg)); foreach (var argument in arguments) { builder.Append(argument); } } // Got any distributed loggers? foreach (var distributedLogger in settings.DistributedLoggers) { builder.AppendMSBuildSwitch("distributedlogger", $"{GetLoggerValue(distributedLogger.CentralLogger)}*{GetLoggerValue(distributedLogger.ForwardingLogger)}"); } // use a file logger for each node? if (settings.DistributedFileLogger) { builder.AppendMSBuildSwitch("distributedFileLogger"); } // Got any loggers? foreach (var logger in settings.Loggers) { builder.AppendMSBuildSwitch("logger", GetLoggerValue(logger)); } var showWarningsAsError = settings.TreatAllWarningsAs == MSBuildTreatAllWarningsAs.Error || settings.WarningCodesAsError.Any(); var showWarningsAsMessages = settings.TreatAllWarningsAs == MSBuildTreatAllWarningsAs.Message || settings.WarningCodesAsMessage.Any(); // Treat all or some warnings as errors? if (showWarningsAsError) { builder.AppendMSBuildSwitchWithOptionalValueIfNotEmpty("warnaserror", GetWarningCodes(settings.TreatAllWarningsAs == MSBuildTreatAllWarningsAs.Error, settings.WarningCodesAsError)); } // Treat all or some warnings as messages? if (showWarningsAsMessages) { builder.AppendMSBuildSwitchWithOptionalValueIfNotEmpty("warnasmessage", GetWarningCodes(settings.TreatAllWarningsAs == MSBuildTreatAllWarningsAs.Message, settings.WarningCodesAsMessage)); } // set project file extensions to ignore when searching for project file if (settings.IgnoreProjectExtensions.Any()) { builder.AppendMSBuildSwitch("ignoreprojectextensions", string.Join(",", settings.IgnoreProjectExtensions)); } // detailed summary? if (settings.DetailedSummary) { builder.AppendMSBuildSwitch("detailedsummary"); } // Include response files? foreach (var responseFile in settings.ResponseFiles) { builder.AppendSwitchQuoted("@", string.Empty, responseFile.MakeAbsolute(environment).FullPath); } // exclude auto response files? if (settings.ExcludeAutoResponseFiles) { builder.AppendMSBuildSwitch("noautoresponse"); } // don't output MSBuild logo? if (settings.NoLogo) { builder.AppendMSBuildSwitch("nologo"); } }
private static string GetLoggerSettings(MSBuildFileLoggerSettings loggerSettings, ICakeEnvironment environment) { var settings = new List <string>(); var commonArguments = GetLoggerSettings(loggerSettings); if (commonArguments.Any()) { settings.Add(commonArguments); } if (loggerSettings.LogFile != null) { var filePath = string.IsNullOrWhiteSpace(loggerSettings.LogFile) ? string.Empty : FilePath.FromString(loggerSettings.LogFile).MakeAbsolute(environment).ToString(); settings.Add($"LogFile=\"{filePath}\""); } if (loggerSettings.AppendToLogFile) { settings.Add("Append"); } if (!string.IsNullOrWhiteSpace(loggerSettings.FileEncoding)) { settings.Add($"Encoding={loggerSettings.FileEncoding}"); } return(string.Join(";", settings)); }
private static string GetLoggerArgument(int index, MSBuildFileLoggerSettings logger, ICakeEnvironment environment) { var parameters = GetLoggerSettings(logger, environment); if (string.IsNullOrWhiteSpace(parameters)) { return(string.Empty); } var counter = index == 0 ? string.Empty : index.ToString(); return($"/fileLogger{counter} /fileloggerparameters{counter}:{parameters}"); }
public GlobVisitor(IFileSystem fileSystem, ICakeEnvironment environment) { _fileSystem = fileSystem; _environment = environment; }
public FtpsiteManager(ICakeEnvironment environment, ICakeLog log) : base(environment, log) { }
/// <summary> /// Initializes a new instance of the <see cref="FakeFileSystem"/> class. /// </summary> /// <param name="environment">The environment.</param> public FakeFileSystem(ICakeEnvironment environment) { _tree = new FakeFileSystemTree(environment); }
/// <summary> /// Initializes a new instance of the <see cref="BambooCustomBuildInfo"/> class. /// </summary> /// <param name="environment">The environment.</param> public BambooCustomBuildInfo(ICakeEnvironment environment) : base(environment) { }
private static DirectoryPath GetHighestAvailableMSBuildVersion(IFileSystem fileSystem, ICakeEnvironment environment, MSBuildPlatform buildPlatform) { var versions = new[] { MSBuildVersion.MSBuild17, MSBuildVersion.MSBuild16, MSBuildVersion.MSBuild15, MSBuildVersion.MSBuild14, MSBuildVersion.MSBuild12, MSBuildVersion.MSBuild4, MSBuildVersion.MSBuild35, MSBuildVersion.MSBuild20, }; foreach (var version in versions) { var path = GetMSBuildPath(fileSystem, environment, version, buildPlatform, null); if (fileSystem.Exist(path)) { return(path); } } return(null); }
/// <summary> /// Initializes a new instance of the <see cref="SqlPackageDeployReportRunner"/> class. /// </summary> /// <param name="fileSystem">The file system.</param> /// <param name="environment">The environment.</param> /// <param name="processRunner">The process runner.</param> /// <param name="tools">The tool locator.</param> public SqlPackageDeployReportRunner(IFileSystem fileSystem, ICakeEnvironment environment, IProcessRunner processRunner, IToolLocator tools) : base(fileSystem, environment, processRunner, tools) { Environment = environment; }
public ApplicationPoolManager(ICakeEnvironment environment, ICakeLog log) : base(environment, log) { }
/// <summary> /// Initializes a new instance of the <see cref="ReportUnitRunner"/> class. /// </summary> /// <param name="fileSystem">The file system.</param> /// <param name="environment">The environment.</param> /// <param name="processRunner">The process runner.</param> /// <param name="globber">The globber.</param> public ReportUnitRunner(IFileSystem fileSystem, ICakeEnvironment environment, IProcessRunner processRunner, IGlobber globber) : base(fileSystem, environment, processRunner, globber) { _environment = environment; }
public FileCopier(IFileSystem fileSystem, ICakeEnvironment environment, ICakeLog log) { _fileSystem = fileSystem; _environment = environment; _log = log; }
public GenymotionAdminRunner(IFileSystem fileSystem, ICakeEnvironment environment, IProcessRunner processRunner, IToolLocator tools, GenymotionAdminSettings settings) : base(fileSystem, environment, processRunner, tools, settings) { _environment = environment; }
public AssemblyInfoParserFixture(bool clsCompliant = false, string company = "Company", bool comVisible = false, string configuration = "Debug", string copyright = "Copyright 2015", string description = "Description", string fileVersion = "4.3.2.1", string guid = "ABCEDF", string informationalVersion = "4.2.3.1", string internalsVisibleTo = "Cake.Common.Test", string product = "Cake", string title = "Cake", string trademark = "Trademark", string version = "1.2.3.4", bool createAssemblyInfo = true) { Environment = Substitute.For <ICakeEnvironment>(); Environment.WorkingDirectory.Returns("/Working"); FileSystem = new FakeFileSystem(Environment); FileSystem.CreateDirectory(Environment.WorkingDirectory); if (createAssemblyInfo) { // Set the versions. var settings = new AssemblyInfoSettings(); settings.CLSCompliant = clsCompliant; if (company != null) { settings.Company = company; } settings.ComVisible = comVisible; if (configuration != null) { settings.Configuration = configuration; } if (copyright != null) { settings.Copyright = copyright; } if (description != null) { settings.Description = description; } if (fileVersion != null) { settings.FileVersion = fileVersion; } if (guid != null) { settings.Guid = guid; } if (informationalVersion != null) { settings.InformationalVersion = informationalVersion; } if (internalsVisibleTo != null) { settings.InternalsVisibleTo = new List <string>() { internalsVisibleTo }; } if (product != null) { settings.Product = product; } if (title != null) { settings.Title = title; } if (trademark != null) { settings.Trademark = trademark; } if (version != null) { settings.Version = version; } // Create the assembly info. var creator = new AssemblyInfoCreator(FileSystem, Environment, Substitute.For <ICakeLog>()); creator.Create("./output.cs", settings); } }
/// <summary> /// Initializes a new instance of the <see cref="TeamCityProjectInfo"/> class. /// </summary> /// <param name="environment">The environment.</param> public TeamCityProjectInfo(ICakeEnvironment environment) : base(environment) { }
/// <summary> /// Initializes a new instance of the <see cref="MkDocsServeRunner"/> class. /// </summary> /// <param name="fileSystem">The file system.</param> /// <param name="environment">The environment.</param> /// <param name="processRunner">The process runner.</param> /// <param name="tools">The tool locator.</param> public MkDocsServeRunner(IFileSystem fileSystem, ICakeEnvironment environment, IProcessRunner processRunner, IToolLocator tools) : base(fileSystem, environment, processRunner, tools) { }
public LoadDirectiveProcessor(ICakeEnvironment environment) : base(environment) { }
public WebFarmManager(ICakeEnvironment environment, ICakeLog log) : base(environment, log) { }
/// <summary> /// Initializes a new instance of the <see cref="RegisterCloud"/> class. /// </summary> /// <param name="fileSystem">The file system.</param> /// <param name="environment">The environment.</param> /// <param name="processRunner">The process runner.</param> /// <param name="tools">The tools.</param> /// <param name="resolver">The resolver.</param> public RegisterCloud(IFileSystem fileSystem, ICakeEnvironment environment, IProcessRunner processRunner, IToolLocator tools, IMaintenanceModeToolResolver resolver) : base(fileSystem, environment, processRunner, tools, resolver) { }
public APTContentResolver(IFileSystem fileSystem, ICakeEnvironment environment, IGlobber globber) { _fileSystem = fileSystem; _environment = environment; _globber = globber; }
/// <summary> /// Initializes a new instance of the <see cref="BitriseRepositoryInfo"/> class. /// </summary> /// <param name="environment">The environment.</param> public BitriseRepositoryInfo(ICakeEnvironment environment) : base(environment) { }
/// <summary> /// creates a new grunt runner /// </summary> /// <param name="fileSystem">the file system</param> /// <param name="environment">The cake environment</param> /// <param name="processRunner">The cake process runner</param> /// <param name="tools">The tools locator</param> protected GruntRunner(IFileSystem fileSystem, ICakeEnvironment environment, IProcessRunner processRunner, IToolLocator tools) : base(fileSystem, environment, processRunner, tools) { _fileSystem = fileSystem; }
protected TerraformRunner(IFileSystem fileSystem, ICakeEnvironment environment, IProcessRunner processRunner, IToolLocator tools) : base(fileSystem, environment, processRunner, tools) { _platform = environment.Platform; }
/// <summary> /// Initializes a new instance of the <see cref="PaketPacker"/> class. /// </summary> /// <param name="fileSystem">The file system.</param> /// <param name="environment">The enviornment.</param> /// <param name="toolLocator">The tool locator.</param> /// <param name="processRunner">The process runner.</param> /// <param name="paketToolResolver">The paket tool resolver.</param> internal PaketPacker(IFileSystem fileSystem, ICakeEnvironment environment, IToolLocator toolLocator, IProcessRunner processRunner, IPaketToolResolver paketToolResolver) : base(fileSystem, environment, processRunner, toolLocator, paketToolResolver) { Environment = environment; }
/// <inheritdoc /> public TravisCIRunner(IFileSystem fileSystem, ICakeEnvironment environment, IProcessRunner processRunner, IGlobber globber) : base(fileSystem, environment, processRunner, globber) { }