protected override CassetteApplication CreateCassetteApplicationCore(IBundleContainer bundleContainer, CassetteSettings settings) { return(new CassetteApplication(bundleContainer, settings, routeGenerator, getCurrentContext)); }
public ReferenceBuilder(IBundleContainer bundleContainer, IDictionary <Type, IBundleFactory <Bundle> > bundleFactories, IPlaceholderTracker placeholderTracker, CassetteSettings settings) { this.bundleContainer = bundleContainer; this.bundleFactories = bundleFactories; this.placeholderTracker = placeholderTracker; this.settings = settings; }
public BundleRequestHandler(IBundleContainer bundleContainer, RequestContext requestContext) { this.bundleContainer = bundleContainer; routeData = requestContext.RouteData; response = requestContext.HttpContext.Response; request = requestContext.HttpContext.Request; }
protected override CassetteApplication CreateCassetteApplicationCore(IBundleContainer bundleContainer, CassetteSettings settings) { return(new CassetteApplication( bundleContainer, settings, getHttpContext )); }
public CassetteApplication(IBundleContainer bundleContainer, CassetteSettings settings, Func<HttpContextBase> getCurrentHttpContext, IDependencyGraphInteractionFactory dependencyGraphFactory) : base(bundleContainer, settings, dependencyGraphFactory) { this.getCurrentHttpContext = getCurrentHttpContext; }
protected CassetteRouteHandlerBase(IBundleContainer bundleContainer, string handlerRoot) { if (bundleContainer == null) throw new ArgumentNullException("bundleContainer"); if (string.IsNullOrEmpty(handlerRoot)) throw new ArgumentNullException("handlerRoot"); BundleContainer = bundleContainer; HandlerRoot = handlerRoot; }
public CassetteApplication(IBundleContainer bundleContainer, CassetteSettings settings, CassetteRouteGenerator routeHandling, Func<NancyContext> getCurrentContext) : base(bundleContainer, settings) { if (getCurrentContext == null) throw new ArgumentNullException("getCurrentContext"); this.getCurrentContext = getCurrentContext; routeHandling.InstallCassetteRouteHandlers(bundleContainer); }
public void SaveBundleContainer(IBundleContainer bundleContainer) { DeleteExistingFiles(); SaveContainerXml(bundleContainer); foreach (var bundle in bundleContainer.Bundles) { SaveBundle(bundle); } }
private void InstallAssetHandler(IBundleContainer bundleContainer) { var handlerRoot = string.Format("/{0}/asset", RoutePrefix); cassetteHandlers.Add(handlerRoot, context => new AssetRouteHandler(bundleContainer, handlerRoot).ProcessRequest(context)); //if (logger != null) logger.Trace("Installed Cassette route handler for '{0}'", handlerRoot); }
public TestableApplication(IUrlGenerator urlGenerator, IReferenceBuilder referenceBuilder, IBundleContainer bundleContainer) : base(new Bundle[0], new CassetteSettings("") { SourceDirectory = Mock.Of <IDirectory>(), IsDebuggingEnabled = true, UrlGenerator = urlGenerator }) { this.referenceBuilder = referenceBuilder; this.bundleContainer = bundleContainer; }
public void SaveBundleContainer(IBundleContainer bundleContainer) { Trace.Source.TraceInformation("Saving bundle container to cache."); DeleteExistingFiles(); SaveContainerXml(bundleContainer); foreach (var bundle in bundleContainer.Bundles) { SaveBundle(bundle); } Trace.Source.TraceInformation("Saved bundle container to cache."); }
public void SaveBundleContainer(IBundleContainer bundleContainer) { Trace.Source.TraceInformation("Saving bundle container to cache."); DeleteExistingFiles(); SaveContainerXml(bundleContainer); foreach (var bundle in bundleContainer.Bundles) { SaveBundle(bundle); } Trace.Source.TraceInformation("Saved bundle container to cache."); }
public CassetteApplication(IBundleContainer bundleContainer, CassetteSettings settings, CassetteRouteGenerator routeHandling, Func <NancyContext> getCurrentContext) : base(bundleContainer, settings) { if (getCurrentContext == null) { throw new ArgumentNullException("getCurrentContext"); } this.getCurrentContext = getCurrentContext; routeHandling.InstallCassetteRouteHandlers(bundleContainer); }
public void InstallRoutes(RouteCollection routes, IBundleContainer bundleContainer) { RemoveExistingCassetteRoutes(routes); InstallBundleRoute <ScriptBundle>(routes, bundleContainer); InstallBundleRoute <StylesheetBundle>(routes, bundleContainer); InstallBundleRoute <HtmlTemplateBundle>(routes, bundleContainer); InstallRawFileRoute(routes); InstallAssetCompileRoute(routes, bundleContainer); }
void InstallBundleRoute <T>(RouteCollection routes, IBundleContainer bundleContainer) where T : Bundle { var url = GetBundleRouteUrl <T>(); var handler = new DelegateRouteHandler( requestContext => new BundleRequestHandler <T>(bundleContainer, requestContext) ); Trace.Source.TraceInformation("Installing {0} route handler for \"{1}\".", typeof(T).FullName, url); // Insert Cassette's routes at the start of the table, // to avoid conflicts with the application's own routes. routes.Insert(0, new CassetteRoute(url, handler)); }
IEnumerable <XElement> CreateReferenceElements(Bundle bundle, IBundleContainer bundleContainer) { var references = ( from asset in bundle.Assets from r in asset.References where r.Type == AssetReferenceType.DifferentBundle || r.Type == AssetReferenceType.Url select bundleContainer.FindBundleContainingPath <Bundle>(r.Path).Path ).Concat(bundle.References) .Distinct(StringComparer.OrdinalIgnoreCase); return(from reference in references select new XElement("Reference", new XAttribute("Path", reference))); }
private void InstallBundleHandler <T>(IBundleContainer bundleContainer) where T : Bundle { var handlerRoot = string.Format( "/{0}/{1}", RoutePrefix, ConventionalBundlePathName(typeof(T))); cassetteHandlers.Add(handlerRoot, context => new BundleRouteHandler <T>(bundleContainer, handlerRoot).ProcessRequest(context)); //if (logger != null) logger.Trace("Installed Cassette route handler for '{0}'", handlerRoot); }
XElement CreateBundleElement(Bundle bundle, IBundleContainer bundleContainer) { var referenceElements = CreateReferenceElements(bundle, bundleContainer); var fileElements = CreateFileElements(bundle); return(new XElement( "Bundle", new XAttribute("Path", bundle.Path), bundle.Assets.Count > 0 ? new XAttribute("Hash", bundle.Hash.ToHexString()) : null, referenceElements, fileElements )); }
public static bool TryGetAssetByPath(this IBundleContainer bundleContainer, string path, out IAsset asset, out Bundle bundle) { bundle = bundleContainer.FindBundleContainingPath <Bundle>(path); if (bundle == null) { asset = null; return(false); } else { asset = bundle.FindAssetByPath(path); return(asset != null); } }
protected CassetteRouteHandlerBase(IBundleContainer bundleContainer, string handlerRoot) { if (bundleContainer == null) { throw new ArgumentNullException("bundleContainer"); } if (string.IsNullOrEmpty(handlerRoot)) { throw new ArgumentNullException("handlerRoot"); } BundleContainer = bundleContainer; HandlerRoot = handlerRoot; }
void InstallAssetCompileRoute(RouteCollection routes, IBundleContainer bundleContainer) { // Used to return compiled coffeescript, less, etc. const string url = RoutePrefix + "/asset/{*path}"; var handler = new DelegateRouteHandler( requestContext => new AssetRequestHandler( requestContext, bundleContainer ) ); Trace.Source.TraceInformation("Installing asset route handler for \"{0}\".", url); // Insert Cassette's routes at the start of the table, // to avoid conflicts with the application's own routes. routes.Insert(0, new CassetteRoute(url, handler)); }
internal void InstallCassetteRouteHandlers(IBundleContainer bundleContainer) { lock (cassetteHandlers) { cassetteHandlers.Clear(); InstallBundleHandler <ScriptBundle>(bundleContainer); InstallBundleHandler <StylesheetBundle>(bundleContainer); InstallBundleHandler <HtmlTemplateBundle>(bundleContainer); InstallAssetHandler(bundleContainer); InstallRawFileAssetHandler(bundleContainer); InstallHudHandler(); } }
void SaveContainerXml(IBundleContainer bundleContainer) { var assetCounter = new AssetCounter(); assetCounter.Visit(bundleContainer.Bundles); var xml = new XDocument( new XElement( "Container", new XAttribute("Version", version), new XAttribute("AssetCount", assetCounter.Count), from bundle in bundleContainer.Bundles select CreateBundleElement(bundle, bundleContainer) ) ); using (var fileStream = containerFile.Open(FileMode.Create, FileAccess.Write, FileShare.None)) { xml.Save(fileStream); } }
public static bool TryGetAssetByPath(this IBundleContainer bundleContainer, string path, out IAsset asset, out Bundle bundle) { var results = from b in bundleContainer.FindBundlesContainingPath(path) let a = b.FindAssetByPath(path) where a != null select new { Bundle = b, Asset = a }; var result = results.FirstOrDefault(); if (result != null) { asset = result.Asset; bundle = result.Bundle; return(true); } else { asset = null; bundle = null; return(false); } }
CassetteApplication CreateApplication(Action <BundleCollection> configure) { var settings = new CassetteSettings("") { CacheDirectory = new IsolatedStorageDirectory(storage), SourceDirectory = new FileSystemDirectory(Path.GetFullPath("assets")) }; var bundles = new BundleCollection(settings); configure(bundles); IBundleContainer bundleContainer = null; var application = new CassetteApplication( bundles, settings, new CassetteRouting(new VirtualDirectoryPrepender("/"), () => bundleContainer), () => httpContext.Object ); bundleContainer = application.BundleContainer; application.InstallRoutes(routes); return(application); }
protected CassetteApplicationBase(IBundleContainer bundleContainer, CassetteSettings settings) { this.settings = settings; this.bundleContainer = bundleContainer; }
public CassetteApplication(IBundleContainer bundleContainer, CassetteSettings settings, Func <HttpContextBase> getCurrentHttpContext) : base(bundleContainer, settings) { this.getCurrentHttpContext = getCurrentHttpContext; }
public RawFileRouteHandler(IBundleContainer bundleContainer, string handlerRoot, ILogger logger, string applicationRoot) : base(bundleContainer, handlerRoot, logger) { this.applicationRoot = applicationRoot; }
public RawFileRouteHandler(IBundleContainer bundleContainer, string handlerRoot, string applicationRoot) : base(bundleContainer, handlerRoot) { this.applicationRoot = applicationRoot; }
public AssetRequestHandler(RequestContext requestContext, IBundleContainer bundleContainer) { this.requestContext = requestContext; this.bundleContainer = bundleContainer; }
public AssetRequestHandler(RequestContext requestContext, IBundleContainer bundleContainer) { this.requestContext = requestContext; this.bundleContainer = bundleContainer; }
protected abstract T CreateCassetteApplicationCore(IBundleContainer bundleContainer, CassetteSettings settings);
void SaveContainerXml(IBundleContainer bundleContainer) { var assetCounter = new AssetCounter(); assetCounter.Visit(bundleContainer.Bundles); var xml = new XDocument( new XElement( "Container", new XAttribute("Version", version), new XAttribute("AssetCount", assetCounter.Count), from bundle in bundleContainer.Bundles select CreateBundleElement(bundle, bundleContainer) ) ); using (var fileStream = containerFile.Open(FileMode.Create, FileAccess.Write, FileShare.None)) { xml.Save(fileStream); } }
public void SaveBundleContainer(IBundleContainer bundleContainer) { DeleteExistingFiles(); SaveContainerXml(bundleContainer); foreach (var bundle in bundleContainer.Bundles) { SaveBundle(bundle); } }
XElement CreateBundleElement(Bundle bundle, IBundleContainer bundleContainer) { var referenceElements = CreateReferenceElements(bundle, bundleContainer); var fileElements = CreateFileElements(bundle); return new XElement( "Bundle", new XAttribute("Path", bundle.Path), bundle.Assets.Count > 0 ? new XAttribute("Hash", bundle.Hash.ToHexString()) : null, referenceElements, fileElements ); }
IEnumerable<XElement> CreateReferenceElements(Bundle bundle, IBundleContainer bundleContainer) { var references = ( from asset in bundle.Assets from r in asset.References where r.Type == AssetReferenceType.DifferentBundle || r.Type == AssetReferenceType.Url select bundleContainer.FindBundleContainingPath<Bundle>(r.Path).Path ).Concat(bundle.References) .Distinct(StringComparer.OrdinalIgnoreCase); return from reference in references select new XElement("Reference", new XAttribute("Path", reference)); }
internal BundleContainerRef(IBundleContainer container) { m_Container = container; }
public AssetRouteHandler(IBundleContainer bundleContainer, string handlerRoot) : base(bundleContainer, handlerRoot) { }
public CassetteApplication(IBundleContainer bundleContainer, CassetteSettings settings, Func<HttpContextBase> getCurrentHttpContext) : base(bundleContainer, settings) { this.getCurrentHttpContext = getCurrentHttpContext; }
public AssetRouteHandler(IBundleContainer bundleContainer, string HandlerRoot, ILogger Logger) : base(bundleContainer, HandlerRoot, Logger) { }
public AssetRouteHandler(IBundleContainer bundleContainer, string handlerRoot) : base(bundleContainer, handlerRoot) { }