public void Activate(IEnumerable <IPackageInfo> packages, IPackageLog log) { _graph.ReadSettings(_services); OpenChannels(); _graph.StartReceiving(_pipeline); ExecuteActivators(); }
private IEnvironment findEnvironment(List<LogEntry> list, IPackageLog log) { var environmentType = _run.FindEnvironmentType(log); if (environmentType == null) { throw new EnvironmentRunnerException("Unable to find an IEnvironment type"); } IEnvironment environment = null; try { environment = (IEnvironment) Activator.CreateInstance(environmentType); } catch (Exception e) { list.Add(new LogEntry { Description = environmentType.FullName, Success = false, TraceText = e.ToString() }); } return environment; }
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(); }
private Subscription[] determineStaticRequirements(IPackageLog log) { var requirements = _requirements.SelectMany(x => x.DetermineRequirements()).ToArray(); traceLoadedRequirements(log, requirements); return(requirements); }
public void Execute(ConfigurationDirectory directive, HostManifest host, IPackageLog log) { // copy the environment settings there // explode the bottles out to there // log each file to there var configDirectory = directive.ConfigDirectory.CombineToPath(_deploymentSettings.TargetDirectory); _fileSystem.Copy(_deploymentSettings.EnvironmentFile, configDirectory); var destinationDirectory = FileSystem.Combine(_deploymentSettings.TargetDirectory, directive.ConfigDirectory); // TODO -- diagnostics? host.BottleReferences.Each(x => { var request = new BottleExplosionRequest(new PackageLog()) { BottleDirectory = BottleFiles.ConfigFolder, BottleName = x.Name, DestinationDirectory = destinationDirectory }; _repository.ExplodeFiles(request); }); }
public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log) { _graph.ReadSettings(_services); OpenChannels(); _graph.StartReceiving(_pipeline); ExecuteActivators(); }
public IEnumerable <IActivator> Bootstrap(IPackageLog log) { _services.Clear(); _services.AddRange(BottleServiceFinder.Find(PackageRegistry.PackageAssemblies, log)); return(new IActivator[0]); }
public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log) { var provider = new FileSystemVirtualPathProvider(); HostingEnvironment.RegisterVirtualPathProvider(provider); packages.Each(x => x.ForFolder(FubuMvcPackages.WebContentFolder, provider.RegisterContentDirectory)); }
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 IEnumerable <IPackageInfo> Load(IPackageLog log) { IPackageInfo currentDirectory = null; var candidateFile = _directories.Solution.AppendPath("project.xml"); if (File.Exists(candidateFile)) { try { var project = new FileSystem().LoadFromFile <ProjectRoot>(candidateFile); currentDirectory = new ContentOnlyPackageInfo(_directories.Solution, Path.GetFileName(_directories.Solution)); } catch (Exception) { // that's right, do nothing here Console.WriteLine("File '{0}' could not be loaded as a project file, so ignoring the current directory", candidateFile); } } if (currentDirectory != null) { yield return(currentDirectory); } }
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(); }
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)); }
public void ReadPackage(IPackageInfo package, IPackageLog log) { _currentPackage = package; //double dispatch - hard to follow - at the moment package.LoadAssemblies(this); }
private IEnvironment findEnvironment(List <LogEntry> list, IPackageLog log) { var environmentType = _run.FindEnvironmentType(log); if (environmentType == null) { throw new EnvironmentRunnerException("Unable to find an IEnvironment type"); } IEnvironment environment = null; try { environment = (IEnvironment)Activator.CreateInstance(environmentType); } catch (Exception e) { list.Add(new LogEntry { Description = environmentType.FullName, Success = false, TraceText = e.ToString() }); } return(environment); }
public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log) { ReadScriptConfig(FubuMvcPackageFacility.GetApplicationPath(), log); packages.Each(p => p.ForFolder(BottleFiles.WebContentFolder, folder => ReadScriptConfig(folder, log))); _assets.CompileDependencies(log); }
public void Activate(IEnumerable <IPackageInfo> packages, IPackageLog log) { if (!_strategies.Any()) { log.MarkFailure("There are no IAuthenticationStrategy services registered. Either register an IAuthenticationStrategy or remove FubuMVC.Authentication from your application"); } }
public IEnumerable <IInstaller> StartUp(IPackageLog log) { var application = createApplication(); application.Bootstrap(); return(application.GetAllInstallers()); }
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) { ReadScriptConfig(FubuMvcPackageFacility.GetApplicationPath(), log); packages.Each(p => p.ForFolder(BottleFiles.WebContentFolder, folder => ReadScriptConfig(folder, log))); _scripts.CompileDependencies(log); }
public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log) { Console.WriteLine("hi, poopy pants"); packages.Select(p => p.Name) .Each(s => Console.WriteLine(s)); }
public IEnumerable <IActivator> Bootstrap(IPackageLog log) { _services = _inner.Bootstrap(log).Select(x => new BottleService(x, log)); _services.Each(x => x.Start()); return(new IActivator[0]); }
/// <summary> /// Fuegt ein neues Log hinzu. /// </summary> /// <param name="log">Das hinzuzufuegende Log.</param> public void addPackageLog(IPackageLog log) { if (log == null) throw new ArgumentNullException("log"); if (clientLogs.ContainsKey(log.Client)) clientLogs.Remove(log.Client); clientLogs.Add(log.Client, log); }
// 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); }
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))); }
public IEnumerable <IPackageInfo> Load(IPackageLog log) { var list = new List <string> { _directory }; var binPath = _directory.AppendPath("bin"); if (Directory.Exists(binPath)) { list.Add(binPath); var releasePath = binPath.AppendPath("release"); if (Directory.Exists(releasePath)) { list.Add(releasePath); } else { var debugPath = binPath.AppendPath("debug"); if (Directory.Exists(debugPath)) { list.Add(debugPath); } } } list.Each(x => { Console.WriteLine("Looking for assemblies marked with the [FubuModule] attribute in " + x); }); return(LoadPackages(list)); }
public IEnumerable<IActivator> Bootstrap(IPackageLog log) { _services = _inner.Bootstrap(log).Select(x => new BottleService(x, log)); _services.Each(x => x.Start()); return new IActivator[0]; }
public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log) { var cache = _localeCacheFactory.GetDefault(); cache.Append(ValidationKeys.REQUIRED, "Campo requerido"); cache.Append<EditProductModel>(p => p.Description, "Descripción"); //cache.Append<AddProductModel>(p => p.Description, "Descripción"); }
public void Activate(IEnumerable <IPackageInfo> packages, IPackageLog log) { log.Trace("Running {0}".ToFormat(GetType().Name)); configureSparkSettings(log); setEngineDependencies(log); }
public void Deactivate(IPackageLog log) { if(_settings.Disabled) return; log.Trace("Shutting down the scheduled jobs"); _scheduledJobs.Deactivate(); }
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); }
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<IActivator> Bootstrap(IPackageLog log) { _services.Clear(); _services.AddRange(BottleServiceFinder.Find(PackageRegistry.PackageAssemblies, log)); return new IActivator[0]; }
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); }
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 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(); }
public IEnumerable <IActivator> Bootstrap(IPackageLog log) { ObjectFactory.Initialize(x => x.AddRegistry <SampleRegistry>()); yield return(ObjectFactory.GetInstance <SampleService>()); yield return(ObjectFactory.GetInstance <RemoteService>()); }
public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log) { if (!_strategies.Any()) { log.MarkFailure("There are no IAuthenticationStrategy services registered. Either register an IAuthenticationStrategy or remove FubuMVC.Authentication from your application"); } }
public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log) { log.Trace("Running {0}".ToFormat(GetType().Name)); configureSparkSettings(log); setEngineDependencies(log); }
public void CompileDependencies(IPackageLog log) { _sets.Each(set => set.FindScripts(this)); _rules.Each(rule => { var dependency = ObjectFor(rule.Dependency); var dependent = ObjectFor(rule.Dependent); dependency.AllFileDependencies().Each(dependent.AddDependency); }); _extenders.Each(x => { var @base = FileDependencyFor(x.Base); var extender = FileDependencyFor(x.Extender); @base.AddExtension(extender); extender.AddDependency(@base); }); _preceedings.Each(x => { var before = FileDependencyFor(x.Before); var after = FileDependencyFor(x.After); after.MustBePreceededBy(before); }); }
public IEnumerable<IPackageInfo> Load(IPackageLog log) { var assemblies = _assemblyFinder.FindAssemblies(FubuMvcPackageFacility.GetApplicationPath()); return assemblies.Select(fileName => { return AssemblyPackageInfo.For(fileName); }); }
public void Precompile(IPackageLog log) { Parallel.ForEach(nonNativePartialDescriptors(), vd=> log.TrapErrors(() => { var def = vd.ToViewDefinition(); _providerCache.GetViewEntry(def.ViewDescriptor); _providerCache.GetViewEntry(def.PartialDescriptor); })); }
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); }); }
protected override void beforeEach() { _log = MockFor <IPackageLog>(); _fileSystem = MockFor <IFileSystem>(); _assetGraph = MockFor <AssetGraph>(); _fileSystem.Expect(x => x.FindFiles(Arg <string> .Is.Anything, Arg <FileSet> .Is.Anything)) .Return(new string[] { }); }
public void Precompile(IPackageLog log) { nonNativePartialDescriptors().Each(vd => log.TrapErrors(() => { var def = vd.ToViewDefinition(); _providerCache.GetViewEntry(def.ViewDescriptor); _providerCache.GetViewEntry(def.PartialDescriptor); })); }
public void Activate(IEnumerable <IPackageInfo> packages, IPackageLog log) { if (!_settings.PrecompileViews) { return; } _activation(log); }
private void applyFubuExtensionsFromPackages(IPackageLog log) { FubuExtensionFinder.FindAllExtensions().Each(x1 => { log.Trace("Applying extension {0}", x1.GetType().FullName); x1.Configure(_registry.Value); }); }
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) { _precompilers.Each(x => { Action<IAssetRegistration> action = registration => x.Precompile(_assetPipeline, registration); _assetGraph.OnPrecompile(action); }); }
public void Activate(IEnumerable <IPackageInfo> packages, IPackageLog log) { // Find the input models that have remote rules // "Bake" them into the remote graph _behaviorGraph .Actions() .Each(FillRules); }
public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log) { var library = _graph.Settings.Get<HtmlConventionLibrary>(); library.Import(new DefaultHtmlConventions().Library); _facility.Register(typeof(HtmlConventionLibrary), ObjectDef.ForValue(library)); }
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) { _configuration.CreateMap<Product, EditProductModel>(); _configuration.CreateMap<EditProductCommandModel, Product>(); _configuration.CreateMap<Product, AddProductModel>(); _configuration.CreateMap<AddProductModel, Product>(); }
public void Activate(IEnumerable <IPackageInfo> packages, IPackageLog log) { if (FubuMode.InDevelopment()) { return; } _activation(log); }
public void Activate(IEnumerable <IPackageInfo> packages, IPackageLog log) { _registries.Each(r => { log.Trace("Adding " + r); r.Configure(_stringifier); }); }
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<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(); }
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)); }