public void read_a_package_manifest()
        {
            theOriginal = new ApplicationManifest
            {
                Name = "Han Solo",
                ContentFileSet = new FileSet()
                {
                    DeepSearch = true,
                    Exclude = "*.xml",
                    Include = "*.config"
                },
                DataFileSet = new FileSet()
                {
                    DeepSearch = true,
                    Exclude = "*.txt",
                    Include = "*.xml"
                }
            };

            theOriginal.AddAssembly("Fubu.Assem1");
            theOriginal.AddAssembly("Fubu.Assem2");
            theOriginal.AddAssembly("Fubu.Assem3");

            new FileSystem().WriteObjectToFile("manifest.xml", theOriginal);

            var reader = new PackageManifestXmlReader();
            theResultingManifest = reader.ReadFrom("manifest.xml");
        }
Exemple #2
0
        protected override void beforeEach()
        {
            theBaseFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "folder1");
            theBinFolder  = Path.Combine(theBaseFolder, "bin");

            theManifest = new PackageManifest {
                DataFileSet    = new FileSet(),
                ContentFileSet = new FileSet()
            };

            theManifest.AddAssembly("A");
            theManifest.AddAssembly("B");
            theManifest.AddAssembly("C");

            theInput = new CreatePackageInput()
            {
                PackageFolder = theBaseFolder
            };

            theAssemblyFiles = new AssemblyFiles()
            {
                Files             = new string[] { "a.dll", "b.dll" },
                MissingAssemblies = new string[] { "c" },
                PdbFiles          = new string[] { "a.dll", "b.dll", "c.dll" },
                Success           = false
            };

            MockFor <IAssemblyFileFinder>()
            .Stub(x => x.FindAssemblies(theBinFolder, theManifest.Assemblies))
            .Return(theAssemblyFiles);

            ClassUnderTest.CreatePackage(theInput, theManifest);
        }
Exemple #3
0
        public void read_a_package_manifest()
        {
            theOriginal = new ApplicationManifest
            {
                Name           = "Han Solo",
                ContentFileSet = new FileSet()
                {
                    DeepSearch = true,
                    Exclude    = "*.xml",
                    Include    = "*.config"
                },
                DataFileSet = new FileSet()
                {
                    DeepSearch = true,
                    Exclude    = "*.txt",
                    Include    = "*.xml"
                }
            };


            theOriginal.AddAssembly("Fubu.Assem1");
            theOriginal.AddAssembly("Fubu.Assem2");
            theOriginal.AddAssembly("Fubu.Assem3");

            new FileSystem().WriteObjectToFile("manifest.xml", theOriginal);

            var reader = new PackageManifestXmlReader();

            theResultingManifest = reader.ReadFrom("manifest.xml");
        }
Exemple #4
0
        protected override void beforeEach()
        {
            theBaseFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "folder1");
            theBinFolder  = Path.Combine(theBaseFolder, "bin");

            theManifest = new PackageManifest
            {
                DataFileSet    = new FileSet(),
                ContentFileSet = new FileSet()
            };

            theManifest.AddAssembly("A");
            theManifest.AddAssembly("B");
            theManifest.AddAssembly("C");

            theInput = new CreatePackageInput()
            {
                PackageFolder = theBaseFolder,
                ZipFile       = Path.Combine(theBaseFolder, "package1.zip"),
                PdbFlag       = true
            };

            theAssemblyFiles = new AssemblyFiles()
            {
                Files = new string[] {
                    FileSystem.Combine(theBinFolder, "a.dll"),
                    FileSystem.Combine(theBinFolder, "b.dll"),
                    FileSystem.Combine(theBinFolder, "c.dll")
                },
                MissingAssemblies = new string[0],
                PdbFiles          = new string[] {
                    FileSystem.Combine(theBinFolder, "a.pdb"),
                    FileSystem.Combine(theBinFolder, "b.pdb"),
                    FileSystem.Combine(theBinFolder, "c.pdb")
                },
                Success = true
            };

            MockFor <IAssemblyFileFinder>()
            .Stub(x => x.FindAssemblies(theBinFolder, theManifest.Assemblies))
            .Return(theAssemblyFiles);

            _theZipFileService = new StubZipFileService();
            Services.Inject <IZipFileService>(_theZipFileService);

            thePackageManifestFileName = FileSystem.Combine(theBaseFolder, PackageManifest.FILE);

            ClassUnderTest.CreatePackage(theInput, theManifest);
        }
Exemple #5
0
        public void Execute(InitInput input, IFileSystem fileSystem)
        {
            var assemblyName = fileSystem.GetFileName(input.Path);

            var manifest = new PackageManifest
            {
                Name = input.Name
            };

            manifest.AddAssembly(assemblyName);

            manifest.SetRole(input.RoleFlag ?? BottleRoles.Module);

            if (input.NoWebContentFlag)
            {
                manifest.ContentFileSet = new FileSet {
                    DeepSearch = false, Include = "*.config"
                };
            }



            if (input.ForceFlag || !fileSystem.FileExists(FileSystem.Combine(input.Path, PackageManifest.FILE)))
            {
                fileSystem.PersistToFile(manifest, input.Path, PackageManifest.FILE);
            }


            if (input.OpenFlag)
            {
                fileSystem.LaunchEditor(input.Path, PackageManifest.FILE);
            }
        }
Exemple #6
0
        public void Execute(InitPakInput input, IFileSystem fileSystem)
        {
            var assemblyName = fileSystem.GetFileName(input.Path);

            var manifest = new PackageManifest {
                Name = input.Name,
                Role = input.RoleFlag ?? PackageRole.Module
            };

            if (input.NoWebContentFlag)
            {
                manifest.ContentFileSet = new FileSet()
                {
                    DeepSearch = false, Include = "*.config"
                }
            }
            ;

            manifest.AddAssembly(assemblyName);

            manifest.EnvironmentAssembly  = input.EnvironmentAssemblyFlag;
            manifest.EnvironmentClassName = input.EnvironmentClassNameFlag;

            if (!fileSystem.FileExists(FileSystem.Combine(input.Path, PackageManifest.FILE)))
            {
                fileSystem.PersistToFile(manifest, input.Path, PackageManifest.FILE);
            }


            if (input.OpenFlag)
            {
                fileSystem.LaunchEditor(input.Path, PackageManifest.FILE);
            }
        }
    }
Exemple #7
0
        public void SetUp()
        {
            packageFolder = FileSystem.Combine("../../../TestPackage1").ToFullPath();

            var fileSystem = new FileSystem();
            var manifest   = new PackageManifest()
            {
                Name = "pak1"
            };

            manifest.AddAssembly("TestPackage1");

            fileSystem.PersistToFile(manifest, packageFolder, PackageManifest.FILE);

            reader = new PackageManifestReader("../../".ToFullPath(), fileSystem, folder => folder);
        }
        public void SetUp()
        {
            packageFolder = FileSystem.Combine("../../../TestPackage1").ToFullPath();

            var fileSystem = new FileSystem();
            var manifest   = new PackageManifest {
                Name = "pak1"
            };

            manifest.AddAssembly("TestPackage1");

            fileSystem.PersistToFile(manifest, packageFolder, PackageManifest.FILE);

            linkedFolderReader = new LinkedFolderPackageLoader(theApplicationDirectory, f => f);

            reader = new PackageManifestReader(fileSystem, folder => folder);
        }
Exemple #9
0
        private static void writeManifestIfNecessary(string directory, FileSystem fileSystem)
        {
            var manifestFile = directory.AppendPath(PackageManifest.FILE);

            if (!File.Exists(manifestFile))
            {
                var manifest = new PackageManifest {
                    ContentFileSet = FileSet.Deep("*.*")
                };
                string assemblyName = Path.GetFileName(directory);
                manifest.Name = assemblyName;
                manifest.AddAssembly(assemblyName);

                manifest.ContentFileSet.Exclude = "Properties/*;bin/*;obj/*;*.csproj*;packages.config;repositories.config;pak-*.zip;*.sln";

                fileSystem.WriteObjectToFile(manifestFile, manifest);
            }
        }
        public PackageManifest ReadFrom(string fileName)
        {
            var document = new XmlDocument();
            document.Load(fileName);

            var manifest = new PackageManifest{
                Name = document.DocumentElement.SelectSingleNode("Name").InnerText,
                ContentFileSet = buildFileSet(document, x => x.ContentFileSet),
                DataFileSet = buildFileSet(document, x => x.DataFileSet)
            };

            foreach (XmlNode node in document.DocumentElement.SelectNodes("assembly"))
            {
                manifest.AddAssembly(node.InnerText);
            }

            return manifest;
        }
Exemple #11
0
        public PackageManifest ReadFrom(string fileName)
        {
            var document = new XmlDocument();

            document.Load(fileName);

            var manifest = new PackageManifest {
                Name           = document.DocumentElement.SelectSingleNode("Name").InnerText,
                ContentFileSet = buildFileSet(document, x => x.ContentFileSet),
                DataFileSet    = buildFileSet(document, x => x.DataFileSet)
            };

            foreach (XmlNode node in document.DocumentElement.SelectNodes("assembly"))
            {
                manifest.AddAssembly(node.InnerText);
            }

            return(manifest);
        }
Exemple #12
0
        public void load_packages_by_assembly()
        {
            var includes = new PackageManifest();

            includes.AddAssembly("TestPackage1");

            new FileSystem().PersistToFile(includes, "../../".ToFullPath(), PackageManifest.FILE);

            var assemblyLoader = new AssemblyLoader(new PackagingDiagnostics());

            assemblyLoader.AssemblyFileLoader = file => Assembly.Load(File.ReadAllBytes(file));

            var package = reader.Load(new PackageLog()).Single();

            assemblyLoader.LoadAssembliesFromPackage(package);

            assemblyLoader
            .Assemblies
            .Single()
            .GetName()
            .Name
            .ShouldEqual("TestPackage1");
        }