Browse Source

Rename IHybridWebRootFileProvider to IWebContentFileProvider

pull/395/head
Halil ibrahim Kalkan 8 years ago
parent
commit
3234d8115d
  1. 10
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleManager.cs
  2. 10
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundlerBase.cs
  3. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/Scripts/ScriptBundler.cs
  4. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/Styles/StyleBundler.cs
  5. 10
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperResourceService.cs
  6. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperScriptService.cs
  7. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperStyleService.cs
  8. 2
      framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/VirtualFileSystemApplicationBuilderExtensions.cs
  9. 2
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/IWebContentFileProvider.cs
  10. 9
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/WebContentFileProvider.cs

10
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleManager.cs

@ -21,7 +21,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
public ILogger<BundleManager> Logger { get; set; } public ILogger<BundleManager> Logger { get; set; }
protected readonly BundlingOptions Options; protected readonly BundlingOptions Options;
protected readonly IHybridWebRootFileProvider WebRootFileProvider; protected readonly IWebContentFileProvider WebContentFileProvider;
protected readonly IHostingEnvironment HostingEnvironment; protected readonly IHostingEnvironment HostingEnvironment;
protected readonly IScriptBundler ScriptBundler; protected readonly IScriptBundler ScriptBundler;
protected readonly IStyleBundler StyleBundler; protected readonly IStyleBundler StyleBundler;
@ -38,7 +38,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
IServiceProvider serviceProvider, IServiceProvider serviceProvider,
IDynamicFileProvider dynamicFileProvider, IDynamicFileProvider dynamicFileProvider,
IBundleCache bundleCache, IBundleCache bundleCache,
IHybridWebRootFileProvider webRootFileProvider, IWebContentFileProvider webContentFileProvider,
IWebRequestResources requestResources) IWebRequestResources requestResources)
{ {
HostingEnvironment = hostingEnvironment; HostingEnvironment = hostingEnvironment;
@ -46,7 +46,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
ServiceProvider = serviceProvider; ServiceProvider = serviceProvider;
DynamicFileProvider = dynamicFileProvider; DynamicFileProvider = dynamicFileProvider;
BundleCache = bundleCache; BundleCache = bundleCache;
WebRootFileProvider = webRootFileProvider; WebContentFileProvider = webContentFileProvider;
RequestResources = requestResources; RequestResources = requestResources;
StyleBundler = styleBundler; StyleBundler = styleBundler;
Options = options.Value; Options = options.Value;
@ -112,7 +112,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
{ {
foreach (var file in files) foreach (var file in files)
{ {
var watchDisposeHandle = WebRootFileProvider.Watch(file).RegisterChangeCallback(_ => var watchDisposeHandle = WebContentFileProvider.Watch(file).RegisterChangeCallback(_ =>
{ {
lock (cacheValue.WatchDisposeHandles) lock (cacheValue.WatchDisposeHandles)
{ {
@ -196,7 +196,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
protected virtual BundleConfigurationContext CreateBundleConfigurationContext() protected virtual BundleConfigurationContext CreateBundleConfigurationContext()
{ {
return new BundleConfigurationContext(ServiceProvider, WebRootFileProvider); return new BundleConfigurationContext(ServiceProvider, WebContentFileProvider);
} }
protected virtual List<BundleContributor> GetContributors(BundleConfigurationCollection bundles, string bundleName) protected virtual List<BundleContributor> GetContributors(BundleConfigurationCollection bundles, string bundleName)

10
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundlerBase.cs

@ -12,12 +12,12 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
{ {
public ILogger<BundlerBase> Logger { get; set; } public ILogger<BundlerBase> Logger { get; set; }
protected IHybridWebRootFileProvider WebRootFileProvider { get; } protected IWebContentFileProvider WebContentFileProvider { get; }
protected IMinifier Minifier { get; } protected IMinifier Minifier { get; }
protected BundlerBase(IHybridWebRootFileProvider webRootFileProvider, IMinifier minifier) protected BundlerBase(IWebContentFileProvider webContentFileProvider, IMinifier minifier)
{ {
WebRootFileProvider = webRootFileProvider; WebContentFileProvider = webContentFileProvider;
Minifier = minifier; Minifier = minifier;
Logger = NullLogger<BundlerBase>.Instance; Logger = NullLogger<BundlerBase>.Instance;
@ -59,11 +59,11 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
protected virtual IFileInfo GetFileInfo(IBundlerContext context, string file) protected virtual IFileInfo GetFileInfo(IBundlerContext context, string file)
{ {
var fileInfo = WebRootFileProvider.GetFileInfo(file); var fileInfo = WebContentFileProvider.GetFileInfo(file);
if (!fileInfo.Exists) if (!fileInfo.Exists)
{ {
throw new AbpException($"Could not find file '{file}' using {nameof(IHybridWebRootFileProvider)}"); throw new AbpException($"Could not find file '{file}' using {nameof(IWebContentFileProvider)}");
} }
return fileInfo; return fileInfo;

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/Scripts/ScriptBundler.cs

@ -7,8 +7,8 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.Scripts
{ {
public override string FileExtension => "js"; public override string FileExtension => "js";
public ScriptBundler(IHybridWebRootFileProvider webRootFileProvider, IJavascriptMinifier minifier) public ScriptBundler(IWebContentFileProvider webContentFileProvider, IJavascriptMinifier minifier)
: base(webRootFileProvider, minifier) : base(webContentFileProvider, minifier)
{ {
} }
} }

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/Styles/StyleBundler.cs

@ -11,8 +11,8 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.Styles
private readonly IHostingEnvironment _hostingEnvironment; private readonly IHostingEnvironment _hostingEnvironment;
public override string FileExtension => "css"; public override string FileExtension => "css";
public StyleBundler(IHybridWebRootFileProvider webRootFileProvider, ICssMinifier minifier, IHostingEnvironment hostingEnvironment) public StyleBundler(IWebContentFileProvider webContentFileProvider, ICssMinifier minifier, IHostingEnvironment hostingEnvironment)
: base(webRootFileProvider, minifier) : base(webContentFileProvider, minifier)
{ {
_hostingEnvironment = hostingEnvironment; _hostingEnvironment = hostingEnvironment;
} }

10
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperResourceService.cs

@ -18,18 +18,18 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
public ILogger<AbpTagHelperResourceService> Logger { get; set; } public ILogger<AbpTagHelperResourceService> Logger { get; set; }
protected IBundleManager BundleManager { get; } protected IBundleManager BundleManager { get; }
protected IHybridWebRootFileProvider WebRootFileProvider { get; } protected IWebContentFileProvider WebContentFileProvider { get; }
protected IHostingEnvironment HostingEnvironment { get; } protected IHostingEnvironment HostingEnvironment { get; }
protected readonly BundlingOptions Options; protected readonly BundlingOptions Options;
protected AbpTagHelperResourceService( protected AbpTagHelperResourceService(
IBundleManager bundleManager, IBundleManager bundleManager,
IHybridWebRootFileProvider webRootFileProvider, IWebContentFileProvider webContentFileProvider,
IOptions<BundlingOptions> options, IOptions<BundlingOptions> options,
IHostingEnvironment hostingEnvironment) IHostingEnvironment hostingEnvironment)
{ {
BundleManager = bundleManager; BundleManager = bundleManager;
WebRootFileProvider = webRootFileProvider; WebContentFileProvider = webContentFileProvider;
HostingEnvironment = hostingEnvironment; HostingEnvironment = hostingEnvironment;
Options = options.Value; Options = options.Value;
@ -63,10 +63,10 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
foreach (var bundleFile in bundleFiles) foreach (var bundleFile in bundleFiles)
{ {
var file = WebRootFileProvider.GetFileInfo(bundleFile); var file = WebContentFileProvider.GetFileInfo(bundleFile);
if (file == null) if (file == null)
{ {
throw new AbpException($"Could not find the bundle file from {nameof(IHybridWebRootFileProvider)}"); throw new AbpException($"Could not find the bundle file from {nameof(IWebContentFileProvider)}");
} }
AddHtmlTag(context, output, bundleFile + "?_v=" + file.LastModified.UtcTicks); AddHtmlTag(context, output, bundleFile + "?_v=" + file.LastModified.UtcTicks);

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperScriptService.cs

@ -12,12 +12,12 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
{ {
public AbpTagHelperScriptService( public AbpTagHelperScriptService(
IBundleManager bundleManager, IBundleManager bundleManager,
IHybridWebRootFileProvider webRootFileProvider, IWebContentFileProvider webContentFileProvider,
IOptions<BundlingOptions> options, IOptions<BundlingOptions> options,
IHostingEnvironment hostingEnvironment IHostingEnvironment hostingEnvironment
) : base( ) : base(
bundleManager, bundleManager,
webRootFileProvider, webContentFileProvider,
options, options,
hostingEnvironment) hostingEnvironment)
{ {

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperStyleService.cs

@ -12,12 +12,12 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
{ {
public AbpTagHelperStyleService( public AbpTagHelperStyleService(
IBundleManager bundleManager, IBundleManager bundleManager,
IHybridWebRootFileProvider webRootFileProvider, IWebContentFileProvider webContentFileProvider,
IOptions<BundlingOptions> options, IOptions<BundlingOptions> options,
IHostingEnvironment hostingEnvironment IHostingEnvironment hostingEnvironment
) : base( ) : base(
bundleManager, bundleManager,
webRootFileProvider, webContentFileProvider,
options, options,
hostingEnvironment) hostingEnvironment)
{ {

2
framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/VirtualFileSystemApplicationBuilderExtensions.cs

@ -27,7 +27,7 @@ namespace Microsoft.AspNetCore.Builder
app.UseStaticFiles( app.UseStaticFiles(
new StaticFileOptions new StaticFileOptions
{ {
FileProvider = app.ApplicationServices.GetRequiredService<IHybridWebRootFileProvider>() FileProvider = app.ApplicationServices.GetRequiredService<IWebContentFileProvider>()
} }
); );
} }

2
framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/IHybridWebRootFileProvider.cs → framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/IWebContentFileProvider.cs

@ -2,7 +2,7 @@
namespace Volo.Abp.AspNetCore.VirtualFileSystem namespace Volo.Abp.AspNetCore.VirtualFileSystem
{ {
public interface IHybridWebRootFileProvider : IFileProvider public interface IWebContentFileProvider : IFileProvider
{ {
} }

9
framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/HybridWebRootFileProvider.cs → framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/WebContentFileProvider.cs

@ -1,5 +1,4 @@
using System; using System;
using System.IO;
using System.Linq; using System.Linq;
using JetBrains.Annotations; using JetBrains.Annotations;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
@ -12,7 +11,7 @@ using Volo.Abp.VirtualFileSystem;
namespace Volo.Abp.AspNetCore.VirtualFileSystem namespace Volo.Abp.AspNetCore.VirtualFileSystem
{ {
//TODO: How to handle wwwroot naming? //TODO: How to handle wwwroot naming?
public class HybridWebRootFileProvider : IHybridWebRootFileProvider, ISingletonDependency public class WebContentFileProvider : IWebContentFileProvider, ISingletonDependency
{ {
private readonly IVirtualFileProvider _virtualFileProvider; private readonly IVirtualFileProvider _virtualFileProvider;
private readonly IFileProvider _fileProvider; private readonly IFileProvider _fileProvider;
@ -21,7 +20,7 @@ namespace Volo.Abp.AspNetCore.VirtualFileSystem
protected AspNetCoreContentOptions Options { get; } protected AspNetCoreContentOptions Options { get; }
public HybridWebRootFileProvider( public WebContentFileProvider(
IVirtualFileProvider virtualFileProvider, IVirtualFileProvider virtualFileProvider,
IHostingEnvironment hostingEnvironment, IHostingEnvironment hostingEnvironment,
IOptions<AspNetCoreContentOptions> options) IOptions<AspNetCoreContentOptions> options)
@ -69,13 +68,13 @@ namespace Volo.Abp.AspNetCore.VirtualFileSystem
{ {
if (!ExtraAllowedFolder(filter)) if (!ExtraAllowedFolder(filter))
{ {
return _fileProvider.Watch("/wwwroot" + filter); return _fileProvider.Watch(_rootPath + filter);
} }
return new CompositeChangeToken( return new CompositeChangeToken(
new[] new[]
{ {
_fileProvider.Watch("/wwwroot" + filter), _fileProvider.Watch(_rootPath + filter),
_fileProvider.Watch(filter) _fileProvider.Watch(filter)
} }
); );
Loading…
Cancel
Save