Ejemplo n.º 1
0
        public IEnumerable<IFile> Install(PackageDefinition package, DirectoryPath root)
        {
            var result = new List<FilePath>();
            var paths = new FilePathCollection(PathComparer.Default);

            // InstallPackage the package.
            var packagePath = InstallPackage(package, root);
            var packageDirectory = _fileSystem.GetDirectory(packagePath);

            if (package.Filters != null && package.Filters.Count > 0)
            {
                // Get all files matching the filters.
                foreach (var filter in package.Filters)
                {
                    var pattern = string.Concat(packagePath.FullPath, "/", filter.TrimStart('/', '\\'));
                    paths.Add(_globber.GetFiles(pattern));
                }
            }
            else
            {
                // Do a recursive search in the package directory.
                paths.Add(packageDirectory.
                    GetFiles("*", SearchScope.Recursive)
                    .Select(file => file.Path));
            }

            if (paths.Count > 0)
            {
                result.AddRange(paths);
            }

            return result.Select(path => _fileSystem.GetFile(path));
        }
Ejemplo n.º 2
0
            public void Should_Return_The_Number_Of_Paths_In_The_Collection()
            {
                // Given
                var collection = new FilePathCollection(
                    new[] { new FilePath("A.txt"), new FilePath("B.txt") },
                    new PathComparer(false));

                // When, Then
                Assert.Equal(2, collection.Count);
            }
Ejemplo n.º 3
0
                public void Should_Add_Paths_That_Are_Not_Present()
                {
                    // Given
                    var collection = new FilePathCollection(new FilePath[] { "A.TXT", "B.TXT" }, new PathComparer(false));

                    // When
                    collection.Add(new FilePath[] { "A.TXT", "B.TXT", "C.TXT" });

                    // Then
                    Assert.Equal(3, collection.Count);
                }
Ejemplo n.º 4
0
                public void Should_Add_Path_If_Not_Already_Present()
                {
                    // Given
                    var collection = new FilePathCollection(new PathComparer(false));
                    collection.Add(new FilePath("B.txt"));

                    // When
                    collection.Add(new FilePath("A.txt"));

                    // Then
                    Assert.Equal(2, collection.Count);
                }
Ejemplo n.º 5
0
                public void Should_Respect_File_System_Case_Sensitivity_When_Adding_Path(bool caseSensitive, int expectedCount)
                {
                    // Given
                    var collection = new FilePathCollection(new PathComparer(caseSensitive));
                    collection.Add(new FilePath("A.TXT"));

                    // When
                    collection.Add(new FilePath("a.txt"));

                    // Then
                    Assert.Equal(expectedCount, collection.Count);
                }
Ejemplo n.º 6
0
                public void Should_Respect_File_System_Case_Sensitivity_When_Removing_Path(bool caseSensitive, int expectedCount)
                {
                    // Given
                    var collection = new FilePathCollection(new PathComparer(caseSensitive));

                    collection.Add(new FilePath("A.TXT"));

                    // When
                    collection.Remove(new FilePath("a.txt"));

                    // Then
                    Assert.Equal(expectedCount, collection.Count);
                }
Ejemplo n.º 7
0
                public void Should_Add_Path_If_Not_Already_Present()
                {
                    // Given
                    var collection = new FilePathCollection(new PathComparer(false));

                    collection.Add(new FilePath("B.txt"));

                    // When
                    collection.Add(new FilePath("A.txt"));

                    // Then
                    Assert.Equal(2, collection.Count);
                }
Ejemplo n.º 8
0
                public void Should_Return_New_Collection()
                {
                    // Given
                    var comparer   = new PathComparer(false);
                    var collection = new FilePathCollection(comparer);
                    var second     = new FilePathCollection(new FilePath[] { "A.txt", "B.txt" }, comparer);

                    // When
                    var result = collection + second;

                    // Then
                    Assert.False(ReferenceEquals(result, collection));
                }
Ejemplo n.º 9
0
                public void Should_Respect_File_System_Case_Sensitivity_When_Adding_Path()
                {
                    // Given
                    var collection = new FilePathCollection(new PathComparer(false));

                    collection.Add("B.txt");

                    // When
                    var result = collection + new FilePath("A.txt");

                    // Then
                    Assert.Equal(2, result.Count);
                }
Ejemplo n.º 10
0
                public void Should_Respect_File_System_Case_Sensitivity_When_Adding_Paths()
                {
                    // Given
                    var comparer   = new PathComparer(false);
                    var collection = new FilePathCollection(comparer);
                    var second     = new FilePathCollection(new FilePath[] { "A.txt", "B.txt" }, comparer);

                    // When
                    var result = collection + second;

                    // Then
                    Assert.Equal(2, result.Count);
                }
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 12
0
                public void Should_Return_New_Collection()
                {
                    // Given
                    var collection = new FilePathCollection(new PathComparer(false));

                    collection.Add("A.txt");
                    collection.Add("B.txt");

                    // When
                    var result = collection - new FilePath("A.txt");

                    // Then
                    Assert.False(ReferenceEquals(result, collection));
                }
Ejemplo n.º 13
0
        /// <summary>
        /// Merges two or more Stylecop report files into a single xml document.
        /// </summary>
        /// <param name="context">The cake context.</param>
        /// <param name="resultFiles">A collection of report files to merge.</param>
        /// <returns>The resultant Xml document.</returns>
        public static XDocument MergeResultFile(ICakeContext context, FilePathCollection resultFiles)
        {
            context.Log.Information($"Stylecop: Loading result xml file {resultFiles.First().FullPath}");
            var xFileRoot = XDocument.Load(resultFiles.First().FullPath);

            foreach (var resultFile in resultFiles.Skip(1))
            {
                context.Log.Information($"Stylecop: Loading result xml file {resultFile.FullPath}");
                var xFileChild = XDocument.Load(resultFile.FullPath);
                xFileRoot.Root.Add(xFileChild.Root.Elements());
            }

            return(xFileRoot);
        }
        /// <summary>
        /// Filters binaries that are in common with orchard web project binaries.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="moduleBinaries">Collection of binaries.</param>
        /// <param name="orchardWebBinaries">Collection of Orchard.Web project binaries.</param>
        /// <returns>Collection of binaries that are shared.</returns>
        public static FilePathCollection Filter(ICakeContext context, FilePathCollection moduleBinaries, FilePathCollection orchardWebBinaries) {
            if (context == null) {
                throw new ArgumentNullException(nameof(context));
            }
            if (moduleBinaries == null || orchardWebBinaries == null) {
                throw new ArgumentNullException("A FilePathCollection is empty.");
            }

            var orchardWebAssemblies = new HashSet<string>(
                orchardWebBinaries.Select(item => item.ToString()),
                StringComparer.InvariantCultureIgnoreCase);

            return new FilePathCollection(moduleBinaries
                .Where(item => orchardWebAssemblies.Contains(item.ToString())), PathComparer.Default);
        }
Ejemplo n.º 15
0
                public void Should_Respect_File_System_Case_Sensitivity_When_Removing_Paths(bool caseSensitive, int expectedCount)
                {
                    // Given
                    var collection = new FilePathCollection(new PathComparer(caseSensitive));

                    collection.Add("A.txt");
                    collection.Add("B.txt");
                    collection.Add("C.txt");

                    // When
                    var result = collection - new[] { new FilePath("b.txt"), new FilePath("c.txt") };

                    // Then
                    Assert.Equal(expectedCount, result.Count);
                }
        private static void Compress <T>(
            ICakeContext context,
            DirectoryPath rootPath,
            FilePath outputPath,
            int level) where T : CompressionBase
        {
            Precondition.IsNotNull(context, nameof(context));
            Precondition.IsNotNull(rootPath, nameof(rootPath));
            Precondition.IsNotNull(outputPath, nameof(outputPath));
            Precondition.IsBetween(level, 1, 9, nameof(level));

            FilePathCollection filePaths = context.GetFiles(string.Concat(rootPath, "/**/*"));

            Compress <T>(context, rootPath, outputPath, filePaths, level);
        }
Ejemplo n.º 17
0
        public static void DeleteFiles(this ICakeContext cakeContext, DeleteHelpersConfig config)
        {
            FilePathCollection files        = cakeContext.GetFiles(config.FullDirectory.ToString());
            List <FilePath>    orderedFiles = files.OrderBy(f => System.IO.File.GetCreationTime(f.ToString())).ToList();

            while (orderedFiles.Count > config.NumberOfFilesToKeep)
            {
                FilePath file = orderedFiles[0];
                cakeContext.Information($"Deleting '{file}'");
                if (config.DryRun == false)
                {
                    cakeContext.DeleteFile(file);
                }
                orderedFiles.RemoveAt(0);
            }
        }
Ejemplo n.º 18
0
        public static void SignLibrary(Context context)
        {
            FilePathCollection packages = context.GetFiles($"{context.PackageDir}/*.nupkg");

            foreach (FilePath file in packages)
            {
                DirectoryPath extracted = context.PackageDir.Combine(file.GetFilenameWithoutExtension().ToString());
                context.DeleteDirectory(extracted, false);
                context.Unzip(file, extracted);

                FilePathCollection toSign = context.GetFiles($"{extracted}/lib/**/VGAudio.dll");
                SignFiles(context, toSign, context.ReleaseCertThumbprint);
                context.Zip(extracted, context.PackageDir.CombineWithFilePath(file.GetFilename()));
                context.DeleteDirectory(extracted, false);
            }
        }
Ejemplo n.º 19
0
    public static FilePathCollection GetFilesByPatterns(
        this ICakeContext context,
        string root,
        string[] includePatterns,
        string[] excludePatterns)
    {
        if (excludePatterns.Length == 0)
        {
            return(GetFilesByPatterns(context, includePatterns));
        }

        root = root.EnsureEndsWith("/");
        FilePathCollection excludeFiles = context.GetFiles(
            root
            + excludePatterns[0]
            .TrimStart('/'));

        for (var i = 1; i < excludePatterns.Length; i++)
        {
            excludeFiles.Add(
                context.GetFiles(
                    root
                    + excludePatterns[i]
                    .TrimStart('/')));
        }

        var excludePaths = excludeFiles.Select(e => e.FullPath);
        var res          = new FilePathCollection();

        for (var i = 0; i < includePatterns.Length; i++)
        {
            var incl = context.GetFiles(
                root
                + includePatterns[i]
                .TrimStart('/'));
            var crt = res.Select(ii => ii.FullPath);
            foreach (var include in incl)
            {
                if (!excludeFiles.Contains(include.FullPath) && !crt.Contains(include.FullPath))
                {
                    res.Add(include);
                }
            }
        }

        return(res);
    }
Ejemplo n.º 20
0
        public static void SignCli(Context context)
        {
            FilePath      file      = context.PackageDir.CombineWithFilePath("VGAudioCli.zip");
            DirectoryPath extracted = context.PackageDir.Combine(file.GetFilenameWithoutExtension().ToString());

            context.DeleteDirectory(extracted, false);
            context.Unzip(file, extracted);

            FilePathCollection toSign = context.GetFiles($"{extracted}/**/VGAudio*.exe");

            toSign.Add(context.GetFiles($"{extracted}/**/VGAudio*.dll"));
            toSign.Add(context.PackageDir.CombineWithFilePath("VGAudioCli.exe"));
            toSign.Add(context.PackageDir.CombineWithFilePath("VGAudioTools.exe"));

            SignFiles(context, toSign.Where(context.FileExists), context.ReleaseCertThumbprint);
            context.Zip(extracted, context.PackageDir.CombineWithFilePath(file.GetFilename()));
            context.DeleteDirectory(extracted, false);
        }
Ejemplo n.º 21
0
        public static FilePathCollection GetFilesByPatterns(this ICakeContext context, string[] includePatterns)
        {
            var res = new FilePathCollection();

            for (var i = 0; i < includePatterns.Length; i++)
            {
                var incl = context.GetFiles(includePatterns[i]);
                var crt  = res.Select(ii => ii.FullPath);
                foreach (var include in incl)
                {
                    if (!crt.Contains(include.FullPath))
                    {
                        res.Add(include);
                    }
                }
            }
            return(res);
        }
Ejemplo n.º 22
0
        public static FilePathCollection GetFilesByPatterns(this ICakeContext context, DirectoryPath root, string[] includePatterns)
        {
            var res = new FilePathCollection();

            for (var i = 0; i < includePatterns.Length; i++)
            {
                var incl = context.GetFiles(root.CombineWithFilePath(includePatterns[i].TrimStart('/')).ToString());
                var crt  = res.Select(ii => ii.FullPath);
                foreach (var include in incl)
                {
                    if (!crt.Contains(include.FullPath))
                    {
                        res.Add(include);
                    }
                }
            }
            return(res);
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Filters binaries that are in common with orchard web project binaries.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="moduleBinaries">Collection of binaries.</param>
        /// <param name="orchardWebBinaries">Collection of Orchard.Web project binaries.</param>
        /// <returns>Collection of binaries that are shared.</returns>
        public static FilePathCollection Filter(ICakeContext context, FilePathCollection moduleBinaries, FilePathCollection orchardWebBinaries)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            if (moduleBinaries == null || orchardWebBinaries == null)
            {
                throw new ArgumentNullException("A FilePathCollection is empty.");
            }

            var orchardWebAssemblies = new HashSet <string>(
                orchardWebBinaries.Select(item => item.ToString()),
                StringComparer.InvariantCultureIgnoreCase);

            return(new FilePathCollection(moduleBinaries
                                          .Where(item => orchardWebAssemblies.Contains(item.ToString())), PathComparer.Default));
        }
Ejemplo n.º 24
0
    public BuildContext(ICakeContext context)
        : base(context)
    {
        BuildConfiguration = context.Argument("Configuration", "Release");
        SkipTests          = context.Argument("SkipTests", false);
        SkipSlowTests      = context.Argument("SkipSlowTests", false);

        RootDirectory       = new DirectoryPath(new DirectoryInfo(Directory.GetCurrentDirectory()).Parent.FullName);
        ArtifactsDirectory  = RootDirectory.Combine("artifacts");
        ToolsDirectory      = RootDirectory.Combine("tools");
        DocsDirectory       = RootDirectory.Combine("docs");
        DocfxDirectory      = ToolsDirectory.Combine("docfx");
        DocfxExeFile        = DocfxDirectory.CombineWithFilePath("docfx.exe");
        DocfxJsonFile       = DocsDirectory.CombineWithFilePath("docfx.json");
        TestOutputDirectory = RootDirectory.Combine("TestResults");

        ChangeLogDirectory    = RootDirectory.Combine("docs").Combine("changelog");
        ChangeLogGenDirectory = RootDirectory.Combine("docs").Combine("_changelog");

        SolutionFile         = RootDirectory.CombineWithFilePath("BenchmarkDotNet.sln");
        UnitTestsProjectFile = RootDirectory.Combine("tests").Combine("BenchmarkDotNet.Tests")
                               .CombineWithFilePath("BenchmarkDotNet.Tests.csproj");
        IntegrationTestsProjectFile = RootDirectory.Combine("tests").Combine("BenchmarkDotNet.IntegrationTests")
                                      .CombineWithFilePath("BenchmarkDotNet.IntegrationTests.csproj");
        TemplatesTestsProjectFile = RootDirectory.Combine("templates")
                                    .CombineWithFilePath("BenchmarkDotNet.Templates.csproj");
        AllPackableSrcProjects = new FilePathCollection(context.GetFiles(RootDirectory.FullPath + "/src/**/*.csproj")
                                                        .Where(p => !p.FullPath.Contains("Disassembler")));

        MsBuildSettings = new DotNetCoreMSBuildSettings
        {
            MaxCpuCount = 1
        };
        MsBuildSettings.WithProperty("UseSharedCompilation", "false");

        // NativeAOT build requires VS C++ tools to be added to $path via vcvars64.bat
        // but once we do that, dotnet restore fails with:
        // "Please specify a valid solution configuration using the Configuration and Platform properties"
        if (context.IsRunningOnWindows())
        {
            MsBuildSettings.WithProperty("Platform", "Any CPU");
        }
    }
Ejemplo n.º 25
0
        public IEnumerable <IFile> Install(CompilerConfiguration options, bool installAddins)
        {
            var result = new List <FilePath>();

            foreach (var package in options.Packages)
            {
                if (!package.IsCore && !installAddins)
                {
                    continue;
                }

                var paths = new FilePathCollection(PathComparer.Default);

                // Install the package.
                var packagePath      = Install(package);
                var packageDirectory = _fileSystem.GetDirectory(packagePath);

                if (package.Filters != null && package.Filters.Count > 0)
                {
                    // Get all files matching the filters.
                    foreach (var filter in package.Filters)
                    {
                        var pattern = string.Concat(packagePath.FullPath, "/", filter.TrimStart('/', '\\'));
                        paths.Add(_globber.GetFiles(pattern));
                    }
                }
                else
                {
                    // Do a recursive search in the package directory.
                    paths.Add(packageDirectory.
                              GetFiles("*", SearchScope.Recursive)
                              .Select(file => file.Path));
                }

                if (paths.Count > 0)
                {
                    result.AddRange(paths);
                }
            }

            return(result.Select(path => _fileSystem.GetFile(path)));
        }
Ejemplo n.º 26
0
        public static void PublishTestResults(ICakeContext ctx)
        {
            IAzurePipelinesProvider azurePipelines = ctx.AzurePipelines();

            if (!azurePipelines.IsRunningOnAzurePipelines || !azurePipelines.IsRunningOnAzurePipelinesHosted)
            {
                return;
            }

            FilePathCollection trxFiles = ctx.GetFiles("./**/*.trx");

            if (trxFiles.Count == 0)
            {
                return;
            }

            int index = 0;

            foreach (FilePath trxFile in trxFiles)
            {
                string sourceFile  = trxFile.FullPath;
                string directory   = IO.Path.GetDirectoryName(sourceFile);
                string renamedFile = IO.Path.Combine(directory, $"TestResults{index}.trx");
                IO.File.Move(sourceFile, renamedFile);
                index++;
            }

            FilePathCollection testResultsFiles = ctx.GetFiles("./**/*.trx");

            foreach (FilePath filePath in testResultsFiles)
            {
                ctx.Log.Information(filePath.ToString());
            }

            azurePipelines.Commands.PublishTestResults(new AzurePipelinesPublishTestResultsData
            {
                TestRunner       = AzurePipelinesTestRunnerType.VSTest,
                TestResultsFiles = testResultsFiles.ToList(),
                MergeTestResults = true,
            });
        }
Ejemplo n.º 27
0
 /// <summary>
 /// Обработать штампы и начать печать
 /// </summary>
 private IResultCollection <IFileDataSourceServer> StampContainerProcessing(IStampContainer stampContainer, IDocumentLibrary documentLibrary,
                                                                            FilePathCollection filePathCollection,
                                                                            IConvertingSettings convertingSettings, ColorPrintType colorPrintType) =>
 stampContainer.
 Void(_ => _messagingService.ShowMessage("Подключение дополнительных элементов...")).
 Void(_ => documentLibrary.AttachAdditional()).
 Void(_ => _messagingService.ShowMessage("Форматирование полей...")).
 CompressFieldsRanges().
 Void(_ => _loggerService.LogByObject(LoggerLevel.Debug, LoggerAction.Operation, ReflectionInfo.GetMethodBase(this), nameof(stampContainer.CompressFieldsRanges))).
 Map(_ => GetSavedFileDataSource(documentLibrary, filePathCollection.FilePathMain)).
 WhereContinue(_ => ConvertingModeChoice.IsPdfConvertingNeed(convertingSettings.ConvertingModeTypes),
               filesDataSource => StampContainerCreatePdf(stampContainer, documentLibrary, filePathCollection.FilePathPdf,
                                                          convertingSettings, ConvertingModeType.Pdf, colorPrintType).
               Map(filesDataSource.ConcatResult),
               filesDataSource => filesDataSource).
 WhereContinue(_ => ConvertingModeChoice.IsPrintConvertingNeed(convertingSettings.ConvertingModeTypes),
               filesDataSource => StampContainerPrint(stampContainer, documentLibrary, filePathCollection.FilePathPrint,
                                                      convertingSettings, ConvertingModeType.Print, colorPrintType).
               Map(filesDataSource.ConcatResult),
               filesDataSource => filesDataSource).
 Void(_ => documentLibrary.DetachAdditional());
        /// <summary>
        /// Validates module and theme project files.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="files">Project files to be validated.</param>
        public static void ValidateFiles(ICakeContext context, FilePathCollection files) {
            if (context == null) {
                throw new ArgumentNullException(nameof(context));
            }
            if (files == null) {
                throw new ArgumentNullException(nameof(files));
            }

            if (files.Count == 0) {
                context.Log.Verbose("There are not any files in the collection.");
                return;
            }

            foreach (var file in files) {
                try {
                    ValidateFile(context, file);
                }
                catch (Exception) {
                    context.Log.Verbose("Error validating project file \"{0}\"", file.ToString());
                }
            }
        }
        private static void Compress <T>(
            ICakeContext context,
            DirectoryPath rootPath,
            FilePath outputPath,
            string pattern,
            int level) where T : CompressionBase
        {
            Precondition.IsNotNull(context, nameof(context));
            Precondition.IsNotNull(rootPath, nameof(rootPath));
            Precondition.IsNotNull(outputPath, nameof(outputPath));
            Precondition.IsNotNullOrEmpty(pattern, nameof(pattern));
            Precondition.IsBetween(level, 1, 9, nameof(level));

            FilePathCollection filePaths = context.GetFiles(pattern);

            if (filePaths.Count == 0)
            {
                context.Log.Verbose("The provided pattern did not match any files.");
                return;
            }

            Compress <T>(context, rootPath, outputPath, filePaths, level);
        }
Ejemplo n.º 30
0
        public override void Run(Context context)
        {
            RunCoreMsBuild(context, "BuildDotnet", "PublishDotnet");

            if (context.RunNetFramework)
            {
                BuildTasks.IlRepackCli(context);
            }

            context.Zip(context.CliPackageDir, context.PackageDir.CombineWithFilePath("VGAudioCli.zip"));
            context.DeleteDirectory(context.CliPackageDir, false);

            if (context.BuildSystem().IsRunningOnAppVeyor)
            {
                FilePathCollection uploadFiles = context.GetFiles($"{context.PackageDir}/*.nupkg");
                uploadFiles.Add(context.GetFiles($"{context.PackageDir}/*.exe"));
                uploadFiles.Add(context.GetFiles($"{context.PackageDir}/*.zip"));

                foreach (FilePath file in uploadFiles)
                {
                    context.AppVeyor().UploadArtifact(file);
                }
            }
        }
Ejemplo n.º 31
0
        public static void AddFilesToZip(string zipFile, string start, string newStart, FilePathCollection files, bool append)
        {
            if (!append)
            {
                if (File.Exists(zipFile))
                {
                    File.Delete(zipFile);
                }
            }
            if (newStart != "")
            {
                newStart = newStart.EnsureEndsWith("/");
            }
            var root     = new DirectoryInfo(start);
            var rootPath = root.FullName;

            foreach (var file in files)
            {
                Console.WriteLine("Reading " + file.FullPath);
                using (var fileToZip = new FileStream(file.FullPath, FileMode.Open, FileAccess.Read))
                {
                    var pathInZip = newStart == "" ?
                                    file.FullPath.Substring(rootPath.Length + 1) :
                                    newStart + file.FullPath.Substring(rootPath.Length + 1);
                    AddStreamToZip(zipFile, fileToZip, pathInZip, true);
                }
            }
        }
Ejemplo n.º 32
0
 public static void AddFilesToZip(string zipFile, string start, string newStart, FilePathCollection files)
 {
     AddFilesToZip(zipFile, start, newStart, files, false);
 }
Ejemplo n.º 33
0
 public static void AddFilesToZip(string zipFile, string start, FilePathCollection files, bool append)
 {
     AddFilesToZip(zipFile, start, "", files, append);
 }
Ejemplo n.º 34
0
 public static void AddFilesToZip(string zipFile, FilePathCollection files)
 {
     AddFilesToZip(zipFile, ".", "", files, false);
 }
Ejemplo n.º 35
0
                public void Should_Respect_File_System_Case_Sensitivity_When_Removing_Paths(bool caseSensitive, int expectedCount)
                {
                    // Given
                    var collection = new FilePathCollection(new PathComparer(caseSensitive));
                    collection.Add("A.txt");
                    collection.Add("B.txt");
                    collection.Add("C.txt");

                    // When
                    var result = collection - new[] { new FilePath("b.txt"), new FilePath("c.txt") };

                    // Then
                    Assert.Equal(expectedCount, result.Count);
                }
Ejemplo n.º 36
0
                public void Should_Return_New_Collection()
                {
                    // Given
                    var comparer = new PathComparer(false);
                    var collection = new FilePathCollection(comparer);
                    var second = new FilePathCollection(new FilePath[] { "A.txt", "B.txt" }, comparer);

                    // When
                    var result = collection + second;

                    // Then
                    Assert.False(ReferenceEquals(result, collection));
                }
Ejemplo n.º 37
0
        public Build()
        {
            Task("Clean")
            .Does(() =>
            {
                DirectoryPathCollection AllProj = Cake.GetDirectories("./*", p => !p.Path.FullPath.Contains("CodeCakeBuilder"));
                foreach (DirectoryPath proj in AllProj)
                {
                    if (Cake.DirectoryExists(proj + "/bin"))
                    {
                        Cake.DeleteDirectory(proj + "/bin", true);
                    }
                    if (Cake.DirectoryExists(proj + "/obj"))
                    {
                        Cake.DeleteDirectory(proj + "/obj", true);
                    }
                }
            });

            Task("Restore")
            .IsDependentOn("Clean")
            .Does(() =>
            {
                Cake.DotNetCoreRestore();
            });

            Task("Restore-Tools")
            .IsDependentOn("Restore")
            .Does(() =>
            {
                DirectoryPath PackagesDir = new DirectoryPath("../packages");

                DotNetCoreRestoreSettings dotNetCoreRestoreSettings = new DotNetCoreRestoreSettings();

                dotNetCoreRestoreSettings.PackagesDirectory     = PackagesDir;
                dotNetCoreRestoreSettings.ArgumentCustomization = args => args.Append("./CodeCakeBuilder/project.json");

                Cake.DotNetCoreRestore(dotNetCoreRestoreSettings);
            });

            Task("Build")
            .IsDependentOn("Restore-Tools")
            .Does(() =>
            {
                DirectoryPathCollection AllProj = Cake.GetDirectories("./*", p => !p.Path.FullPath.Contains("CodeCakeBuilder"));
                foreach (DirectoryPath proj in AllProj)
                {
                    Cake.DotNetCoreBuild(proj.FullPath);
                }
            });

            Task("Unit-Tests")
            .IsDependentOn("Build")
            .Does(() =>
            {
                FilePathCollection FilePathTests = Cake.GetFiles("./**/*.Tests.exe", p => Cake.FileExists(p.Path + "/nunit.framework.dll"));

                Cake.OpenCover(tool =>
                {
                    tool.NUnit3(FilePathTests, new NUnit3Settings
                    {
                        ToolPath = "../packages/NUnit.ConsoleRunner/3.5.0/tools/nunit3-console.exe"
                    });
                },
                               new FilePath("../resultOpenCover.xml"),
                               new OpenCoverSettings
                {
                    ToolPath = "../packages/OpenCover/4.6.519/tools/OpenCover.Console.exe",
                    Register = "User"
                }
                               .WithFilter("+[Test]*")
                               .WithFilter("-[Test.Tests]*")
                               );
            });

            // The Default task for this script can be set here.
            Task("Default")
            .IsDependentOn("Unit-Tests");
        }
Ejemplo n.º 38
0
 /// <summary>
 /// Allows multiple results files to be aggregated into a single report output.
 /// </summary>
 /// <param name="settings">The settings object.</param>
 /// <param name="resultFiles">The report files to aggregate.</param>
 /// <returns>Settings object.</returns>
 public static StyleCopReportSettings AddResultFiles(this StyleCopReportSettings settings, FilePathCollection resultFiles)
 {
     settings.ResultFiles = resultFiles;
     return(settings);
 }
Ejemplo n.º 39
0
                public void Should_Return_New_Collection()
                {
                    // Given
                    var collection = new FilePathCollection(new PathComparer(false));
                    collection.Add("A.txt");
                    collection.Add("B.txt");
                    collection.Add("C.txt");

                    // When
                    var result = collection - new[] { new FilePath("B.txt"), new FilePath("C.txt") };

                    // Then
                    Assert.False(ReferenceEquals(result, collection));
                }
 public IResultCollection <IFileDataSourceServer> CreateProcessingFile(IDocumentLibrary documentLibrary, FilePathCollection filePathCollection,
                                                                       IConvertingSettings convertingSettings, ColorPrintType colorPrintType) =>
 ExecuteBindResultValue(() => CreateProcessingDocument(documentLibrary, filePathCollection, convertingSettings, colorPrintType),
                        new ErrorCommon(ErrorConvertingType.PdfPrintingError,
                                        $"Ошибка обработки файла {filePathCollection.FilePathMain.FileNameClient}")).
 ToResultCollection();
Ejemplo n.º 41
0
                public void Should_Respect_File_System_Case_Sensitivity_When_Removing_Paths(bool caseSensitive, int expectedCount)
                {
                    // Given
                    var collection = new FilePathCollection(new FilePath[] { "A.TXT", "B.TXT" }, new PathComparer(caseSensitive));

                    // When
                    collection.Remove(new FilePath[] { "a.txt", "b.txt", "c.txt" });

                    // Then
                    Assert.Equal(expectedCount, collection.Count);
                }
Ejemplo n.º 42
0
                public void Should_Respect_File_System_Case_Sensitivity_When_Adding_Paths()
                {
                    // Given
                    var comparer = new PathComparer(false);
                    var collection = new FilePathCollection(comparer);
                    var second = new FilePathCollection(new FilePath[] { "A.txt", "B.txt" }, comparer);

                    // When
                    var result = collection + second;

                    // Then
                    Assert.Equal(2, result.Count);
                }
Ejemplo n.º 43
0
                public void Should_Respect_File_System_Case_Sensitivity_When_Adding_Path()
                {
                    // Given
                    var collection = new FilePathCollection(new PathComparer(false));
                    collection.Add("B.txt");

                    // When
                    var result = collection + new FilePath("A.txt");

                    // Then
                    Assert.Equal(2, result.Count);
                }
Ejemplo n.º 44
0
 public static FilePathCollection FilterThemeBinaries(this ICakeContext context,
     FilePathCollection themeBinaries, FilePathCollection orchardWebBinaries) {
     return FilterBinaries.Filter(context, themeBinaries, orchardWebBinaries);
 }
Ejemplo n.º 45
0
 public static void ValidateOrchardFiles(this ICakeContext context, FilePathCollection files) {
     ValidateExtensionProjectFiles.ValidateFiles(context, files);
 }