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 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 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"); }
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 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_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_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 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); }
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 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 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); }
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(); }
/// <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); }
protected void Application_Start() { // TODO -- add smart grid controllers FubuApplication.For <FubuTestApplicationRegistry>() .ContainerFacility(() => { var databaseFile = FileSystem.Combine(FubuMvcPackageFacility.GetApplicationPath(), @"..\..\test.db").ToFullPath(); var container = DatabaseDriver.BootstrapContainer(databaseFile, false); container.Configure( x => { x.Activate <ISchemaWriter>("Building the schema", writer => { writer.BuildSchema(); }); }); return(new TransactionalStructureMapContainerFacility(container)); }) // TODO -- convenience method here? .Packages(x => x.Assembly(typeof(IGridColumn).Assembly)) .Bootstrap(RouteTable.Routes); PackageRegistry.AssertNoFailures(); }
private IEnumerable <IFubuFile> findAssetFiles() { var search = _settings.CreateAssetSearch(); if (_settings.Mode == SearchMode.PublicFolderOnly) { var publicFolder = _settings.DeterminePublicFolder(); var appFolder = FubuMvcPackageFacility.GetApplicationPath(); return(new FileSystem().FindFiles(publicFolder, search) .Select(x => { return new FubuFile(x, ContentFolder.Application) { RelativePath = x.PathRelativeTo(appFolder).Replace('\\', '/') }; })); } return(_files.FindFiles(search)); }
static DatabaseDriver() { FILE_NAME = FileSystem.Combine(FubuMvcPackageFacility.GetApplicationPath(), "chinook.db"); }
public string get_file() { var filename = FubuMvcPackageFacility.GetApplicationPath().AppendPath("Something.spark"); return(new FileSystem().ReadStringFromFile(filename)); }
public void get_application_path_delegates_to_fubumvc_package_facility() { theFiles.GetApplicationPath().ShouldEqual(FubuMvcPackageFacility.GetApplicationPath()); }