Huge IIOHelper cleanup, removes some overlap with IHostingEnvironment, much less usages of IIOHelper and instead just use what is already available on IHostingEnvironment
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.IO;
|
||||
|
||||
namespace Umbraco.Web.WebAssets
|
||||
@@ -28,9 +29,9 @@ namespace Umbraco.Web.WebAssets
|
||||
/// The angular module name to boot
|
||||
/// </param>
|
||||
/// <param name="globalSettings"></param>
|
||||
/// <param name="ioHelper"></param>
|
||||
/// <param name="hostingEnvironment"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetJavascriptInitialization(IEnumerable<string> scripts, string angularModule, IGlobalSettings globalSettings, IIOHelper ioHelper)
|
||||
public static string GetJavascriptInitialization(IEnumerable<string> scripts, string angularModule, IGlobalSettings globalSettings, IHostingEnvironment hostingEnvironment)
|
||||
{
|
||||
var jarray = new StringBuilder();
|
||||
jarray.AppendLine("[");
|
||||
@@ -46,7 +47,7 @@ namespace Umbraco.Web.WebAssets
|
||||
}
|
||||
jarray.Append("]");
|
||||
|
||||
return WriteScript(jarray.ToString(), ioHelper.ResolveUrl(globalSettings.UmbracoPath), angularModule);
|
||||
return WriteScript(jarray.ToString(), hostingEnvironment.ToAbsolute(globalSettings.UmbracoPath), angularModule);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Manifest;
|
||||
@@ -24,19 +25,22 @@ namespace Umbraco.Web.WebAssets
|
||||
|
||||
private readonly IRuntimeMinifier _runtimeMinifier;
|
||||
private readonly IManifestParser _parser;
|
||||
private readonly IIOHelper _ioHelper;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly IHostingEnvironment _hostingEnvironment;
|
||||
private readonly PropertyEditorCollection _propertyEditorCollection;
|
||||
|
||||
public BackOfficeWebAssets(
|
||||
IRuntimeMinifier runtimeMinifier,
|
||||
IManifestParser parser,
|
||||
IIOHelper ioHelper,
|
||||
PropertyEditorCollection propertyEditorCollection)
|
||||
PropertyEditorCollection propertyEditorCollection,
|
||||
IHostingEnvironment hostingEnvironment,
|
||||
IGlobalSettings globalSettings)
|
||||
{
|
||||
_runtimeMinifier = runtimeMinifier;
|
||||
_parser = parser;
|
||||
_ioHelper = ioHelper;
|
||||
_propertyEditorCollection = propertyEditorCollection;
|
||||
_hostingEnvironment = hostingEnvironment;
|
||||
_globalSettings = globalSettings;
|
||||
}
|
||||
|
||||
public void CreateBundles()
|
||||
@@ -150,7 +154,7 @@ namespace Umbraco.Web.WebAssets
|
||||
/// <returns></returns>
|
||||
private string[] FormatPaths(params string[] assets)
|
||||
{
|
||||
var umbracoPath = _ioHelper.GetUmbracoMvcArea();
|
||||
var umbracoPath = _globalSettings.GetUmbracoMvcArea(_hostingEnvironment);
|
||||
|
||||
return assets
|
||||
.Where(x => x.IsNullOrWhiteSpace() == false)
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.WebAssets;
|
||||
|
||||
@@ -14,10 +15,10 @@ namespace Umbraco.Web.WebAssets
|
||||
/// Returns the JavaScript to load the back office's assets
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static async Task<string> GetScriptForLoadingBackOfficeAsync(this IRuntimeMinifier minifier, IGlobalSettings globalSettings, IIOHelper ioHelper)
|
||||
public static async Task<string> GetScriptForLoadingBackOfficeAsync(this IRuntimeMinifier minifier, IGlobalSettings globalSettings, IHostingEnvironment hostingEnvironment)
|
||||
{
|
||||
var files = await minifier.GetAssetPathsAsync(BackOfficeWebAssets.UmbracoJsBundleName);
|
||||
var result = BackOfficeJavaScriptInitializer.GetJavascriptInitialization(files, "umbraco", globalSettings, ioHelper);
|
||||
var result = BackOfficeJavaScriptInitializer.GetJavascriptInitialization(files, "umbraco", globalSettings, hostingEnvironment);
|
||||
result += await GetStylesheetInitializationAsync(minifier);
|
||||
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user