protected override Parsing createParsing(IFubuApplicationFiles files) { if (RelativePath().IsEmpty()) { return(new Parsing { Master = null, Namespaces = new String[0], ViewModelType = null }); } try { var chunk = Retry.Times(_settings.RetryViewLoadingCount, () => Loader.Load(this, files)).ToList(); return(new Parsing { Master = chunk.Master(), ViewModelType = chunk.ViewModel(), Namespaces = chunk.Namespaces() }); } catch (Exception e) { throw new Exception("Failed while trying to parse template file " + FilePath, e); } }
public IEnumerable<Chunk> Load(ISparkTemplate template, IFubuApplicationFiles files) { if (template.RelativePath().IsEmpty()) { throw new ArgumentOutOfRangeException("Invalid template path for file " + template.FilePath); } try { var viewLoader = _loaders[files.RootPath]; var chunks = viewLoader.Load(template.RelativePath()); if (chunks == null) { throw new Exception("Unable to parse file '{0}'".ToFormat(template.RelativePath())); } return chunks.ToList(); } catch (Exception e) { if (e.Message.StartsWith("Unable to parse file")) throw; throw new Exception("Unable to parse file '{0}'".ToFormat(template.RelativePath()), e); } }
public IEnumerable <Chunk> Load(ISparkTemplate template, IFubuApplicationFiles files) { if (template.RelativePath().IsEmpty()) { throw new ArgumentOutOfRangeException("Invalid template path for file " + template.FilePath); } try { var viewLoader = _loaders[files.RootPath]; var chunks = viewLoader.Load(template.RelativePath()); if (chunks == null) { throw new Exception("Unable to parse file '{0}'".ToFormat(template.RelativePath())); } return(chunks.ToList()); } catch (Exception e) { if (e.Message.StartsWith("Unable to parse file")) { throw; } throw new Exception("Unable to parse file '{0}'".ToFormat(template.RelativePath()), e); } }
public Template(IFubuFile file, IFubuApplicationFiles files) { _file = file; _parsing = new Lazy<Parsing>(() => createParsing(files)); _relativeDirectoryPath = _file.RelativePath.ParentDirectory().Replace('\\', '/'); }
public FubuDiagnosticsEndpoint(JavascriptRouteWriter routeWriter, DiagnosticJavascriptRoutes routes, IAssetFinder assets, IHttpRequest request, IFubuApplicationFiles files) { _routeWriter = routeWriter; _routes = routes; _assets = assets; _request = request; _files = files; }
// TODO -- if anyone starts to care, we'll make the location be variable public FlatFileMembershipRepository(IFubuApplicationFiles files) { _passwordConfigFile = files.GetApplicationPath().AppendPath("fubu.auth.config"); _users = new Lazy<IList<UserInfo>>(() => { return ReadFromFile(_passwordConfigFile); }); }
// TODO -- if anyone starts to care, we'll make the location be variable public FlatFileMembershipRepository(IFubuApplicationFiles files) { _passwordConfigFile = files.GetApplicationPath().AppendPath("fubu.auth.config"); _users = new Lazy <IList <UserInfo> >(() => { return(ReadFromFile(_passwordConfigFile)); }); }
public AssetFinderCache(AssetSettings settings, IFubuApplicationFiles files) { _settings = settings; _files = files; _searches.OnMissing = findAsset; _graph = new Lazy <AssetGraph>(findAll); }
public AssetFinderCache(AssetSettings settings, IFubuApplicationFiles files) { _settings = settings; _files = files; _searches.OnMissing = findAsset; _graph = new Lazy<AssetGraph>(findAll); }
public HomeEndpoint(IClientConnector connector, StorytellerContext context, FubuHtmlDocument document, IPersistenceController persistence, IAssetTagBuilder tags, IFubuApplicationFiles files) { _connector = connector; _context = context; _document = document; _persistence = persistence; _tags = tags; _files = files; }
public AntiForgeryValidator(IAntiForgeryTokenProvider tokenProvider, IAntiForgerySerializer serializer, ICookies cookies, IFubuApplicationFiles fubuApplicationFiles, IRequestData requestData) { _tokenProvider = tokenProvider; _serializer = serializer; _cookies = cookies; _fubuApplicationFiles = fubuApplicationFiles; _requestData = requestData; }
public SparkTemplate(IFubuApplicationFiles files, IFubuFile file, ISparkViewEngine engine, SparkEngineSettings settings) : base(file, files) { _settings = settings; _full = new Lazy <SparkViewDescriptor>(() => createSparkDescriptor(true)); _partial = new Lazy <SparkViewDescriptor>(() => createSparkDescriptor(false)); _viewEntry = new WatchedSparkEntry(() => engine.CreateEntry(_full.Value)); _partialViewEntry = new WatchedSparkEntry(() => engine.CreateEntry(_partial.Value)); }
public Template(IFubuFile file, IFubuApplicationFiles files) { _file = file; _parsing = new Lazy <Parsing>(() => createParsing(files)); _relativeDirectoryPath = _file.RelativePath.ParentDirectory().Replace('\\', '/'); }
public static BehaviorGraph Build(FubuRegistry registry, IPerfTimer perfTimer, IEnumerable<Assembly> packageAssemblies, IActivationDiagnostics diagnostics, IFubuApplicationFiles files) { var featureLoader = new FeatureLoader(); featureLoader.LookForFeatures(); if (registry.Mode.InDevelopment()) { registry.AlterSettings<DiagnosticsSettings>(_ => _.TraceLevel = TraceLevel.Verbose); registry.AlterSettings<AssetSettings>(_ => _.SetupForDevelopment()); } var graph = new BehaviorGraph { ApplicationAssembly = registry.ApplicationAssembly, PackageAssemblies = packageAssemblies }; var accessorRules = AccessorRulesCompiler.Compile(graph, perfTimer); var config = registry.Config; perfTimer.Record("Applying Settings", () => applySettings(config, graph, diagnostics, files)); perfTimer.Record("Enable built in polling jobs", () => enableBuiltInJobs(graph)); perfTimer.Record("Applying Feature Settings", () => featureLoader.ApplyAll(graph.Settings, registry).Wait()); perfTimer.Record("Local Application BehaviorGraph", () => config.BuildLocal(graph, perfTimer)); perfTimer.Record("Explicit Configuration", () => config.Global.Explicits.RunActions(graph)); perfTimer.Record("Global Policies", () => config.Global.Policies.RunActions(graph)); perfTimer.Record("Inserting Conneg and Authorization Nodes", () => insertConnegAndAuthorizationNodes(graph)); perfTimer.Record("Applying Global Reorderings", () => config.ApplyGlobalReorderings(graph)); if (registry.Mode.InDevelopment() || graph.Settings.Get<DiagnosticsSettings>().TraceLevel != TraceLevel.None) { perfTimer.Record("Applying Tracing", () => ApplyTracing.Configure(graph)); } accessorRules.Wait(); new AutoImportModelNamespacesConvention().Configure(graph); return graph; }
// TODO -- some commonality here between RazorTemplate and SparkTemplate! protected override Parsing createParsing(IFubuApplicationFiles files) { var chunks = ViewParser.Parse(FilePath).ToList(); return(new Parsing { Master = chunks.Master(), ViewModelType = chunks.ViewModel(), Namespaces = chunks.Namespaces() }); }
// TODO -- some commonality here between RazorTemplate and SparkTemplate! protected override Parsing createParsing(IFubuApplicationFiles files) { var chunks = ViewParser.Parse(FilePath).ToList(); return new Parsing { Master = chunks.Master(), ViewModelType = chunks.ViewModel(), Namespaces = chunks.Namespaces() }; }
public AntiForgeryService(IOutputWriter outputWriter, IAntiForgeryTokenProvider tokenProvider, IAntiForgerySerializer serializer, IFubuApplicationFiles fubuApplicationFiles, ICookies cookies) { _outputWriter = outputWriter; _tokenProvider = tokenProvider; _serializer = serializer; _fubuApplicationFiles = fubuApplicationFiles; _cookies = cookies; }
public CommandDocumentationSource(IFubuApplicationFiles files, IFileSystem fileSystem) { _applications = new Cache <string, CommandLineApplicationReport>(name => { var filename = "{0}.cli.xml".ToFormat(name); var file = files.Find(filename); if (file == null) { throw new ArgumentOutOfRangeException("name", name, "Unable to find a *.cli.xml file for the requested application name"); } return(fileSystem.LoadFromFile <CommandLineApplicationReport>(file.Path)); }); }
public ViewCollection(ViewFacility <T> facility, IFubuApplicationFiles files, Func <IFubuFile, T> builder, ViewEngineSettings settings, FileSet match) { if (match == null) { throw new ArgumentNullException("match"); } _facility = facility; _files = files; _builder = builder; _settings = settings; _match = match; _top = buildFolder(_files.RootPath); }
private static void applySettings(ConfigGraph config, BehaviorGraph graph, IActivationDiagnostics diagnostics, IFubuApplicationFiles files) { // Might come back to this. config.Imports.Each(x => x.InitializeSettings(graph)); config.Settings.Each(x => x.Alter(graph.Settings)); var viewSettings = graph.Settings.Get<ViewEngineSettings>(); var views = viewSettings.BuildViewBag(graph, diagnostics, files); var conneg = graph.Settings.Get<ConnegSettings>(); conneg.ReadConnegGraph(graph); conneg.StoreViews(views); }
public FileWatcherManifest CreateFileWatcherManifest(IFubuApplicationFiles files) { var manifest = new FileWatcherManifest(files.RootPath, AssemblyFinder.FindBinPath()); if (Mode == SearchMode.PublicFolderOnly) { manifest.PublicAssetFolder = DeterminePublicFolder(files).Replace('\\', '/'); } manifest.AssetExtensions = assetMimeTypes().SelectMany(x => x.Extensions).Union(AllowableExtensions).ToArray(); manifest.ContentMatches = ContentMatches.ToArray(); return(manifest); }
/// <summary> /// Used internally to determine the public folder if the mode is set to /// PublicFolderOnly /// </summary> /// <param name="files"></param> /// <returns></returns> public string DeterminePublicFolder(IFubuApplicationFiles files) { var candidate = files.RootPath.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); }
public AppDomainFubuDiagnostics(AppReloaded reloaded, IFubuApplicationFiles files) { _reloaded = reloaded; _files = files; }
public SharingConfigActivator(SharingGraph sharingGraph, SharingLogsCache logs, IFubuApplicationFiles files) { _sharingGraph = sharingGraph; _diagnostics = new SharingRegistrationDiagnostics(_sharingGraph, logs); _files = files; }
public void Fill(ViewEngineSettings settings, BehaviorGraph graph, IPerfTimer timer, IFubuApplicationFiles files) { throw new NotImplementedException(); }
public DefaultFeatureValidator(IFubuApplicationFiles fubuApplicationFiles) { _fubuApplicationFiles = fubuApplicationFiles; }
public void Fill(ViewEngineSettings settings, BehaviorGraph graph, IPerfTimer timer, IFubuApplicationFiles files) { _views = tokens().Where(x => !graph.Settings.Get<ViewEngineSettings>().IsExcluded(x)).ToList(); }
public RazorTemplate(IFubuApplicationFiles files, IFubuFile file, ITemplateFactory factory) : base(file, files) { _factory = factory; }
public StaticFileMiddleware(Func<IDictionary<string, object>, Task> inner, IFubuApplicationFiles files, AssetSettings settings) : base(inner) { _files = files; _settings = settings; }
public PackageAwareXmlLocalizationStorage(IFubuApplicationFiles files) : base(new []{files.RootPath}) { }
private static void applySettings(ConfigGraph config, BehaviorGraph graph, IActivationDiagnostics diagnostics, IFubuApplicationFiles files) { // Might come back to this. config.Imports.Each(x => x.InitializeSettings(graph)); config.Settings.Each(x => x.Alter(graph.Settings)); var viewSettings = graph.Settings.Get <ViewEngineSettings>(); var views = viewSettings.BuildViewBag(graph, diagnostics, files); var conneg = graph.Settings.Get <ConnegSettings>(); conneg.ReadConnegGraph(graph); conneg.StoreViews(views); }
public DefaultTextLocalizer(IFubuApplicationFiles fubuApplicationFiles, IEnumerable <ILocalizationVisitor> visitors) { _fubuApplicationFiles = fubuApplicationFiles; _visitors = visitors; }
public SnippetBuilder(ISnippetCache cache, IFubuApplicationFiles files, IEnumerable<ISnippetScanner> scanners) { _cache = cache; _files = files; _scanners = scanners; }
public override Func <IFubuFile, RazorTemplate> CreateBuilder(SettingsCollection settings, IFubuApplicationFiles files) { var razorSettings = settings.Get <RazorEngineSettings>(); var namespaces = settings.Get <CommonViewNamespaces>(); var factory = new TemplateFactoryCache(namespaces, razorSettings, new TemplateCompiler(), new RazorTemplateGenerator()); return(file => new RazorTemplate(files, file, factory)); }
public FileWatcherManifest CreateFileWatcherManifest(IFubuApplicationFiles files) { var manifest = new FileWatcherManifest(files.RootPath, AssemblyFinder.FindBinPath()); if (Mode == SearchMode.PublicFolderOnly) { manifest.PublicAssetFolder = DeterminePublicFolder(files).Replace('\\', '/'); } manifest.AssetExtensions = assetMimeTypes().SelectMany(x => x.Extensions).Union(AllowableExtensions).ToArray(); manifest.ContentMatches = ContentMatches.ToArray(); return manifest; }
public FileWriterEndpoint(IOutputWriter writer, IFubuApplicationFiles files) { _writer = writer; _files = files; }
public override Func <IFubuFile, SparkTemplate> CreateBuilder(SettingsCollection settings, IFubuApplicationFiles files) { return(file => new SparkTemplate(files, file, _engine, settings.Get <SparkEngineSettings>())); }
public override void Fill(ViewEngineSettings settings, BehaviorGraph graph, IPerfTimer timer, IFubuApplicationFiles files) { configureNamespaces(graph); base.Fill(settings, graph, timer, files); var bindingTemplates = files .FindFiles(FileSet.Shallow("Shared/bindings.xml")) .Select(x => new SparkTemplate(files, x, _engine, graph.Settings.Get <SparkEngineSettings>())).ToArray(); _engine.ViewFolder = new TemplateViewFolder(AllTemplates()); _engine.DefaultPageBaseType = typeof(FubuSparkView).FullName; _engine.BindingProvider = new FubuBindingProvider(bindingTemplates); _engine.PartialProvider = new FubuPartialProvider(this); }
public DefaultTextLocalizer(IFubuApplicationFiles fubuApplicationFiles, IEnumerable<ILocalizationVisitor> visitors) { _fubuApplicationFiles = fubuApplicationFiles; _visitors = visitors; }
/// <summary> /// Used internally to determine the public folder if the mode is set to /// PublicFolderOnly /// </summary> /// <param name="files"></param> /// <returns></returns> public string DeterminePublicFolder(IFubuApplicationFiles files) { var candidate = files.RootPath.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; }
public DefaultFileUploader(IFubuApplicationFiles fubuApplicationFiles) { _fubuApplicationFiles = fubuApplicationFiles; }
public BottleAwareXmlLocalizationStorage(IFubuApplicationFiles files) : base(files.AllFolders.Select(x => x.Path)) { }
public StaticFileMiddleware(Func <IDictionary <string, object>, Task> inner, IFubuApplicationFiles files, AssetSettings settings) : base(inner) { _files = files; _settings = settings; }
public static BehaviorGraph Build(FubuRegistry registry, IPerfTimer perfTimer, IEnumerable <Assembly> packageAssemblies, IActivationDiagnostics diagnostics, IFubuApplicationFiles files) { var featureLoader = new FeatureLoader(); featureLoader.LookForFeatures(); if (registry.Mode.InDevelopment()) { registry.AlterSettings <DiagnosticsSettings>(_ => _.TraceLevel = TraceLevel.Verbose); registry.AlterSettings <AssetSettings>(_ => _.SetupForDevelopment()); } var graph = new BehaviorGraph { ApplicationAssembly = registry.ApplicationAssembly, PackageAssemblies = packageAssemblies }; var accessorRules = AccessorRulesCompiler.Compile(graph, perfTimer); var validationCompilation = ValidationCompiler.Compile(graph, perfTimer, registry); var config = registry.Config; perfTimer.Record("Applying Settings", () => applySettings(config, graph, diagnostics, files)); perfTimer.Record("Enable built in polling jobs", () => enableBuiltInJobs(graph)); perfTimer.Record("Applying Feature Settings", () => featureLoader.ApplyAll(graph.Settings, registry).Wait(30.Seconds()).AssertFinished()); config.Add(new ActionlessViewChainSource()); perfTimer.Record("Local Application BehaviorGraph", () => config.BuildLocal(graph, perfTimer)); perfTimer.Record("Explicit Configuration", () => config.Global.Explicits.RunActions(graph)); perfTimer.Record("Global Policies", () => config.Global.Policies.RunActions(graph)); perfTimer.Record("Inserting Conneg and Authorization Nodes", () => insertConnegAndAuthorizationNodes(graph)); perfTimer.Record("Applying Global Reorderings", () => config.ApplyGlobalReorderings(graph)); if (registry.Mode.InDevelopment() || graph.Settings.Get <DiagnosticsSettings>().TraceLevel != TraceLevel.None) { perfTimer.Record("Applying Tracing", () => ApplyTracing.Configure(graph)); } Task.WaitAll(new Task[] { accessorRules, validationCompilation }, 30.Seconds()).AssertFinished(); new AutoImportModelNamespacesConvention().Configure(graph); return(graph); }
public SnippetEndpoints(ISnippetCache cache, IUrlRegistry urls, IFubuApplicationFiles files) { _cache = cache; _urls = urls; _files = files; }
public PackageSettingsSource(IFubuApplicationFiles files) { _files = files; }
public PackageAwareXmlLocalizationStorage(IFubuApplicationFiles files) : base(new [] { files.RootPath }) { }
public void RegisterTemplates(IFubuApplicationFiles fubuFiles, SparkEngineSettings settings) { fubuFiles.FindFiles(settings.Search).Each(file => _templateRegistry.Register(new Template(file.Path, file.ProvenancePath, file.Provenance))); }
public FileReaderEndpoint(IFubuApplicationFiles files) { _files = files; }
public void RegisterTemplates(IFubuApplicationFiles fubuFiles, RazorEngineSettings settings) { fubuFiles.FindFiles(settings.Search).Each(file => _templateRegistry.Register(new Template(file.Path, file.ProvenancePath, file.Provenance))); }
protected abstract Parsing createParsing(IFubuApplicationFiles files);