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 static ContentFolder ForApplication() { return(new ContentFolder( Application, FubuMvcPackageFacility.GetApplicationPath() )); }
public CombiningCssLinkTagWriter(IContentFolderService folderService, IContentFileCombiner fileCombiner, CssLinkTagWriter singleFileWriter) { _folderService = folderService; _fileCombiner = fileCombiner; _singleFileWriter = singleFileWriter; _folderService.RegisterDirectory(FileSystem.Combine(FubuMvcPackageFacility.GetApplicationPath(), "content")); }
private static IEnumerable <PackageAssetDirectory> findDirectories(IEnumerable <IPackageInfo> packages) { yield return(new PackageAssetDirectory() { Directory = FubuMvcPackageFacility.GetApplicationPath(), PackageName = AssetPipeline.Application }); foreach (var pak in packages) { string directory = null; pak.ForFolder(BottleFiles.WebContentFolder, dir => { directory = dir; }); if (directory.IsNotEmpty()) { yield return(new PackageAssetDirectory() { Directory = directory, PackageName = pak.Name }); } } }
public void should_register_an_xml_directory_storage_that_points_to_the_application_directory_and_the_package_directories() { var theStorage = theFacility.LocalizationStorageObjectDefThatWasRegistered.Value.ShouldBeOfType <XmlDirectoryLocalizationStorage>(); theStorage.Directories.ShouldHaveTheSameElementsAs(FubuMvcPackageFacility.GetApplicationPath(), "dir1", "dir2", "dir3"); }
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 FubuRuntime Bootstrap() { SetupNamingStrategyForHttpHeaders(); _fubuFacility = new FubuMvcPackageFacility(); IServiceFactory factory = null; BehaviorGraph graph = null; // TODO -- I think Bottles probably needs to enforce a "tell me the paths" // step maybe PackageRegistry.GetApplicationDirectory = FubuMvcPackageFacility.GetApplicationPath; BottleFiles.ContentFolder = FubuMvcPackageFacility.FubuContentFolder; BottleFiles.PackagesFolder = FileSystem.Combine("bin", FubuMvcPackageFacility.FubuPackagesFolder); IList <RouteBase> routes = null; PackageRegistry.LoadPackages(x => { x.Facility(_fubuFacility); _packagingDirectives.Each(d => d(x)); x.Bootstrap(log => { // container facility has to be spun up here var containerFacility = _facility.Value; // Need to do this to make the provenance for bottles come out right _registry.Value.Config.Seal(); applyFubuExtensionsFromPackages(); graph = buildBehaviorGraph(); bakeBehaviorGraphIntoContainer(graph, containerFacility); // factory HAS to be spun up here. factory = containerFacility.BuildFactory(); routes = buildRoutes(factory, graph); routes.Each(r => RouteTable.Routes.Add(r)); containerFacility.Register(typeof(FubuRouteTable), ObjectDef.ForValue(new FubuRouteTable { Routes = routes })); return(factory.GetAll <IActivator>()); }); }); FubuMvcPackageFacility.Restarted = DateTime.Now; PackageRegistry.AssertNoFailures( () => { throw new FubuException(0, FubuApplicationDescriber.WriteDescription()); }); var runtime = new FubuRuntime(factory, _facility.Value, routes); _facility.Value.Register(typeof(FubuRuntime), ObjectDef.ForValue(runtime)); return(runtime); }
public void provenance_path_is_set_on_files() { theFolder.FindFiles(new FileSet { DeepSearch = true, Include = "*.txt" }).Each(f => f.ProvenancePath.ShouldEqual(FubuMvcPackageFacility.GetApplicationPath())); }
public void can_find_files_case_insensitive() { var files = theFolder.FindFiles(new FileSet { DeepSearch = true, Include = "A.txt" }).Select(x => x.Path.PathRelativeTo(FubuMvcPackageFacility.GetApplicationPath())); files.ShouldContain(@"Runtime\Files\Data\a.txt"); }
public IList <RouteBase> Bootstrap() { if (HttpContext.Current != null) { UrlContext.Live(); } _fubuFacility = new FubuMvcPackageFacility(); IBehaviorFactory factory = null; BehaviorGraph graph = null; // TODO -- I think Bottles probably needs to enforce a "tell me the paths" // step maybe PackageRegistry.GetApplicationDirectory = FubuMvcPackageFacility.GetApplicationPath; BottleFiles.ContentFolder = FubuMvcPackageFacility.FubuContentFolder; BottleFiles.PackagesFolder = FubuMvcPackageFacility.FubuPackagesFolder; PackageRegistry.LoadPackages(x => { x.Facility(_fubuFacility); _packagingDirectives.Each(d => d(x)); x.Bootstrap(log => { // container facility has to be spun up here var containerFacility = _facility.Value; registerServicesFromFubuFacility(); applyRegistryModifications(); applyFubuExtensionsFromPackages(); graph = buildBehaviorGraph(); bakeBehaviorGraphIntoContainer(graph, containerFacility); // factory HAS to be spun up here. factory = containerFacility.BuildFactory(_registry.Value.DiagnosticLevel); if (_registry.Value.DiagnosticLevel == DiagnosticLevel.FullRequestTracing) { factory = new DiagnosticBehaviorFactory(factory, containerFacility); } return(containerFacility.GetAllActivators()); }); }); PackageRegistry.AssertNoFailures(); return(buildRoutes(factory, graph)); }
private static string[] determineLinkedFolders() { var loader = new LinkedFolderPackageLoader(FubuMvcPackageFacility.GetApplicationPath(), x => x); var packages = loader.Load(new PackageLog()); var links = new List <string>(); packages.Each(x => x.ForFolder(BottleFiles.WebContentFolder, links.Add)); return(links.ToArray()); }
public void Go() { var loader = new ProjectDirectoryLoader(new FileSystem()); IProject project = loader.Load(FubuMvcPackageFacility.GetApplicationPath()); project.TimeoutInSeconds = 240; using (var runner = new ProjectTestRunner(project)) { runner.RunAndAssertTest("HealthMonitoring/An inactive task should get reassigned"); } }
public void can_find_files() { var files = theFolder.FindFiles(new FileSet { DeepSearch = true, Include = "*.txt" }).Select(x => x.Path.PathRelativeTo(FubuMvcPackageFacility.GetApplicationPath())); files.ShouldContain(@"Runtime{0}Files{0}Data{0}a.txt".ToFormat(Path.DirectorySeparatorChar)); files.ShouldContain(@"Runtime{0}Files{0}Data{0}b.txt".ToFormat(Path.DirectorySeparatorChar)); files.ShouldContain(@"Runtime{0}Files{0}Data{0}c.txt".ToFormat(Path.DirectorySeparatorChar)); files.ShouldContain(@"Runtime{0}Files{0}Data{0}d.txt".ToFormat(Path.DirectorySeparatorChar)); }
public FubuRuntime Bootstrap() { SetupNamingStrategyForHttpHeaders(); _fubuFacility = new FubuMvcPackageFacility(); IBehaviorFactory factory = null; BehaviorGraph graph = null; // TODO -- I think Bottles probably needs to enforce a "tell me the paths" // step maybe PackageRegistry.GetApplicationDirectory = FubuMvcPackageFacility.GetApplicationPath; BottleFiles.ContentFolder = FubuMvcPackageFacility.FubuContentFolder; BottleFiles.PackagesFolder = FileSystem.Combine("bin", FubuMvcPackageFacility.FubuPackagesFolder); Console.WriteLine("PackageRegistry.ApplicationDirectory: " + PackageRegistry.GetApplicationDirectory()); Console.WriteLine("BottleFiles.ContentFolder: " + BottleFiles.ContentFolder); Console.WriteLine("BottleFiles.PackagesFolder: " + BottleFiles.PackagesFolder); PackageRegistry.LoadPackages(x => { x.Facility(_fubuFacility); _packagingDirectives.Each(d => d(x)); x.Bootstrap(log => { // container facility has to be spun up here var containerFacility = _facility.Value; applyRegistryModifications(); applyFubuExtensionsFromPackages(log); graph = buildBehaviorGraph(); bakeBehaviorGraphIntoContainer(graph, containerFacility); // factory HAS to be spun up here. factory = containerFacility.BuildFactory(); return(containerFacility.GetAllActivators()); }); }); PackageRegistry.AssertNoFailures(); var routes = buildRoutes(factory, graph); routes.Each(r => RouteTable.Routes.Add(r)); return(new FubuRuntime(factory, _facility.Value, routes)); }
public void Configure(FubuRegistry registry) { registry.Policies.Add <TransactionalBehaviorPolicy>(); var defaultDataDirectory = FubuMvcPackageFacility.GetApplicationPath().ParentDirectory().AppendPath("data"); var defaultSettings = new RavenDbSettings { DataDirectory = defaultDataDirectory }; registry.Services(x => x.SetServiceIfNone(defaultSettings)); }
public void determine_the_public_folder_with_a_non_null_but_nonexistent_version() { new FileSystem().CreateDirectory( FubuMvcPackageFacility.GetApplicationPath().AppendPath("public").ToFullPath()); var settings = new AssetSettings { Version = Guid.NewGuid().ToString() }; settings.DeterminePublicFolder() .ShouldEqual(FubuMvcPackageFacility.GetApplicationPath().AppendPath("public").ToFullPath()); }
public void determine_the_public_folder_with_no_version() { new FileSystem().CreateDirectory( FubuMvcPackageFacility.GetApplicationPath().AppendPath("public").ToFullPath()); var settings = new AssetSettings { Version = null }; settings.DeterminePublicFolder() .ShouldEqual(FubuMvcPackageFacility.GetApplicationPath().AppendPath("public")); }
public void set_the_public_folder_if_in_that_mode() { var settings = new AssetSettings { Mode = SearchMode.PublicFolderOnly, PublicFolder = "public" }; var manifest = settings.CreateFileWatcherManifest(); manifest.PublicAssetFolder.ShouldEqual( FubuMvcPackageFacility.GetApplicationPath().AppendPath("public").Replace('\\', '/')); }
public void determine_the_public_folder_when_the_version_does_exist() { new FileSystem().CreateDirectory( FubuMvcPackageFacility.GetApplicationPath().AppendPath("public").ToFullPath()); new FileSystem().CreateDirectory( FubuMvcPackageFacility.GetApplicationPath().AppendPath("public", "1.0.1").ToFullPath()); var settings = new AssetSettings { Version = "1.0.1" }; settings.DeterminePublicFolder() .ShouldEqual(FubuMvcPackageFacility.GetApplicationPath().AppendPath("public", "1.0.1").ToFullPath()); }
public TemplateGraph(BehaviorGraph behaviors, AssetSettings settings, IServiceFactory services) { _settings = settings; _services = services; _templates = new Lazy <LightweightCache <string, TemplateDef> >(() => { return(buildTemplateCache(behaviors)); }); _templateDirectory = FubuMvcPackageFacility .GetApplicationPath() .AppendPath(_settings.TemplateDestination) .ToFullPath() .Replace('\\', '/'); }
public static string PublicAssetFolder(this IFubuPage page) { var settings = page.Get <AssetSettings>(); if (settings.PublicAssetFolder.IsEmpty()) { var directory = settings.DeterminePublicFolder(); var relativePath = directory.PathRelativeTo(FubuMvcPackageFacility.GetApplicationPath()) .Replace('\\', '/'); settings.PublicAssetFolder = page.Get <IHttpRequest>().ToFullUrl(relativePath); } return(settings.PublicAssetFolder); }
private static void writeProperties(StringWriter writer) { var report = new TextReport(); report.StartColumns(2); if (FubuMvcPackageFacility.Restarted.HasValue) { report.AddColumnData("Restarted", FubuMvcPackageFacility.Restarted.ToString()); } report.AddColumnData("Application Path", FubuMvcPackageFacility.GetApplicationPath()); report.Write(writer); writer.WriteLine(); }
public void Activate(IEnumerable <IPackageInfo> packages, IPackageLog log) { var list = new List <string>(); log.Trace("Setting up the {0} with directories", typeof(XmlDirectoryLocalizationStorage).Name); list.Add(FubuMvcPackageFacility.GetApplicationPath()); packages.Each(pak => pak.ForFolder(BottleFiles.WebContentFolder, list.Add)); var storage = new XmlDirectoryLocalizationStorage(list); _facility.Register(typeof(ILocalizationStorage), ObjectDef.ForValue(storage)); _facility.Get <SpinUpLocalizationCaches>().Activate(packages, log); }
public string GenerateCombinedFile(IEnumerable <string> filenames, string separatorFormat = null) { if (!filenames.Any()) { return(null); } var extension = Path.GetExtension(filenames.First()); var combinedName = getCombinedName(filenames, extension); var outputFile = FileSystem.Combine(FubuMvcPackageFacility.GetApplicationPath(), "content", CombinedFileFolder, combinedName); if (!_fileSystem.FileExists(outputFile)) { writeFile(outputFile, filenames, separatorFormat); } return(CombinedFileFolder + "/" + combinedName); }
public void loads_package_assemblies_from_packages_folder() { FubuMvcPackageFacility.PhysicalRootPath = "Test"; MockFor <IStandaloneAssemblyFinder>() .Expect(finder => finder.FindAssemblies(FubuMvcPackageFacility.GetApplicationPath())) .Return(new[] { "TestPackage1" }); var assembly = Assembly.Load("TestPackage1"); ClassUnderTest .Load(new PackageLog()) .Single() .Name .ShouldEqual("Assembly: " + assembly.GetName().FullName); }
/// <summary> /// Used internally to determine the public folder if the mode is set to /// PublicFolderOnly /// </summary> /// <returns></returns> public string DeterminePublicFolder() { var candidate = FubuMvcPackageFacility.GetApplicationPath().AppendPath(PublicFolder); if (Version.IsNotEmpty()) { var versioned = candidate.AppendPath(Version); if (Directory.Exists(versioned)) { candidate = versioned; } } if (!Directory.Exists(candidate)) { Console.WriteLine("The designated public asset folder '{0}' cannot be found".ToFormat(candidate)); } return(candidate); }
private IEnumerable <IFubuFile> findFiles(string filename) { if (_settings.Mode == SearchMode.PublicFolderOnly) { var publicFolder = _settings.DeterminePublicFolder(); var appFolder = FubuMvcPackageFacility.GetApplicationPath(); return(new FileSystem().FindFiles(publicFolder, FileSet.Deep(filename)) .Select(x => { return new FubuFile(x, ContentFolder.Application) { RelativePath = x.PathRelativeTo(appFolder).Replace('\\', '/') }; })); } return(_files.FindFiles(FileSet.Deep(filename, _settings.Exclusions))); }
public Dictionary <string, object> get_appdomain() { var dict = new Dictionary <string, object> { { "reloaded", _reloaded.Timestamp.ToLocalTime().ToString() }, { "fubuPath", FubuMvcPackageFacility.GetApplicationPath() }, { "baseDirectory", AppDomain.CurrentDomain.BaseDirectory }, { "binPath", FubuMvcPackageFacility.FindBinPath() }, { "config", AppDomain.CurrentDomain.SetupInformation.ConfigurationFile } }; var assemblyLocations = AppDomain.CurrentDomain.GetAssemblies() .Select(x => new AssemblyLocation(x)) .OrderBy(x => x.name) .ToArray(); dict.Add("assemblies", assemblyLocations); return(dict); }
public override bool Execute(ExplodeInput input) { var system = new FileSystem(); if (input.CleanFlag) { var contentFolder = input.Directory.AppendPath(FubuMvcPackageFacility.FubuContentFolder); Console.WriteLine("Cleaning contents of folder " + contentFolder); system.CleanDirectory(contentFolder); } FubuMvcPackageFacility.PhysicalRootPath = input.Directory.ToFullPath(); PackageRegistry.GetApplicationDirectory = FubuMvcPackageFacility.GetApplicationPath; Console.WriteLine("Exploding bottle content at " + FubuMvcPackageFacility.GetApplicationPath().ToFullPath()); PackageRegistry.LoadPackages(_ => _.Loader(new FubuModuleExploder(input.Directory))); return(true); }
public IList <RouteBase> Bootstrap() { if (HttpContext.Current != null) { UrlContext.Live(); } _fubuFacility = new FubuMvcPackageFacility(); // TODO -- would be nice if this little monster also logged PackageRegistry.LoadPackages(x => { x.Facility(_fubuFacility); _packagingDirectives.Each(d => d(x)); x.Bootstrap(log => startApplication()); }); PackageRegistry.AssertNoFailures(); return(buildRoutes()); }