public static void PublishProjects(this ICakeContext context, Configuration config, string rootFolder, string destination, string[] excludePatterns, string projectParentFolderName) { var globberSettings = new GlobberSettings(); bool excludes(IFileSystemInfo fileSystemInfo) => !excludePatterns.Any(s => fileSystemInfo.Path.FullPath.Contains(s)); globberSettings.FilePredicate = excludes; var projects = GlobbingAliases.GetFiles(context, $"{rootFolder}\\**\\{projectParentFolderName}\\*.csproj", globberSettings); context.Log.Information("Publishing " + rootFolder + " to " + destination); foreach (var project in projects) { context.MSBuild(project, cfg => InitializeMSBuildSettingsInternal(context, config, cfg) .WithTarget(config.BuildTargets) .WithProperty("DeployOnBuild", "true") .WithProperty("DeployDefaultTarget", "WebPublish") .WithProperty("WebPublishMethod", "FileSystem") .WithProperty("DeleteExistingFiles", "false") .WithProperty("publishUrl", destination) .WithProperty("BuildProjectReferences", "false") ); } }
public IEnumerable <IFileSystemInfo> Walk(GlobNode node, GlobberSettings settings) { var context = new GlobVisitorContext(_fileSystem, _environment, settings.Predicate); node.Accept(this, context); return(context.Results); }
public GlobNode Parse(string pattern, GlobberSettings settings) { var buffer = GlobTokenizer.Tokenize(pattern); var isCaseSensitive = settings.IsCaseSensitive ?? _environment.Platform.IsUnix(); return(Parse(new GlobParserContext(buffer, isCaseSensitive))); }
private IEnumerable <FilePath> FindProjects(string folder) { var root = new DirectoryPath(folder).MakeAbsolute(_environment); var globberSettings = new GlobberSettings { Comparer = new PathComparer(false), Root = root }; return(_globber.Match(@"**/*.{c|f}sproj", globberSettings).OfType <FilePath>()); }
public static FilePathCollection GetTransformFiles(this ICakeContext context, string rootFolder) { var globberSettings = new GlobberSettings(); bool exclude_obj_bin_folder(IFileSystemInfo fileSystemInfo) => !fileSystemInfo.Path.FullPath.Contains("/obj/") && !fileSystemInfo.Path.FullPath.Contains("/bin/"); globberSettings.FilePredicate = exclude_obj_bin_folder; var xdtFiles = context.GetFiles($"{rootFolder}\\**\\*.xdt", globberSettings); return(xdtFiles); }
public static FilePathCollection GetFilesByPatterns(ICakeContext context, string[] patterns, Func <IDirectory, bool> predicate) { var settings = new GlobberSettings(); settings.Predicate = predicate; settings.IsCaseSensitive = false; FilePathCollection res = context.GetFiles(patterns[0], settings); for (var i = 1; i < patterns.Length - 1; i++) { res += context.GetFiles(patterns[i], settings); } return(res); }
public override void Run(Context context) { var globberSettings = new GlobberSettings { Predicate = x => !x.Path.FullPath.Contains("/build/") }; var directories = context.GetDirectories("./**/bin", globberSettings) + context.GetDirectories("./**/obj", globberSettings) + context.Artifacts; foreach (var directory in directories) { context.CleanDirectory(directory); } }
public GlobVisitorContext( IEnvironment environment, GlobberSettings settings) { if (environment is null) { throw new ArgumentNullException(nameof(environment)); } _settings = settings ?? throw new ArgumentNullException(nameof(settings)); _pathParts = new List <string>(); Results = new List <IFileSystemInfo>(); Root = _settings.Root ?? environment.WorkingDirectory; Root = Root.MakeAbsolute(environment); Path = new DirectoryPath(string.Empty); }
public static FilePathCollection GetFiles(this ICakeContext context, string pattern, GlobberSettings settings) { if (context == null) { throw new ArgumentNullException(nameof(context)); } return(new FilePathCollection(context.Globber.Match(pattern, settings).OfType <FilePath>())); }
public static PathCollection GetPaths(this ICakeContext context, GlobPattern pattern, GlobberSettings settings) { if (context == null) { throw new ArgumentNullException(nameof(context)); } return(new PathCollection(context.Globber.Match(pattern, settings))); }
public static DirectoryPathCollection GetDirectories(this ICakeContext context, GlobPattern pattern, GlobberSettings settings) { if (context == null) { throw new ArgumentNullException(nameof(context)); } return(new DirectoryPathCollection(context.Globber.Match(pattern, settings).OfType <DirectoryPath>())); }
public IEnumerable <Path> Match(GlobPattern pattern, GlobberSettings settings) { return(new FilePath[] { new FilePath(pattern) }); }
public static DirectoryPathCollection GetDirectories(this ICakeContext context, string pattern, GlobberSettings settings) { if (context == null) { throw new ArgumentNullException(nameof(context)); } return(new DirectoryPathCollection( context.Globber.Match(pattern, settings).OfType <DirectoryPath>(), new PathComparer(context.Environment.Platform.IsUnix()))); }