Inheritance: IPackageInfo
Beispiel #1
0
        public ExtendedTester()
        {
            var testRoot = Path.Combine(Directory.GetCurrentDirectory(), "Templates");

            var pathApp = Path.Combine(testRoot, "App");
            var pathPackage1 = Path.Combine(pathApp, "fubu-packages", "Package1", "WebContent");
            var pathPackage2 = Path.Combine(testRoot, "Package2");

            var packages = new List<IPackageInfo>();
            var pack1 = new PackageInfo(Package1);
            var pack2 = new PackageInfo(Package2);
            pack1.RegisterFolder(BottleFiles.WebContentFolder, pathPackage1);
            pack2.RegisterFolder(BottleFiles.WebContentFolder, pathPackage2);
            packages.Add(pack1);
            packages.Add(pack2);

            var scanner = new TemplateFinder(new FileScanner(), packages) {HostPath = pathApp};

            var allTemplates = new TemplateRegistry();
            allTemplates.AddRange(scanner.FindInPackages());
            allTemplates.AddRange(scanner.FindInHost());

            var viewPathPolicy = new ViewPathPolicy();
            allTemplates.Each(viewPathPolicy.Apply);
            _viewFolder = new TemplateViewFolder(allTemplates);
            _engine = new SparkViewEngine
            {
                ViewFolder = _viewFolder,
                BindingProvider = new FubuBindingProvider(new TemplateRegistry(allTemplates))
            };

            _pak1TemplateRegistry = new TemplateRegistry(allTemplates.ByOrigin(Package1));
            _pak2TemplateRegistry = new TemplateRegistry(allTemplates.ByOrigin(Package2));
            _appTemplateRegistry = new TemplateRegistry(allTemplates.FromHost());
        }
 private void readAssemblyPaths(PackageManifest manifest, PackageInfo package, string binPath)
 {
     var assemblyPaths = findCandidateAssemblyFiles(binPath);
     assemblyPaths.Each(path =>
     {
         var assemblyName = Path.GetFileNameWithoutExtension(path);
         if (manifest.Assemblies.Contains(assemblyName))
         {
             package.RegisterAssemblyLocation(assemblyName, path);
         }
     });
 }
Beispiel #3
0
        public ExtendedTester()
        {
            var testRoot = Path.Combine(Directory.GetCurrentDirectory(), "Templates");

            var pathApp = Path.Combine(testRoot, "App");
            var pathPackage1 = Path.Combine(pathApp, "fubu-packages", "Package1", "WebContent");
            var pathPackage2 = Path.Combine(testRoot, "Package2");

            var packages = new List<IPackageInfo>();
            var pack1 = new PackageInfo(new PackageManifest() { Name = Package1 });
            var pack2 = new PackageInfo(new PackageManifest() { Name = Package2 });
            pack1.RegisterFolder(BottleFiles.WebContentFolder, pathPackage1);
            pack2.RegisterFolder(BottleFiles.WebContentFolder, pathPackage2);
            packages.Add(pack1);
            packages.Add(pack2);

            var scanner = new TemplateFinder<Template>(new FileScanner(), packages){
                HostPath = pathApp
            };
            new DefaultRazorTemplateFinderConventions().Configure(scanner);

            var allTemplates = new TemplateRegistry<IRazorTemplate>();
            allTemplates.AddRange(scanner.FindInPackages());
            allTemplates.AddRange(scanner.FindInHost());

            var viewPathPolicy = new ViewPathPolicy<IRazorTemplate>();
            allTemplates.Each(viewPathPolicy.Apply);

            var config = new TemplateServiceConfiguration{
                BaseTemplateType = typeof (FubuRazorView)
            };
            _templateService = new FubuTemplateService(allTemplates, new TemplateService(config), new FileSystem());

            _pak1TemplateRegistry = new TemplateRegistry<IRazorTemplate>(allTemplates.ByOrigin(Package1));
            _pak2TemplateRegistry = new TemplateRegistry<IRazorTemplate>(allTemplates.ByOrigin(Package2));
            _appTemplateRegistry = new TemplateRegistry<IRazorTemplate>(allTemplates.FromHost());

            _serviceLocator = MockRepository.GenerateMock<IServiceLocator>();

            var sharingGraph = new SharingGraph();
            sharingGraph.Dependency("Package1", "Host");
            sharingGraph.Dependency("Package2", "Host");
            var templateDirectory = new TemplateDirectoryProvider<IRazorTemplate>(new SharedPathBuilder(), allTemplates,
                                                                                  sharingGraph);
            _sharedTemplateLocator = new SharedTemplateLocator<IRazorTemplate>(templateDirectory, allTemplates,
                                                                               new RazorTemplateSelector());
        }
        public IPackageInfo LoadFromFolder(string packageDirectory)
        {
            packageDirectory = packageDirectory.ToFullPath();

            var manifest = _fileSystem.LoadFromFile<PackageManifest>(packageDirectory, PackageManifest.FILE);
            var package = new PackageInfo(manifest){
                Description = "{0} ({1})".ToFormat(manifest.Name, packageDirectory),
                Dependencies = manifest.Dependencies
            };

            // Right here, this needs to be different
            registerFolders(packageDirectory, package);

            var binPath = determineBinPath(packageDirectory);

            readAssemblyPaths(manifest, package, binPath);

            return package;
        }
Beispiel #5
0
        public IPackageInfo LoadFromFolder(string packageDirectory)
        {
            packageDirectory = packageDirectory.ToFullPath();

            var manifest = _fileSystem.LoadFromFile<PackageManifest>(packageDirectory, PackageManifest.FILE);
            var package = new PackageInfo(manifest.Name){
                Description = "{0} ({1})".ToFormat(manifest.Name, packageDirectory),
            };

            // Right here, this needs to be different
            package.RegisterFolder(BottleFiles.WebContentFolder, _getContentFolderFromPackageFolder(packageDirectory));
            package.RegisterFolder(BottleFiles.DataFolder, FileSystem.Combine(packageDirectory, BottleFiles.DataFolder));
            package.RegisterFolder(BottleFiles.ConfigFolder, FileSystem.Combine(packageDirectory, BottleFiles.ConfigFolder));

            var binPath = FileSystem.Combine(packageDirectory, "bin");
            var debugPath = FileSystem.Combine(binPath, "debug");
            if (_fileSystem.DirectoryExists(debugPath))
            {
                binPath = debugPath;
            }

            //REVIEW: I feel this whole section is left-hand / right-hand code
            package.Role = manifest.Role;

            var assemblyPaths = findCandidateAssemblyFiles(binPath);
            assemblyPaths.Each(path =>
            {
                var assemblyName = Path.GetFileNameWithoutExtension(path);
                if (manifest.Assemblies.Contains(assemblyName))
                {
                    package.RegisterAssemblyLocation(assemblyName, path);
                }
            });

            return package;
        }
 public bool Equals(PackageInfo other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return Equals(other.Name, Name) && Equals(other.Description, Description);
 }
 private void registerFolders(string packageDirectory, PackageInfo package)
 {
     package.RegisterFolder(BottleFiles.WebContentFolder, _getContentFolderFromPackageFolder(packageDirectory));
     package.RegisterFolder(BottleFiles.DataFolder, FileSystem.Combine(packageDirectory, BottleFiles.DataFolder));
     package.RegisterFolder(BottleFiles.ConfigFolder, FileSystem.Combine(packageDirectory, BottleFiles.ConfigFolder));
 }