示例#1
0
 public static ContentFolder ForApplication()
 {
     return(new ContentFolder(
                Application,
                FubuMvcPackageFacility.GetApplicationPath()
                ));
 }
示例#2
0
 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
                    });
                }
            }
        }
示例#4
0
        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");
        }
示例#5
0
        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);
        }
示例#6
0
 public void provenance_path_is_set_on_files()
 {
     theFolder.FindFiles(new FileSet
     {
         DeepSearch = true,
         Include    = "*.txt"
     }).Each(f => f.ProvenancePath.ShouldEqual(FubuMvcPackageFacility.GetApplicationPath()));
 }
示例#7
0
        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");
        }
示例#8
0
        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");
            }
        }
示例#10
0
        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));
        }
示例#12
0
        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"));
        }
示例#13
0
        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('\\', '/'));
        }
示例#14
0
        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());
        }
示例#15
0
        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);
        }
示例#16
0
        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('\\', '/');
        }
示例#17
0
        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());
        }
示例#18
0
        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);
        }
示例#19
0
        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);
        }
示例#20
0
        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);
        }
示例#21
0
        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();
        }
示例#22
0
        /// <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);
        }
示例#23
0
        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)));
        }
示例#24
0
        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);
        }
示例#25
0
        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);
        }
示例#26
0
        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();
        }
示例#27
0
        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));
        }
示例#28
0
 static DatabaseDriver()
 {
     FILE_NAME = FileSystem.Combine(FubuMvcPackageFacility.GetApplicationPath(), "chinook.db");
 }
示例#29
0
        public string get_file()
        {
            var filename = FubuMvcPackageFacility.GetApplicationPath().AppendPath("Something.spark");

            return(new FileSystem().ReadStringFromFile(filename));
        }
示例#30
0
 public void get_application_path_delegates_to_fubumvc_package_facility()
 {
     theFiles.GetApplicationPath().ShouldEqual(FubuMvcPackageFacility.GetApplicationPath());
 }