Merge pull request #1267 from sbwalker/dev
modify nuget package installer to support satellite assemblies in subfolders
This commit is contained in:
commit
65aac34f8c
@ -93,10 +93,14 @@
|
|||||||
<Pane Name="Bottom Full Width" />
|
<Pane Name="Bottom Full Width" />
|
||||||
@if (_footer)
|
@if (_footer)
|
||||||
{
|
{
|
||||||
<div class="bg-primary footer">
|
<div class="bg-primary fixed-bottom footer">
|
||||||
<Pane Name="Footer" />
|
<Pane Name="Footer" />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<Pane Name="Footer" />
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
@ -7,10 +7,10 @@
|
|||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<Label For="title" ResourceKey="Title" HelpText="Specify If The Page Footer Should Be Displayed">Display Footer?</Label>
|
<Label For="footer" ResourceKey="Footer" HelpText="Specify If A Footer Should Always Be Displayed In A Fixed Location At The Bottom Of The Browser Window">Display Fixed Footer?</Label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select id="title" class="form-control" @bind="@_footer">
|
<select id="footer" class="form-control" @bind="@_footer">
|
||||||
<option value="true">Yes</option>
|
<option value="true">Yes</option>
|
||||||
<option value="false">No</option>
|
<option value="false">No</option>
|
||||||
</select>
|
</select>
|
||||||
|
@ -38,7 +38,7 @@ namespace Oqtane.Infrastructure
|
|||||||
public static bool InstallPackages(string folders, string webRootPath, string contentRootPath)
|
public static bool InstallPackages(string folders, string webRootPath, string contentRootPath)
|
||||||
{
|
{
|
||||||
bool install = false;
|
bool install = false;
|
||||||
string binFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location);
|
string binPath = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location);
|
||||||
|
|
||||||
foreach (string folder in folders.Split(','))
|
foreach (string folder in folders.Split(','))
|
||||||
{
|
{
|
||||||
@ -82,40 +82,37 @@ namespace Oqtane.Infrastructure
|
|||||||
List<string> assets = new List<string>();
|
List<string> assets = new List<string>();
|
||||||
bool manifest = false;
|
bool manifest = false;
|
||||||
|
|
||||||
// module and theme packages must be in form of name.1.0.0.nupkg
|
// packages are in form of name.1.0.0.nupkg or name.culture.1.0.0.nupkg
|
||||||
string name = Path.GetFileNameWithoutExtension(packagename);
|
string name = Path.GetFileNameWithoutExtension(packagename);
|
||||||
string[] segments = name?.Split('.');
|
string[] segments = name?.Split('.');
|
||||||
if (segments != null) name = string.Join('.', segments, 0, segments.Length - 3);
|
if (segments != null) name = string.Join('.', segments, 0, segments.Length - 3); // remove version information
|
||||||
|
|
||||||
// deploy to appropriate locations
|
// deploy to appropriate locations
|
||||||
foreach (ZipArchiveEntry entry in archive.Entries)
|
foreach (ZipArchiveEntry entry in archive.Entries)
|
||||||
{
|
{
|
||||||
string foldername = Path.GetDirectoryName(entry.FullName).Split(Path.DirectorySeparatorChar)[0];
|
string filename = "";
|
||||||
string filename = Path.GetFileName(entry.FullName);
|
|
||||||
|
|
||||||
if (!manifest && filename == "assets.json")
|
// evaluate entry root folder
|
||||||
|
switch (entry.FullName.Split('/')[0])
|
||||||
{
|
{
|
||||||
manifest = true;
|
case "lib": // lib/net5.0/...
|
||||||
|
filename = ExtractFile(entry, binPath, 2);
|
||||||
|
break;
|
||||||
|
case "wwwroot": // wwwroot/...
|
||||||
|
filename = ExtractFile(entry, webRootPath, 1);
|
||||||
|
break;
|
||||||
|
case "runtimes": // runtimes/name/...
|
||||||
|
filename = ExtractFile(entry, binPath, 0);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (foldername)
|
if (filename != "")
|
||||||
{
|
{
|
||||||
case "lib":
|
assets.Add(filename.Replace(contentRootPath, ""));
|
||||||
filename = Path.Combine(binFolder, filename);
|
if (!manifest && Path.GetFileName(filename) == "assets.json")
|
||||||
ExtractFile(entry, filename);
|
{
|
||||||
assets.Add(filename.Replace(contentRootPath, ""));
|
manifest = true;
|
||||||
break;
|
}
|
||||||
case "wwwroot":
|
|
||||||
filename = Path.Combine(webRootPath, Utilities.PathCombine(entry.FullName.Replace("wwwroot/", "").Split('/')));
|
|
||||||
ExtractFile(entry, filename);
|
|
||||||
assets.Add(filename.Replace(contentRootPath, ""));
|
|
||||||
break;
|
|
||||||
case "runtimes":
|
|
||||||
var destSubFolder = Path.GetDirectoryName(entry.FullName);
|
|
||||||
filename = Path.Combine(binFolder, destSubFolder, filename);
|
|
||||||
ExtractFile(entry, filename);
|
|
||||||
assets.Add(filename.Replace(contentRootPath, ""));
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,21 +142,25 @@ namespace Oqtane.Infrastructure
|
|||||||
return install;
|
return install;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ExtractFile(ZipArchiveEntry entry, string filename)
|
private static string ExtractFile(ZipArchiveEntry entry, string folder, int ignoreLeadingSegments)
|
||||||
{
|
{
|
||||||
if (!Directory.Exists(Path.GetDirectoryName(filename)))
|
string[] segments = entry.FullName.Split('/'); // ZipArchiveEntries always use unix path separator
|
||||||
{
|
string filename = Path.Combine(folder, string.Join(Path.DirectorySeparatorChar, segments, ignoreLeadingSegments, segments.Length - ignoreLeadingSegments));
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(filename));
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (!Directory.Exists(Path.GetDirectoryName(filename)))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(Path.GetDirectoryName(filename));
|
||||||
|
}
|
||||||
entry.ExtractToFile(filename, true);
|
entry.ExtractToFile(filename, true);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
// an error occurred extracting the file
|
// an error occurred extracting the file
|
||||||
|
filename = "";
|
||||||
}
|
}
|
||||||
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpgradeFramework()
|
public void UpgradeFramework()
|
||||||
|
@ -55,6 +55,7 @@ div.app-moduleactions a.dropdown-toggle, div.app-moduleactions div.dropdown-menu
|
|||||||
min-height: 40px;
|
min-height: 40px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
|
z-index: 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 767px) {
|
@media (max-width: 767px) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user