public void ProducesCorrectOutputFromPackageIncludingDYF()
        {
            // Arrange
            var packageName       = "EvenOdd";
            var packageDirectory  = Path.GetFullPath(Path.Combine(toolsTestFilesDirectory, @"..\..\pkgs", packageName));
            var testOutputDirName = "doc";

            tempDirectory = new DirectoryInfo(Path.Combine(packageDirectory, testOutputDirName));
            Assert.IsFalse(tempDirectory.Exists);

            var expectedFileNames = new List <string>
            {
                "Test.EvenOdd.md"
            };

            // Act
            var opts = new FromPackageOptions
            {
                InputFolderPath = packageDirectory,
                Overwrite       = true
            };

            FromPackageFolderCommand.HandlePackageDocumentation(opts);

            tempDirectory.Refresh();

            // Assert
            Assert.IsTrue(tempDirectory.Exists);
            CollectionAssert.AreEquivalent(expectedFileNames, tempDirectory.GetFiles().Select(x => x.Name));
        }
Ejemplo n.º 2
0
        internal static string HandleFromPackage(FromPackageOptions opts)
        {
            try
            {
                FromPackageFolderCommand.HandlePackageDocumentation(opts);
            }
            catch (Exception e)
            {
                LogExceptionToConsole(e);
            }

            return("");
        }
        public void ProducesCorrectOutputFromPackage()
        {
            // Arrange
            var packageName       = "Dynamo Samples";
            var packageDirectory  = Path.GetFullPath(Path.Combine(toolsTestFilesDirectory, @"..\..\pkgs", packageName));
            var testOutputDirName = "doc";

            tempDirectory = new DirectoryInfo(Path.Combine(packageDirectory, testOutputDirName));
            Assert.IsFalse(tempDirectory.Exists);

            var expectedFileNames = new List <string>
            {
                "Examples.BasicExample.Awesome.md",
                "Examples.BasicExample.Create(point).md",
                "Examples.BasicExample.Create(x, y, z).md",
                "Examples.BasicExample.MultiReturnExample.md",
                "Examples.BasicExample.MultiReturnExample2.md",
                "Examples.BasicExample.Point.md",
                "Examples.CustomRenderExample.Create.md",
                "Examples.PeriodicIncrement.Increment.md",
                "Examples.PeriodicUpdateExample.PointField.md",
                "Examples.TransformableExample.ByGeometry.md",
                "Examples.TransformableExample.Geometry.md",
                "Examples.TransformableExample.TransformObject.md",
                "SampleLibraryUI.Examples.ButtonCustomNodeModel.md",
                "SampleLibraryUI.Examples.DropDownExample.md",
                "SampleLibraryUI.Examples.LocalizedCustomNodeModel.md",
                "SampleLibraryUI.Examples.SliderCustomNodeModel.md"
            };

            // Act
            var opts = new FromPackageOptions
            {
                InputFolderPath = packageDirectory,
                ReferencePaths  = new List <string> {
                    toolsTestFilesDirectory
                }
            };

            FromPackageFolderCommand.HandlePackageDocumentation(opts);

            tempDirectory.Refresh();

            // Assert
            Assert.IsTrue(tempDirectory.Exists);
            CollectionAssert.AreEquivalent(expectedFileNames, tempDirectory.GetFiles().Select(x => x.Name));
        }
Ejemplo n.º 4
0
        internal static void HandlePackageDocumentation(FromPackageOptions opts)
        {
            Program.VerboseMode = opts.Verbose;
            var package = PackageFromRoot(opts.InputFolderPath);

            var nodeLibraryFileInfos = ScanNodeLibraries(package, opts.ReferencePaths);
            var customNodeFileInfos  = ScanCustomNodes(package);

            var fileInfos = nodeLibraryFileInfos
                            .Union(customNodeFileInfos);

            var outdir = package.NodeDocumentaionDirectory;

            if (!Directory.Exists(outdir))
            {
                Directory.CreateDirectory(outdir);
            }

            MarkdownHandler.CreateMdFilesFromFileNames(fileInfos, outdir, opts.Overwrite);
        }