Example #1
0
        public void GetDefaultBundleProcessorForHtmlTemplateBundleReturnsHtmlTemplatePipeline()
        {
            var settings  = new CassetteSettings("");
            var processor = settings.GetDefaultBundleProcessor <HtmlTemplateBundle>();

            processor.ShouldBeType <HtmlTemplatePipeline>();
        }
        public void Configure(BundleCollection bundles, CassetteSettings settings)
        {
            // TODO: Configure your bundles here...
            // Please read http://getcassette.net/documentation/configuration

            // This default configuration treats each file as a separate 'bundle'.
            // In production the content will be minified, but the files are not combined.
            // So you probably want to tweak these defaults!
            bundles.Add<StylesheetBundle>("assets/css");
            bundles.Add<ScriptBundle>("assets/js");

            bundles.AddUrlWithAlias<ScriptBundle>("https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js", "jquery");
            bundles.AddUrlWithAlias<ScriptBundle>("https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js", "jquery-ui");
            bundles.AddUrlWithAlias<ScriptBundle>("http://ajax.aspnetcdn.com/ajax/knockout/knockout-2.1.0.js", "knockout");

            //<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
            //<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
            //<script src="http://ajax.aspnetcdn.com/ajax/knockout/knockout-2.1.0.js"></script>

            // To combine files, try something like this instead:
            //   bundles.Add<StylesheetBundle>("Content");
            // In production mode, all of ~/Content will be combined into a single bundle.

            // If you want a bundle per folder, try this:
            //   bundles.AddPerSubDirectory<ScriptBundle>("Scripts");
            // Each immediate sub-directory of ~/Scripts will be combined into its own bundle.
            // This is useful when there are lots of scripts for different areas of the website.

            // *** TOP TIP: Delete all ".min.js" files now ***
            // Cassette minifies scripts for you. So those files are never used.
        }
 protected void ProcessAllBundles(IEnumerable <Bundle> bundles, CassetteSettings settings)
 {
     foreach (var bundle in bundles)
     {
         bundle.Process(settings);
     }
 }
        public void Configure(BundleCollection bundles, CassetteSettings settings)
        {
            // The "Scripts/app" contains the application script we'll be testing with Jasmine.
            // The "Scripts/specs" contains the Jasmine specs. It is treated just like a regular Cassette bundle.

            bundles.AddPerSubDirectory<ScriptBundle>("Scripts");
        }
        public void Configure(BundleCollection bundles, CassetteSettings settings)
        {
            // TODO: Configure your bundles here...
            // Please read http://getcassette.net/documentation/configuration

            // This default configuration treats each file as a separate 'bundle'.
            // In production the content will be minified, but the files are not combined.
            // So you probably want to tweak these defaults!
            bundles.AddPerSubDirectory<ScriptBundle>("Scripts");

            // To combine files, try something like this instead:
            bundles.Add<StylesheetBundle>("Content", new FileSearch
                                                         {
                                                             Pattern = "*.css;*.less",
                                                             SearchOption = SearchOption.AllDirectories,
                                                             Exclude = new Regex("base")
                                                         });
            // In production mode, all of ~/Content will be combined into a single bundle.

            // If you want a bundle per folder, try this:
            //   bundles.AddPerSubDirectory<ScriptBundle>("Scripts");
            // Each immediate sub-directory of ~/Scripts will be combined into its own bundle.
            // This is useful when there are lots of scripts for different areas of the website.

            // *** TOP TIP: Delete all ".min.js" files now ***
            // Cassette minifies scripts for you. So those files are never used.
        }
Example #6
0
        public void GivenCacheIsUpToDate_WhenInitializeBundlesFromCacheIfUpToDate_ThenBundleAssetsReplacedWithCachedAsset()
        {
            using (var cacheDir = new TempDirectory())
            {
                File.WriteAllText(
                    Path.Combine(cacheDir, "container.xml"),
                    "<?xml version=\"1.0\"?><Container Version=\"VERSION\" AssetCount=\"1\"><Bundle Path=\"~/test\" Hash=\"01\"/></Container>"
                    );
                File.WriteAllText(
                    Path.Combine(cacheDir, "test.bundle"),
                    "asset"
                    );
                var bundleWithAsset = new TestableBundle("~/test");
                var asset = StubAsset();
                bundleWithAsset.Assets.Add(asset.Object);
                var sourceBundles = new[] { bundleWithAsset };

                var settings = new CassetteSettings("")
                {
                    SourceDirectory = Mock.Of<IDirectory>(),
                    CacheDirectory = new FileSystemDirectory(cacheDir)
                };
                var cache = new BundleCache("VERSION", settings);
                var result = cache.InitializeBundlesFromCacheIfUpToDate(sourceBundles);

                result.ShouldBeTrue();
                bundleWithAsset.Assets[0].OpenStream().ReadToEnd().ShouldEqual("asset");
            }
        }
Example #7
0
 public CachedBundleContainerFactory(BundleCollection runtimeGeneratedBundles, ICassetteManifestCache cache, CassetteSettings settings)
     : base(settings)
 {
     this.runtimeGeneratedBundles = runtimeGeneratedBundles;
     this.cache    = cache;
     this.settings = settings;
 }
 protected override Bundle CreateBundleCore(CassetteSettings settings)
 {
     return new ExternalScriptBundle(Url, Path, FallbackCondition)
     {
         Renderer = new ConstantHtmlRenderer<ScriptBundle>(Html(), settings.UrlModifier)
     };
 }
 public ExternalStylesheetHtmlRenderer_Tests()
 {
     settings = new CassetteSettings("");
     fallbackRenderer = new Mock<IBundleHtmlRenderer<StylesheetBundle>>();
     renderer = new ExternalStylesheetHtmlRenderer(fallbackRenderer.Object, settings);
     bundle = new ExternalStylesheetBundle("http://test.com/");
 }
        public void Configure(BundleCollection bundles, CassetteSettings settings)
        {
            // TODO: Configure your bundles here...
            // Please read http://getcassette.net/documentation/configuration

            // This default configuration treats each file as a separate 'bundle'.
            // In production the content will be minified, but the files are not combined.
            // So you probably want to tweak these defaults!
            //bundles.AddPerIndividualFile<StylesheetBundle>("Content");
            //bundles.AddPerIndividualFile<ScriptBundle>("Scripts");

            bundles.Add<ScriptBundle>("Content/app");

            bundles.Add<StylesheetBundle>("Content/assets/css");
            bundles.Add<HtmlTemplateBundle>("Content/assets/templates", bundle => bundle.Processor = new HoganPipeline());
            bundles.AddPerSubDirectory<ScriptBundle>("Content/assets/js");

            bundles.Add<ScriptBundle>("Scripts", new FileSearch { Exclude = new Regex("_references.js|-vsdoc\\.js$")});

            // To combine files, try something like this instead:
            //   bundles.Add<StylesheetBundle>("Content");
            // In production mode, all of ~/Content will be combined into a single bundle.

            // If you want a bundle per folder, try this:
            //   bundles.AddPerSubDirectory<ScriptBundle>("Scripts");
            // Each immediate sub-directory of ~/Scripts will be combined into its own bundle.
            // This is useful when there are lots of scripts for different areas of the website.

            // *** TOP TIP: Delete all ".min.js" files now ***
            // Cassette minifies scripts for you. So those files are never used.
        }
 Bundle CreateExternalBundle(string reference, Bundle referencer, CassetteSettings settings)
 {
     var bundleFactory = GetBundleFactory(referencer.GetType());
     var externalBundle = bundleFactory.CreateExternalBundle(reference);
     externalBundle.Process(settings);
     return externalBundle;
 }
        protected IEnumerable<Bundle> CreateExternalBundlesFromReferences(IEnumerable<Bundle> bundlesArray, CassetteSettings settings)
        {
            var referencesAlreadyCreated = new HashSet<string>();
            foreach (var bundle in bundlesArray)
            {
                foreach (var reference in bundle.References)
                {
                    if (reference.IsUrl() == false) continue;
                    if (referencesAlreadyCreated.Contains(reference)) continue;

                    var externalBundle = CreateExternalBundle(reference, bundle, settings);
                    referencesAlreadyCreated.Add(externalBundle.Path);
                    yield return externalBundle;
                }
                foreach (var asset in bundle.Assets)
                {
                    foreach (var assetReference in asset.References)
                    {
                        if (assetReference.Type != AssetReferenceType.Url ||
                            referencesAlreadyCreated.Contains(assetReference.Path)) continue;

                        var externalBundle = CreateExternalBundle(assetReference.Path, bundle, settings);
                        referencesAlreadyCreated.Add(externalBundle.Path);
                        yield return externalBundle;
                    }
                }
            }
        }
Example #13
0
        public void GetDefaultBundleProcessorForStylesheetBundleReturnsStylesheetPipeline()
        {
            var settings  = new CassetteSettings("");
            var processor = settings.GetDefaultBundleProcessor <StylesheetBundle>();

            processor.ShouldBeType <StylesheetPipeline>();
        }
		public void Configure(BundleCollection bundles, CassetteSettings settings)
		{
			// Stylesheets
			bundles.AddUrlWithAlias<StylesheetBundle>("http://fonts.googleapis.com/css?family=PT+Sans", "font-ptsans");
			bundles.AddUrlWithAlias<StylesheetBundle>("http://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700,300italic,400italic,500italic,700italic", "font-ubuntu");
			bundles.AddUrlWithAlias<StylesheetBundle>("http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,600,700,800,300", "font-opensans");
			bundles.AddPerSubDirectory<StylesheetBundle>("Styles", new FileSearch { Pattern = "*.css;*.less" });

			// Scripts
			bundles.AddPerSubDirectory<ScriptBundle>("Scripts", new FileSearch
			{
			    Pattern = "*.js;*.coffee",
				Exclude = new Regex("-vsdoc\\.js$"), // Excludes the VS documentation files
				SearchOption = SearchOption.AllDirectories
			});

			// HtmlTemplates
			bundles.Add<HtmlTemplateBundle>(
				"Views/Templates",
				new FileSearch 
				{
					Pattern = "*.htm;*.html",
					SearchOption = SearchOption.AllDirectories
				}
				/*,
				// Assign the jQuery-tmpl processor to the HTML template bundles
				bundle => bundle.Processor = new KnockoutJQueryTmplPipeline()*/);
		}
Example #15
0
        public void Configure(BundleCollection bundles, CassetteSettings settings)
        {
            bundles.Add<StylesheetBundle>(@"Content\lib", new FileSearch
                                                              {
                                                                  Pattern = "*.css;*.less",
                                                                  SearchOption = SearchOption.AllDirectories
                                                              });
            bundles.AddPerIndividualFile<StylesheetBundle>(@"Content\Views",
                                                           new FileSearch
                                                               {
                                                                   Pattern = "*.css;*.less",
                                                                   SearchOption = SearchOption.AllDirectories
                                                               });

            bundles.Add<ScriptBundle>(@"Scripts\lib", new FileSearch
                                                          {
                                                              Pattern = "*.js;*.coffee",
                                                              Exclude = new Regex("-vsdoc\\.js$"),
                                                              SearchOption = SearchOption.AllDirectories
                                                          });
            bundles.AddPerIndividualFile<ScriptBundle>(@"Scripts\Views", new FileSearch
                                                                             {
                                                                                 Pattern = "*.js;*.coffee",
                                                                                 Exclude = new Regex("-vsdoc\\.js$"),
                                                                                 SearchOption = SearchOption.AllDirectories
                                                                             });
        }
 protected void ProcessAllBundles(IEnumerable<Bundle> bundles, CassetteSettings settings)
 {
     foreach (var bundle in bundles)
     {
         bundle.Process(settings);
     }
 }
 public ExternalScriptBundleHtmlRenderer_Tests()
 {
     settings = new CassetteSettings("")
     {
         IsDebuggingEnabled = false
     };
 }
 internal override void Process(CassetteSettings settings)
 {
     // Any fallback assets are processed like a regular ScriptBundle.
     base.Process(settings);
     // We just need a special renderer instead.
     externalRenderer = new ExternalScriptBundleHtmlRenderer(Renderer, settings);
 }
Example #19
0
 public void Configure(BundleCollection bundles, CassetteSettings settings)
 {
     if (settings.UrlGenerator == null)
     {
         settings.UrlGenerator = new UrlGenerator(settings.UrlModifier, UrlGenerator.RoutePrefix);
     }
 }
Example #20
0
 public BundleCache(string version, CassetteSettings settings)
 {
     this.version = version;
     this.settings = settings;
     cacheDirectory = settings.CacheDirectory;
     sourceDirectory = settings.SourceDirectory;
     containerFile = cacheDirectory.GetFile(ContainerFilename);
 }
        public void Configure(BundleCollection bundles, CassetteSettings settings)
        {
            // TODO: Configure your bundles here...
            // Please read http://getcassette.net/documentation/configuration

            bundles.Add<StylesheetBundle>("Content");
            bundles.Add<ScriptBundle>("Scripts");
        }
		public void Configure(BundleCollection bundles, CassetteSettings settings)
		{
			bundles.AddPerIndividualFile<ScriptBundle>("scripts/pages");
			bundles.AddPerSubDirectory<ScriptBundle>("scripts",
				new ExcludeDirectorySearch("*.js", new[] { "pages" }));

			bundles.Add<StylesheetBundle>("content");
		}
        Bundle CreateExternalBundle(string reference, Bundle referencer, CassetteSettings settings)
        {
            var bundleFactory  = GetBundleFactory(referencer.GetType());
            var externalBundle = bundleFactory.CreateExternalBundle(reference);

            externalBundle.Process(settings);
            return(externalBundle);
        }
Example #24
0
 public CassetteApplication(IBundleContainer bundleContainer,
     CassetteSettings settings,
     Func<HttpContextBase> getCurrentHttpContext,
     IDependencyGraphInteractionFactory dependencyGraphFactory)
     : base(bundleContainer, settings, dependencyGraphFactory)
 {
     this.getCurrentHttpContext = getCurrentHttpContext;
 }
 protected override Bundle CreateBundleCore(CassetteSettings settings)
 {
     return new ScriptBundle(Path)
     {
         Condition = Condition,
         Renderer = new ConstantHtmlRenderer<ScriptBundle>(Html(), settings.UrlModifier)
     };
 }
 protected override Bundle CreateBundleCore(CassetteSettings settings)
 {
     return new ExternalStylesheetBundle(Url, Path)
     {
         Media = Media,
         Renderer = new ConstantHtmlRenderer<StylesheetBundle>(Html(), settings.UrlModifier)
     };
 }
        public CassetteConfiguration_WhenConfigure()
        {
            var config = new CassetteConfiguration();
            var settings = new CassetteSettings("");
            bundles = new BundleCollection(settings);

            config.Configure(bundles, settings);
        }
Example #28
0
        public void GivenSettingsSetDefaultBundleProcessorForScriptBundle_WhenGetDefaultBundleProcessorForScriptBundle_ThenReturnTheProcessor()
        {
            var settings  = new CassetteSettings("");
            var processor = Mock.Of <IBundleProcessor <ScriptBundle> >();

            settings.SetDefaultBundleProcessor(processor);

            settings.GetDefaultBundleProcessor <ScriptBundle>().ShouldBeSameAs(processor);
        }
        public void GivenSettingsSetDefaultBundleProcessorForScriptBundle_WhenGetDefaultBundleProcessorForScriptBundle_ThenReturnTheProcessor()
        {
            var settings = new CassetteSettings("");
            var processor = Mock.Of<IBundleProcessor<ScriptBundle>>();

            settings.SetDefaultBundleProcessor(processor);

            settings.GetDefaultBundleProcessor<ScriptBundle>().ShouldBeSameAs(processor);
        }
 public BundleCollection_AddUrl_Tests()
 {
     sourceDirectory = new Mock<IDirectory>();
     settings = new CassetteSettings("")
     {
         SourceDirectory = sourceDirectory.Object
     };
     bundles = new BundleCollection(settings);
 }
 public BundleCollection_AddUrl_Tests()
 {
     sourceDirectory = new Mock <IDirectory>();
     settings        = new CassetteSettings("")
     {
         SourceDirectory = sourceDirectory.Object
     };
     bundles = new BundleCollection(settings);
 }
    public CassetteApplication(IEnumerable<Bundle> bundles, CassetteSettings settings,
                               CassetteRouteHandling routeHandling, Func<NancyContext> getCurrentContext)
      : base(bundles, settings)
    {
      if (getCurrentContext == null) throw new ArgumentNullException("getCurrentContext");
      this.getCurrentContext = getCurrentContext;

      routeHandling.InstallCassetteRouteHandlers(BundleContainer);
    }
 public ExternalStylesheetBundleRender_Tests()
 {
     settings = new CassetteSettings("");
     fallbackRenderer = new Mock<IBundleHtmlRenderer<StylesheetBundle>>();
     bundle = new ExternalStylesheetBundle("http://test.com/")
     {
         Processor = new StylesheetPipeline()
     };
 }
        protected CassetteSettings CreateSettings()
        {
            var settings = new CassetteSettings("")
            {
                SourceDirectory = Mock.Of <IDirectory>()
            };

            return(settings);
        }
 public ExternalScriptBundleRender_Tests()
 {
     settings = new CassetteSettings("")
     {
         IsDebuggingEnabled = false,
         UrlGenerator = Mock.Of<IUrlGenerator>()
     };
     fallbackRenderer = new Mock<IBundleHtmlRenderer<ScriptBundle>>();
 }
 public BundleManifest_CreateBundle_Tests()
 {
     settings = new CassetteSettings("");
     manifest = new TestableBundleManifest
     {
         Path = "~",
         Hash = new byte[0]
     };
 }
 protected void ProcessAllBundles(IEnumerable <Bundle> bundles, CassetteSettings settings)
 {
     Trace.Source.TraceInformation("Processing bundles...");
     foreach (var bundle in bundles)
     {
         Trace.Source.TraceInformation("Processing {0} {1}", bundle.GetType().Name, bundle.Path);
         bundle.Process(settings);
     }
     Trace.Source.TraceInformation("Bundle processing completed.");
 }
 public void Configure(BundleCollection bundles, CassetteSettings settings)
 {
   settings.IsDebuggingEnabled = isDebuggingEnabled;
   settings.IsHtmlRewritingEnabled = true;
   settings.AllowRemoteDiagnostics = false;
   settings.SourceDirectory = new FileSystemDirectory(sourceDirectory);
   settings.CacheDirectory = new IsolatedStorageDirectory(() => IsolatedStorageContainer.IsolatedStorageFile);
   settings.UrlGenerator = routeGenerator;
   settings.UrlModifier = new CassetteUrlModifier();
 }
Example #39
0
        public static void CompressBundle(Bundle bundle, IAssetTransformer minifier, CassetteSettings settings)
        {
            new AssignHash().Process(bundle, settings);

            if (!settings.IsDebuggingEnabled)
            {
                bundle.ConcatenateAssets();
                new MinifyAssets(minifier).Process(bundle, settings);
            }
        }
Example #40
0
        public void AddWithExplicitFileCreatesBundleThatIsSorted()
        {
            using (var temp = new TempDirectory())
            {
                File.WriteAllText(Path.Combine(temp, "file1.js"), "");

                var settings = new CassetteSettings("");
                var bundles  = new BundleCollection(settings);
                settings.SourceDirectory = new FileSystemDirectory(temp);

                bundles.Add <ScriptBundle>("~/path", new[] { "~/file1.js" });

                bundles["~/path"].IsSorted.ShouldBeTrue();
            }
        }
Example #41
0
        public void WhenWithExplicitFileAndCustomizeAction_ThenCreatedBundleIsCustomized()
        {
            using (var temp = new TempDirectory())
            {
                File.WriteAllText(Path.Combine(temp, "file1.js"), "");

                var settings = new CassetteSettings("");
                var bundles  = new BundleCollection(settings);
                settings.SourceDirectory = new FileSystemDirectory(temp);

                bundles.Add <ScriptBundle>("~/path", new[] { "~/file1.js" }, b => b.PageLocation = "test");

                bundles["~/path"].PageLocation.ShouldEqual("test");
            }
        }
Example #42
0
        public void WhenAddWithExplicitFileNotStartingWithTilde_ThenAssetFileIsApplicationRelative()
        {
            using (var temp = new TempDirectory())
            {
                File.WriteAllText(Path.Combine(temp, "file1.js"), "");

                var settings = new CassetteSettings("");
                var bundles  = new BundleCollection(settings);
                settings.SourceDirectory = new FileSystemDirectory(temp);

                bundles.Add <ScriptBundle>("~/path", new[] { "file1.js" });

                bundles["~/path"].Assets[0].SourceFile.FullPath.ShouldEqual("~/file1.js");
            }
        }
Example #43
0
        public void WhenAddWithExplicitFileNotStartingWithTildeButBundleDirectoryExists_ThenAssetFileIsBundleRelative()
        {
            using (var temp = new TempDirectory())
            {
                Directory.CreateDirectory(Path.Combine(temp, "bundle"));
                File.WriteAllText(PathUtilities.Combine(temp, "bundle", "file1.js"), "");

                var settings = new CassetteSettings("");
                var bundles  = new BundleCollection(settings);
                settings.SourceDirectory = new FileSystemDirectory(temp);

                bundles.Add <ScriptBundle>("~/bundle", new[] { "file1.js" });

                bundles["~/bundle"].Assets[0].SourceFile.FullPath.ShouldEqual("~/bundle/file1.js");
            }
        }
Example #44
0
        public void AddWithTwoExplicitFileCreatesBundleWithTwoAssets()
        {
            using (var temp = new TempDirectory())
            {
                File.WriteAllText(Path.Combine(temp, "file1.js"), "");
                File.WriteAllText(Path.Combine(temp, "file2.js"), "");

                var settings = new CassetteSettings("");
                var bundles  = new BundleCollection(settings);
                settings.SourceDirectory = new FileSystemDirectory(temp);

                bundles.Add <ScriptBundle>("~/path", new[] { "~/file1.js", "~/file2.js" });

                bundles["~/path"].Assets[0].SourceFile.FullPath.ShouldEqual("~/file1.js");
                bundles["~/path"].Assets[1].SourceFile.FullPath.ShouldEqual("~/file2.js");
            }
        }
 public BundleCollection_AddPerSubDirectory_Tests()
 {
     tempDirectory = new TempDirectory();
     factory       = new Mock <IBundleFactory <TestableBundle> >();
     factory.Setup(f => f.CreateBundle(It.IsAny <string>(), It.IsAny <IEnumerable <IFile> >(), It.IsAny <BundleDescriptor>()))
     .Returns <string, IEnumerable <IFile>, BundleDescriptor>(
         (path, files, d) => createdBundle = new TestableBundle(path)
         );
     defaultAssetSource = new Mock <IFileSearch>();
     settings           = new CassetteSettings("")
     {
         SourceDirectory     = new FileSystemDirectory(tempDirectory),
         BundleFactories     = { { typeof(TestableBundle), factory.Object } },
         DefaultFileSearches = { { typeof(TestableBundle), defaultAssetSource.Object } }
     };
     bundles = new BundleCollection(settings);
 }
Example #46
0
        public BundleCollection_AddPerIndividualFile_Tests()
        {
            var factory = new Mock <IBundleFactory <TestableBundle> >();

            factory
            .Setup(f => f.CreateBundle(It.IsAny <string>(), It.IsAny <IEnumerable <IFile> >(), It.IsAny <BundleDescriptor>()))
            .Returns <string, IEnumerable <IFile>, BundleDescriptor>((path, _, __) => new TestableBundle(path));

            sourceDirectory = new Mock <IDirectory>();
            fileSearch      = new Mock <IFileSearch>();
            settings        = new CassetteSettings("")
            {
                SourceDirectory     = sourceDirectory.Object,
                BundleFactories     = { { typeof(TestableBundle), factory.Object } },
                DefaultFileSearches = { { typeof(TestableBundle), fileSearch.Object } }
            };
            bundles = new BundleCollection(settings);
        }
        public override IBundleContainer Create(IEnumerable <Bundle> unprocessedBundles, CassetteSettings settings)
        {
            // The bundles may get altered, so force the evaluation of the enumerator first.
            var bundlesArray = unprocessedBundles.ToArray();

            ProcessAllBundles(bundlesArray, settings);

            var externalBundles = CreateExternalBundlesFromReferences(bundlesArray, settings);

            return(new BundleContainer(bundlesArray.Concat(externalBundles)));
        }
Example #48
0
 internal BundleCollection(CassetteSettings settings, IEnumerable <Bundle> bundles)
     : this(settings)
 {
     this.bundles.AddRange(bundles);
 }
Example #49
0
 public BundleContainerFactory(BundleCollection bundles, CassetteSettings settings)
     : base(settings)
 {
     this.bundles = bundles;
 }
Example #50
0
 public ExternalBundleGenerator(IEnumerable <string> existingUrls, CassetteSettings settings)
 {
     this.settings     = settings;
     this.existingUrls = new HashSet <string>(existingUrls); // TODO: use case-insensitive string comparer?
 }
 public abstract IBundleContainer Create(IEnumerable <Bundle> unprocessedBundles, CassetteSettings settings);
 public CompileTimeManifestBundleContainerFactory(string filename, CassetteSettings settings) : base(settings)
 {
     this.filename = filename;
     this.settings = settings;
 }
        protected IEnumerable <Bundle> CreateExternalBundlesFromReferences(IEnumerable <Bundle> bundlesArray, CassetteSettings settings)
        {
            var referencesAlreadyCreated = new HashSet <string>();

            foreach (var bundle in bundlesArray)
            {
                foreach (var reference in bundle.References)
                {
                    if (reference.IsUrl() == false)
                    {
                        continue;
                    }
                    if (referencesAlreadyCreated.Contains(reference))
                    {
                        continue;
                    }

                    var externalBundle = CreateExternalBundle(reference, bundle, settings);
                    referencesAlreadyCreated.Add(externalBundle.Path);
                    yield return(externalBundle);
                }
                foreach (var asset in bundle.Assets)
                {
                    foreach (var assetReference in asset.References)
                    {
                        if (assetReference.Type != AssetReferenceType.Url ||
                            referencesAlreadyCreated.Contains(assetReference.Path))
                        {
                            continue;
                        }

                        var externalBundle = CreateExternalBundle(assetReference.Path, bundle, settings);
                        referencesAlreadyCreated.Add(externalBundle.Path);
                        yield return(externalBundle);
                    }
                }
            }
        }
Example #54
0
        static FileSearch GetDefaultInitializer()
        {
            var settings = new CassetteSettings("");

            return(settings.DefaultFileSearches[typeof(T)] as FileSearch);
        }
Example #55
0
 public BundleCollection(CassetteSettings settings)
 {
     this.settings = settings;
 }
        public override IBundleContainer Create(IEnumerable <Bundle> unprocessedBundles, CassetteSettings settings)
        {
            // The bundles may get altered, so force the evaluation of the enumerator first.
            var bundlesArray = unprocessedBundles.ToArray();

            var externalBundles = CreateExternalBundlesFromReferences(bundlesArray, settings);

            if (cache.InitializeBundlesFromCacheIfUpToDate(bundlesArray))
            {
                return(new BundleContainer(bundlesArray.Concat(externalBundles)));
            }
            else
            {
                ProcessAllBundles(bundlesArray, settings);
                var container = new BundleContainer(bundlesArray.Concat(externalBundles));
                cache.SaveBundleContainer(container);
                cache.InitializeBundlesFromCacheIfUpToDate(bundlesArray);
                return(container);
            }
        }
 protected BundleContainerFactoryBase(CassetteSettings settings)
 {
     this.settings = settings;
 }