public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log)
        {
            log.Trace("Determining subscriptions for node " + _cache.NodeName);

            _repository.SaveTransportNode();

            var requirements = determineStaticRequirements(log);

            if (requirements.Any())
            {
                log.Trace("Found static subscription requirements:");
                requirements.Each(x => log.Trace(x.ToString()));
            }
            else
            {
                log.Trace("No static subscriptions found from registry");
            }

            _repository.PersistSubscriptions(requirements);

            var subscriptions = _repository.LoadSubscriptions(SubscriptionRole.Publishes);
            _cache.LoadSubscriptions(subscriptions);

            sendSubscriptions();
        }
Example #2
0
        public void Activate(IEnumerable <IPackageInfo> packages, IPackageLog log)
        {
            log.Trace("Determining subscriptions for node " + _cache.NodeName);

            // assuming that there are no automaticly persistent tasks
            // upon startup
            _repository.Persist(new TransportNode(_graph));

            var requirements = determineStaticRequirements(log);


            if (requirements.Any())
            {
                log.Trace("Found static subscription requirements:");
                requirements.Each(x => log.Trace(x.ToString()));
            }
            else
            {
                log.Trace("No static subscriptions found from registry");
            }

            _repository.PersistSubscriptions(requirements);

            var subscriptions = _repository.LoadSubscriptions(SubscriptionRole.Publishes);

            _cache.LoadSubscriptions(subscriptions);

            sendSubscriptions();
        }
Example #3
0
        public IEnumerable <IPackageInfo> Load(IPackageLog log)
        {
            var packages = new List <IPackageInfo>();

            var manifestFile = FileSystem.Combine(_applicationDirectory, LinkManifest.FILE);
            var manifest     = _fileSystem.LoadFromFile <LinkManifest>(manifestFile);

            if (manifest == null)
            {
                log.Trace("No package manifest found at {0}", manifestFile);
                return(packages);
            }

            if (manifest.LinkedFolders.Any())
            {
                log.Trace("Loading linked folders via the package manifest at " + _applicationDirectory);
                manifest.LinkedFolders.Each(folder =>
                {
                    var linkedFolder = FileSystem.Combine(_applicationDirectory, folder).ToFullPath();
                    log.Trace("  - linking folder " + linkedFolder);

                    var package = _reader.LoadFromFolder(linkedFolder);
                    packages.Add(package);
                });
            }
            else
            {
                log.Trace("No linked folders found in the package manifest file at " + _applicationDirectory);
            }

            return(packages);
        }
        public IEnumerable<IPackageInfo> Load(IPackageLog log)
        {
            var packages = new List<IPackageInfo>();

            var manifestFile = _applicationDirectory.AppendPath(LinkManifest.FILE);
            var manifest = _fileSystem.LoadFromFile<LinkManifest>(manifestFile);
            if (manifest == null)
            {
                log.Trace("No package manifest found at {0}", manifestFile);
                return packages;
            }

            if (manifest.LinkedFolders.Any())
            {
                log.Trace("Loading linked folders via the package manifest at " + _applicationDirectory);
                manifest.LinkedFolders.Each(folder =>
                {
                    if (Platform.IsUnix()) {
                        folder = folder.Replace('\\', Path.DirectorySeparatorChar);
                    }

                    var linkedFolder = FileSystem.Combine(_applicationDirectory, folder).ToFullPath();
                    log.Trace("  - linking folder " + linkedFolder);

                    var package = _reader.LoadFromFolder(linkedFolder);
                    packages.Add(package);
                });
            }
            else
            {
                log.Trace("No linked folders found in the package manifest file at " + _applicationDirectory);
            }

            return packages;
        }
        public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log)
        {
            log.Trace("Determining subscriptions for node " + _cache.NodeName);

            // assuming that there are no automaticly persistent tasks
            // upon startup
            _repository.Persist(new TransportNode(_graph));

            var requirements = determineStaticRequirements(log);

            if (requirements.Any())
            {
                log.Trace("Found static subscription requirements:");
                requirements.Each(x => log.Trace(x.ToString()));
            }
            else
            {
                log.Trace("No static subscriptions found from registry");
            }

            _repository.PersistSubscriptions(requirements);

            var subscriptions = _repository.LoadSubscriptions(SubscriptionRole.Publishes);
            _cache.LoadSubscriptions(subscriptions);

            sendSubscriptions();
        }
Example #6
0
        private void configureRazorSettings(IPackageLog log)
        {
            _engine.Namespaces.Add(typeof(VirtualPathUtility).Namespace); // System.Web
            _engine.Namespaces.Add(typeof(RazorViewFacility).Namespace); // FubuMVC.Razor
            _engine.Namespaces.Add(typeof(FubuPageExtensions).Namespace); // FubuMVC.Core.UI
            _engine.Namespaces.Add(typeof(HtmlTag).Namespace); // HtmlTags

            log.Trace("Adding namespaces to RazorSettings:");
            _engine.Namespaces.Each(x => log.Trace("  - {0}".ToFormat(x)));
        }
Example #7
0
        private void configureRazorSettings(IPackageLog log)
        {
            _engine.Namespaces.Add(typeof(VirtualPathUtility).Namespace); // System.Web
            _engine.Namespaces.Add(typeof(RazorViewFacility).Namespace);  // FubuMVC.Razor
            _engine.Namespaces.Add(typeof(FubuPageExtensions).Namespace); // FubuMVC.Core.UI
            _engine.Namespaces.Add(typeof(HtmlTag).Namespace);            // HtmlTags

            log.Trace("Adding namespaces to RazorSettings:");
            _engine.Namespaces.Each(x => log.Trace("  - {0}".ToFormat(x)));
        }
Example #8
0
        private void configureRazorSettings(IPackageLog log)
        {
            _namespaces.Add(typeof(VirtualPathUtility).Namespace); // System.Web)
            _namespaces.AddForType<RazorViewFacility>(); // FubuMVC.Razor
            _namespaces.AddForType<IPartialInvoker>(); // FubuMVC.Core.UI
            _namespaces.AddForType<HtmlTag>(); // HtmlTags
            _namespaces.AddForType<string>();

            log.Trace("Adding namespaces to RazorSettings:");
            _namespaces.Namespaces.Each(x => log.Trace("  - {0}".ToFormat(x)));
        }
        void IFubuRegistryExtension.Configure(FubuRegistry registry)
        {
            if (shouldScan())
            {
                scan(registry);
            }

            _logger.Trace("Adding [{0}] to registry [{1}]", typeof(SparkViewFacility).Name, registry.Name);
            registry.Views.Facility(new SparkViewFacility(_templateRegistry));
            registry.Services(configureServices);
        }
        private void setEngineDependencies(IPackageLog log)
        {
            var engine = (SparkViewEngine) _engine;

            engine.ViewFolder = new TemplateViewFolder(_templateRegistry);
            log.Trace("Setting viewfolder [{0}] for view engine", _engine.ViewFolder.GetType().FullName);
            
            engine.DefaultPageBaseType = typeof(FubuSparkView).FullName;
            log.Trace("Setting page base type [{0}] for views", _engine.DefaultPageBaseType);

            engine.BindingProvider = new FubuBindingProvider(_templateRegistry);
            log.Trace("Setting binding provider [{0}] for view engine", engine.BindingProvider.GetType().FullName);
        }
        public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log)
        {
            if (!_settings.AutoHostingEnabled)
            {
                log.Trace("Embedded Katana hosting is not enabled");
                return;
            }

            Console.WriteLine("Starting Katana hosting at port " + _settings.Port);
            log.Trace("Starting Katana hosting at port " + _settings.Port);

            _settings.EmbeddedServer = new EmbeddedFubuMvcServer(_settings, _urls, _services, _routes);
        }
Example #12
0
        public void Activate(IEnumerable <IPackageInfo> packages, IPackageLog log)
        {
            if (!_settings.AutoHostingEnabled)
            {
                log.Trace("Embedded Katana hosting is not enabled");
                return;
            }

            Console.WriteLine("Starting Katana hosting at port " + _settings.Port);
            log.Trace("Starting Katana hosting at port " + _settings.Port);

            _settings.EmbeddedServer = new EmbeddedFubuMvcServer(_runtime, port: _settings.Port);
        }
Example #13
0
        public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log)
        {
            if (!_settings.AutoHostingEnabled)
            {
                log.Trace("Embedded Nowin hosting is not enabled");
                return;
            }

            Console.WriteLine("Starting Nowin hosting at port " + _settings.Port);
            log.Trace("Starting Nowin hosting at port " + _settings.Port);

            _settings.EmbeddedServer = new EmbeddedFubuMvcServer(_runtime, port:_settings.Port);
        }
Example #14
0
        private void setEngineDependencies(IPackageLog log)
        {
            var engine = (SparkViewEngine)_engine;

            engine.ViewFolder = new TemplateViewFolder(_templateRegistry);
            log.Trace("Setting viewfolder [{0}] for view engine", _engine.ViewFolder.GetType().FullName);

            engine.DefaultPageBaseType = typeof(FubuSparkView).FullName;
            log.Trace("Setting page base type [{0}] for views", _engine.DefaultPageBaseType);

            engine.BindingProvider = new FubuBindingProvider(_templateRegistry);
            log.Trace("Setting binding provider [{0}] for view engine", engine.BindingProvider.GetType().FullName);
        }
        // TODO -- gotta put some serious logging here when we get to diagnostics
        // and package loading
        public void LoadFiles(PackageAssetDirectory directory)
        {
            var contentFolder = FindContentFolder(directory.Directory);

            if (contentFolder == null)
            {
                string theMessage = NoContentFoundForPackageAt.ToFormat(directory.Directory);
                _log.Trace(theMessage);

                return;
            }

            _log.Trace(LoadingContentForPackageAt.ToFormat(contentFolder));
            LoadFilesFromContentFolder(directory, contentFolder);
        }
        public void Deactivate(IPackageLog log)
        {
            if(_settings.Disabled) return;

            log.Trace("Shutting down the scheduled jobs");
            _scheduledJobs.Deactivate();
        }
Example #17
0
        public static IEnumerable <T> VerifyAnyRegistrations <T>(this IServiceLocator services, IPackageLog log)
        {
            try
            {
                var holder = services.GetInstance <Holder <T> >();
                holder.List.Each(x => {
                    log.Trace("Using {0} for {1}", x.GetType().FullName, typeof(T).FullName);
                });


                if (!holder.List.Any())
                {
                    log.MarkFailure("No implementations of {0} are registered", typeof(T).FullName);
                }

                return(holder.List);
            }
            catch (Exception ex)
            {
                log.MarkFailure("Could not resolve the list of " + typeof(T).FullName);
                log.MarkFailure(ex);

                return(Enumerable.Empty <T>());
            }
        }
        public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log)
        {
            var postActionsFinder = new BehaviorVisitor(_graph.Observer, "Looking for valid POST actions.");
            postActionsFinder.Filters.Add(x => x.Route != null);
            postActionsFinder.Filters.Add(x => x.Route.AllowedHttpMethods.Contains("POST"));
            postActionsFinder.Filters.Add(x => x.FirstCall() != null);
            postActionsFinder.Filters.Add(x => x.FirstCall().HasOutput);
            postActionsFinder.Filters.Add(x => x.FirstCall().HasInput);
            postActionsFinder.Actions += x =>
            {
                var postAction = x.FirstCall();
                var handlerActions = _graph.ActionsForHandler(postAction.HandlerType);
                var getAction = handlerActions
                    .Where(h => h.ParentChain().Route != null)
                    .Where(h => h.ParentChain().Route.AllowedHttpMethods.Contains("GET"))
                    .Where(h => h.HasInput).Where(h => h.HasOutput)
                    .FirstOrDefault(h => x.InputType().IsAssignableFrom(h.OutputType()));

                if (getAction == null)
                {
                    return;
                }
                log.Trace("Linking validation descriptor for {0} against {1}.", postAction, getAction);
                _provider.Register(postAction, getAction.InputType());
            };
            _graph.VisitBehaviors(postActionsFinder);
        }
Example #19
0
        public void Activate(IEnumerable <IPackageInfo> packages, IPackageLog log)
        {
            log.Trace("Running {0}".ToFormat(GetType().Name));

            configureSparkSettings(log);
            setEngineDependencies(log);
        }
        public IEnumerable<IPackageInfo> Load(IPackageLog log)
        {
            var list = new List<string> { AppDomain.CurrentDomain.SetupInformation.ApplicationBase };

            string binPath = AppDomain.CurrentDomain.SetupInformation.PrivateBinPath;
            if (binPath.IsNotEmpty())
            {
                if (Path.IsPathRooted(binPath))
                {
                    list.Add(binPath);
                }
                else
                {
                    list.Add(AppDomain.CurrentDomain.SetupInformation.ApplicationBase.AppendPath(binPath));
                }
            }

            list.Each(x =>
            {
                log.Trace("Looking for assemblies marked with the [FubuModule] attribute in " + x);
            });

            return list.SelectMany(
                x =>
                AssembliesFromPath(x, assem => assem.GetCustomAttributes(typeof (FubuModuleAttribute), false).Any()))
                .Select(assem => new AssemblyPackageInfo(assem));
        }
Example #21
0
        // I would rather have this as a ISharingPolicy, but don't know how to ensure it is applied last.
        public void RegisterAppGlobal(IPackageLog log)
        {
            log.Trace("Registering application as global sharing.");

            Diagnostics.SetCurrentProvenance(TemplateConstants.HostOrigin);
            Diagnostics.Global(TemplateConstants.HostOrigin);
        }
Example #22
0
        public IEnumerable <IPackageInfo> Load(IPackageLog log)
        {
            var list = new List <string> {
                AppDomain.CurrentDomain.SetupInformation.ApplicationBase
            };

            string binPath = AppDomain.CurrentDomain.SetupInformation.PrivateBinPath;

            if (binPath.IsNotEmpty())
            {
                if (Path.IsPathRooted(binPath))
                {
                    list.Add(binPath);
                }
                else
                {
                    list.Add(AppDomain.CurrentDomain.SetupInformation.ApplicationBase.AppendPath(binPath));
                }
            }


            list.Each(x =>
            {
                log.Trace("Looking for assemblies marked with the [FubuModule] attribute in " + x);
            });

            return(list.SelectMany(
                       x =>
                       AssembliesFromPath(x, assem => assem.GetCustomAttributes(typeof(FubuModuleAttribute), false).Any()))
                   .Select(assem => new AssemblyPackageInfo(assem)));
        }
Example #23
0
        public IEnumerable <IPackageInfo> Load(IPackageLog log)
        {
            var list = new List <string> {
                AppDomain.CurrentDomain.SetupInformation.ApplicationBase
            };

            var binPath = FubuMvcPackageFacility.FindBinPath();

            if (binPath.IsNotEmpty())
            {
                list.Add(binPath);
            }

            // This is a workaround for Self Hosted apps where the physical path is different than the AppDomain's original
            // path
            if (FubuMvcPackageFacility.PhysicalRootPath.IsNotEmpty())
            {
                var path = FubuMvcPackageFacility.PhysicalRootPath.ToFullPath().AppendPath("bin");
                if (Directory.Exists(path) && !list.Select(x => x.ToLower()).Contains(path.ToLower()))
                {
                    list.Add(path);
                }
            }

            list.Each(x =>
            {
                log.Trace("Looking for assemblies marked with the [FubuModule] attribute in " + x);
            });

            return(LoadPackages(list));
        }
        public void ReadScriptConfig(string folder, IPackageLog log)
        {
            log.Trace("Trying to read *script.config / *asset.config files from {0}", folder);
            var files = _fileSystem.FindFiles(folder, new FileSet(){
                Include = "*.script.config;*.asset.config",
                DeepSearch = false
            });

            if (!files.Any())
            {
                log.Trace("  No *.script.config or *.asset.config files found");
                return;
            }

            files.Each(file => ReadFile(file, log));
        }
Example #25
0
        // I would rather have this as a ISharingPolicy, but don't know how to ensure it is applied last.
        public void RegisterAppGlobal(IPackageLog log)
        {
            log.Trace("Registering application as global sharing.");

            Diagnostics.SetCurrentProvenance(TemplateConstants.HostOrigin);
            Diagnostics.Global(TemplateConstants.HostOrigin);
        }
Example #26
0
        public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log)
        {
            log.Trace("Running {0}".ToFormat(GetType().Name));

            configureSparkSettings(log);
            setEngineDependencies(log);
        }
        public void Activate(IEnumerable <IPackageInfo> packages, IPackageLog log)
        {
            var postActionsFinder = new BehaviorVisitor(_graph.Observer, "Looking for valid POST actions.");

            postActionsFinder.Filters.Add(x => x.Route != null);
            postActionsFinder.Filters.Add(x => x.Route.AllowedHttpMethods.Contains("POST"));
            postActionsFinder.Filters.Add(x => x.FirstCall() != null);
            postActionsFinder.Filters.Add(x => x.FirstCall().HasOutput);
            postActionsFinder.Filters.Add(x => x.FirstCall().HasInput);
            postActionsFinder.Actions += x =>
            {
                var postAction     = x.FirstCall();
                var handlerActions = _graph.ActionsForHandler(postAction.HandlerType);
                var getAction      = handlerActions
                                     .Where(h => h.ParentChain().Route != null)
                                     .Where(h => h.ParentChain().Route.AllowedHttpMethods.Contains("GET"))
                                     .Where(h => h.HasInput).Where(h => h.HasOutput)
                                     .FirstOrDefault(h => x.InputType().IsAssignableFrom(h.OutputType()));

                if (getAction == null)
                {
                    return;
                }
                log.Trace("Linking validation descriptor for {0} against {1}.", postAction, getAction);
                _provider.Register(postAction, getAction.InputType());
            };
            _graph.VisitBehaviors(postActionsFinder);
        }
Example #28
0
        public void CompileDependencies(IEnumerable <IPackageInfo> packages, IPackageLog log)
        {
            var provenances = packages.Select(p => p.Name).Union(new[] { TemplateConstants.HostOrigin }).ToArray();

            log.Trace("Compiling dependencies for [{0}]", provenances.Join(", "));

            _graph.CompileDependencies(provenances);
        }
 public IEnumerable <IPackageInfo> Load(IPackageLog log)
 {
     return(_contentFolders.Select(x =>
     {
         log.Trace("Loading content package from " + x);
         return new ContentOnlyPackageInfo(x, Path.GetFileName(x));
     }));
 }
 public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log)
 {
     _policies.Each(p =>
     {
         log.Trace("Running " + p);
         p.Apply(log, _fileGraph, _graph);
     });
 }
        // TODO -- harden with a better exception
        public Type FindEnvironmentType(IPackageLog log)
        {
            if (EnvironmentClassName.IsNotEmpty())
            {
                log.Trace("Environment class was specified '{0}'", EnvironmentClassName);
                return Type.GetType(EnvironmentClassName);
            }

            log.Trace("Scanning AppDomain for IEnvironment");
            var foundClass = AppDomain.CurrentDomain
                                .Load(AssemblyName)
                                .GetExportedTypes()
                                .First(x => x.IsConcreteTypeOf<IEnvironment>());

            log.Trace("Found Environment class '{0}'", foundClass);
            return foundClass;
        }
        public IEnumerable<IPackageInfo> Load(IPackageLog log)
        {
            Func<Assembly, bool> filter = assem => assem.GetCustomAttributes(typeof(BottleServiceAttribute), false).Any();
            Action<string> onDirectoryFound = dir => log.Trace("Looking for assemblies marked with the [BottleService] attribute in " + dir);
            var assemblies = AssemblyFinder.FindAssemblies(filter, onDirectoryFound);

            return assemblies.Select(x => new AssemblyPackageInfo(x));
        }
        public void ReadScriptConfig(string folder, IPackageLog log)
        {
            log.Trace("Trying to read *script.config / *asset.config files from {0}", folder);
            var files = _fileSystem.FindFiles(folder, new FileSet
            {
                Include    = "*.script.config;*.asset.config",
                DeepSearch = true
            });

            if (!files.Any())
            {
                log.Trace("  No *.script.config or *.asset.config files found");
                return;
            }

            files.Where(x => !x.PathRelativeTo(folder).Contains(FubuMvcPackageFacility.FubuContentFolder)).Each(file => ReadFile(file, log));
        }
 public IEnumerable<IPackageInfo> Load(IPackageLog log)
 {
     return _contentFolders.Select(x =>
     {
         log.Trace("Loading content package from " + x);
         return new ContentOnlyPackageInfo(x, Path.GetFileName(x));
     });
 }
        public IEnumerable <IPackageInfo> Load(IPackageLog log)
        {
            Func <Assembly, bool> filter           = assem => assem.GetCustomAttributes(typeof(BottleServiceAttribute), false).Any();
            Action <string>       onDirectoryFound = dir => log.Trace("Looking for assemblies marked with the [BottleService] attribute in " + dir);
            var assemblies = AssemblyFinder.FindAssemblies(filter, onDirectoryFound);

            return(assemblies.Select(x => new AssemblyPackageInfo(x)));
        }
Example #36
0
        public void CompileDependencies(IEnumerable<IPackageInfo> packages, IPackageLog log)
        {
            var provenances = packages.Select(p => p.Name).Union(new[] { TemplateConstants.HostOrigin }).ToArray();

            log.Trace("Compiling dependencies for [{0}]", provenances.Join(", "));

            _graph.CompileDependencies(provenances);
        }
 public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log)
 {
     _registries.Each(r =>
     {
         log.Trace("Adding " + r);
         r.Configure(_stringifier);
     });
 }
Example #38
0
        public IEnumerable<IInstaller> StartUp(IPackageLog log)
        {
            log.Trace("I started up with all good installers");

            yield return new GoodInstaller1();
            yield return new GoodInstaller2();
            yield return new GoodInstaller3();
        }
Example #39
0
 public void Activate(IEnumerable <IPackageInfo> packages, IPackageLog log)
 {
     _policies.Each(p =>
     {
         log.Trace("Running " + p);
         p.Apply(log, _pipeline, _graph);
     });
 }
Example #40
0
        public void ReadSparkConfig(string provenance, string folder, IPackageLog log)
        {
            log.Trace("Looking for *spark.config in {0}", folder);
            var configs = _fileSystem.FindFiles(folder, new FileSet
            {
                Include = "*spark.config;spark.config",
                DeepSearch = false
            });

            if (!configs.Any())
            {
                log.Trace("  No *spark.config files found");
                return;
            }

            configs.Each(file => ReadFile(provenance, file, log));
        }
        // TODO -- harden with a better exception
        public Type FindEnvironmentType(IPackageLog log)
        {
            if (EnvironmentClassName.IsNotEmpty())
            {
                log.Trace("Environment class was specified '{0}'", EnvironmentClassName);
                return(Type.GetType(EnvironmentClassName));
            }

            log.Trace("Scanning AppDomain for IEnvironment");
            var foundClass = AppDomain.CurrentDomain
                             .Load(AssemblyName)
                             .GetExportedTypes()
                             .First(x => x.IsConcreteTypeOf <IEnvironment>());

            log.Trace("Found Environment class '{0}'", foundClass);
            return(foundClass);
        }
Example #42
0
        public void Execute(FubuWebsite directive, HostManifest host, IPackageLog log)
        {
            if (_settings.UserForced)
            {
                log.Trace("UserForced: deleting directories");
                _fileSystem.DeleteDirectory(directive.WebsitePhysicalPath);
                _fileSystem.DeleteDirectory(directive.VDirPhysicalPath);
            }

            _fileSystem.CreateDirectory(directive.WebsitePhysicalPath);
            _fileSystem.CreateDirectory(directive.VDirPhysicalPath);

            var appOfflineFile = FileSystem.Combine(directive.VDirPhysicalPath, "app_offline.htm");

            log.Trace("Applying the application offline file");
            _fileSystem.WriteStringToFile(appOfflineFile, "&lt;html&gt;&lt;body&gt;Application is being rebuilt&lt;/body&gt;&lt;/html&gt;");
        }
 public void Activate(IEnumerable <IPackageInfo> packages, IPackageLog log)
 {
     _registries.Each(r =>
     {
         log.Trace("Adding " + r);
         r.Configure(_stringifier);
     });
 }
Example #44
0
        public void ReadScriptConfig(string folder, IPackageLog log)
        {
            log.Trace("Trying to read *script.config / *asset.config files from {0}", folder);
            var files = _fileSystem.FindFiles(folder, new FileSet
            {
                Include    = "*.script.config;*.asset.config",
                DeepSearch = true
            });

            if (!files.Any())
            {
                log.Trace("  No *.script.config or *.asset.config files found");
                return;
            }

            files.Each(file => ReadFile(file, log));
        }
Example #45
0
 private void applyFubuExtensionsFromPackages(IPackageLog log)
 {
     FubuExtensionFinder.FindAllExtensions().Each(x1 =>
     {
         log.Trace("Applying extension {0}", x1.GetType().FullName);
         x1.Configure(_registry.Value);
     });
 }
        public void ReadSparkConfig(string provenance, string folder, IPackageLog log)
        {
            log.Trace("Looking for *spark.config in {0}", folder);
            var configs = _fileSystem.FindFiles(folder, new FileSet
            {
                Include    = "*spark.config;spark.config",
                DeepSearch = false
            });

            if (!configs.Any())
            {
                log.Trace("  No *spark.config files found");
                return;
            }

            configs.Each(file => ReadFile(provenance, file, log));
        }
Example #47
0
 public void Deactivate(IPackageLog log)
 {
     if (_settings.EmbeddedServer != null)
     {
         Console.WriteLine("Shutting down the embedded Katana server");
         log.Trace("Shutting down the embedded Katana server");
         _settings.EmbeddedServer.Dispose();
     }
 }
        public void Activate(IEnumerable <IPackageInfo> packages, IPackageLog log)
        {
            _policies.Each(p =>
            {
                log.Trace("Running " + p);
                p.Apply(log, _fileGraph, _graph);
            });

            _graph.PolicyTypes.Each(type =>
            {
                if (type.CanBeCastTo <IAssetPolicy>() && type.IsConcreteWithDefaultCtor())
                {
                    var policy = Activator.CreateInstance(type).As <IAssetPolicy>();
                    log.Trace("Running " + policy);
                    policy.Apply(log, _fileGraph, _graph);
                }
            });
        }
Example #49
0
 public void Deactivate(IPackageLog log)
 {
     if (_settings.EmbeddedServer != null)
     {
         Console.WriteLine("Shutting down the embedded Katana server");
         log.Trace("Shutting down the embedded Katana server");
         _settings.EmbeddedServer.Dispose();
     }
 }
        public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log)
        {
            _policies.Each(p =>
            {
                log.Trace("Running " + p);
                p.Apply(log, _fileGraph, _graph);
            });

            _graph.PolicyTypes.Each(type =>
            {
                if (type.CanBeCastTo<IAssetPolicy>() && type.IsConcreteWithDefaultCtor())
                {
                    var policy = Activator.CreateInstance(type).As<IAssetPolicy>();
                    log.Trace("Running " + policy);
                    policy.Apply(log, _fileGraph, _graph);
                }
            });
        }
        public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log)
        {
            packages.Each(p => p.ForFolder(FubuMvcPackages.WebContentFolder, topFolder =>
            {
                var contentFolder = FileSystem.Combine(topFolder, "content");

                log.Trace("Added folder '{0}' to the package folder list", contentFolder);
                _contents.RegisterDirectory(contentFolder);
            }));
        }
        public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log)
        {
            packages.Each(p => p.ForFolder(FubuMvcPackages.WebContentFolder, topFolder =>
            {
                var imagesFolder = Path.Combine(topFolder, "content\\images");

                log.Trace("Added folder '{0}' to the PackagedImageUrl list", imagesFolder);
                _resolver.RegisterDirectory(imagesFolder);
            }));
        }
        // We need to get these settings from DSL and defaults
		private void configureSparkSettings (IPackageLog log)
		{
			var settings = (SparkSettings)_engine.Settings;

            settings.SetAutomaticEncoding(true);

			settings.AddAssembly (typeof(HtmlTag).Assembly)
                .AddAssembly (typeof(FubuPageExtensions).Assembly)
                .AddNamespace (typeof(VirtualPathUtility).Namespace) // System.Web
                .AddNamespace (typeof(FubuRegistryExtensions).Namespace) // FubuMVC.Spark
                .AddNamespace (typeof(FubuPageExtensions).Namespace) // FubuMVC.Core.UI
                .AddNamespace (typeof(HtmlTag).Namespace); // HtmlTags   

            log.Trace("Adding assemblies to SparkSettings:");
		    settings.UseAssemblies.Each(x => log.Trace("  - {0}".ToFormat(x)));

            log.Trace("Adding namespaces to SparkSettings:");
            settings.UseNamespaces.Each(x => log.Trace("  - {0}".ToFormat(x)));
		}
Example #54
0
        private void configureSparkSettings(IPackageLog log)
        {
            var settings = (SparkSettings)_engine.Settings;

            settings.SetAutomaticEncoding(true);

            settings.AddAssembly(typeof(HtmlTag).Assembly)
            .AddAssembly(typeof(FubuPageExtensions).Assembly)
            .AddNamespace(typeof(VirtualPathUtility).Namespace) // System.Web
            .AddNamespace(typeof(SparkViewFacility).Namespace)  // FubuMVC.Spark
            .AddNamespace(typeof(FubuPageExtensions).Namespace) // FubuMVC.Core.UI
            .AddNamespace(typeof(HtmlTag).Namespace);           // HtmlTags

            log.Trace("Adding assemblies to SparkSettings:");
            settings.UseAssemblies.Each(x => log.Trace("  - {0}".ToFormat(x)));

            log.Trace("Adding namespaces to SparkSettings:");
            settings.UseNamespaces.Each(x => log.Trace("  - {0}".ToFormat(x)));
        }
Example #55
0
        public IEnumerable <IInstaller> StartUp(IPackageLog log)
        {
            log.Trace("I started up with all good installers");

            yield return(new GoodInstaller1());

            yield return(new GoodInstaller2());

            yield return(new GoodInstaller3());
        }
Example #56
0
        public void Activate(IEnumerable <IPackageInfo> packages, IPackageLog log)
        {
            packages.Each(p => p.ForFolder(BottleFiles.WebContentFolder, topFolder =>
            {
                var contentFolder = FileSystem.Combine(topFolder, "content");

                log.Trace("Added folder '{0}' to the package folder list", contentFolder);
                _contents.RegisterDirectory(contentFolder);
            }));
        }
        public void Deactivate(IPackageLog log)
        {
            if (_settings.Disabled)
            {
                return;
            }

            log.Trace("Shutting down the scheduled jobs");
            _scheduledJobs.Deactivate();
        }
Example #58
0
 public void Check(IPackageLog log)
 {
     if (Directory.Exists(_folder))
     {
         log.Trace(SuccessMessage, _folder);
     }
     else
     {
         log.MarkFailure(FailureMessage, _folder);
     }
 }
        public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log)
        {
            log.Trace("Looking for *view.config files");
            var configs = _files.FindFiles(new FileSet
            {
                Include = "*view.config;view.config",
                DeepSearch = false
            });

            ReadConfigs(configs, log);
        }
Example #60
0
 public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log)
 {
     packages.Each(pak =>
     {
         pak.ForFolder(BottleFiles.WebContentFolder, dir =>
         {
             log.Trace("Adding directory {0} to PackageFileCache", dir);
             _files.AddDirectory(dir);
         });
     });
 }