Skip to content

Commit

Permalink
Merge pull request #51 from Lombiq/issue/OSOE-751
Browse files Browse the repository at this point in the history
OSOE-751: Upgrade to Orchard Core 1.8
  • Loading branch information
Psichorex authored Feb 21, 2024
2 parents 1eda7ff + 411fb56 commit aee5578
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
</PropertyGroup>

Expand All @@ -28,12 +28,12 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="OrchardCore.Deployment.Abstractions" Version="1.7.0" />
<PackageReference Include="OrchardCore.DisplayManagement.Abstractions" Version="1.7.0" />
<PackageReference Include="OrchardCore.Recipes.Abstractions" Version="1.7.0" />
<PackageReference Include="OrchardCore.ResourceManagement.Abstractions" Version="1.7.0" />
<PackageReference Include="OrchardCore.Media" Version="1.7.0" />
<PackageReference Include="OrchardCore.Module.Targets" Version="1.7.0" />
<PackageReference Include="OrchardCore.Deployment.Abstractions" Version="1.8.2" />
<PackageReference Include="OrchardCore.DisplayManagement.Abstractions" Version="1.8.2" />
<PackageReference Include="OrchardCore.Recipes.Abstractions" Version="1.8.2" />
<PackageReference Include="OrchardCore.ResourceManagement.Abstractions" Version="1.8.2" />
<PackageReference Include="OrchardCore.Media" Version="1.8.2" />
<PackageReference Include="OrchardCore.Module.Targets" Version="1.8.2" />
<PackageReference Include="Scrutor" Version="4.2.2" />
</ItemGroup>

Expand All @@ -42,7 +42,7 @@
</ItemGroup>

<ItemGroup Condition="'$(NuGetBuild)' == 'true'">
<PackageReference Include="Lombiq.HelpfulLibraries.OrchardCore" Version="8.0.3-alpha.0.lmbq-249" />
<PackageReference Include="Lombiq.HelpfulLibraries.OrchardCore" Version="8.1.1-alpha.7.osoe-751" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Lombiq.Hosting.MediaTheme.Bridge/Manifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
Version = "0.0.1",
Description = "Provides the processing logic for the Media Theme.",
Category = "Hosting",
Dependencies = new[] { "OrchardCore.Deployment", "OrchardCore.Media" }
Dependencies = ["OrchardCore.Deployment", "OrchardCore.Media"]
)]
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public async Task InvokeAsync(HttpContext context)
}

context.Response.StatusCode = 404;
context.Response.Headers.Add("Content-Length", "0");
context.Response.Headers.Append("Content-Length", "0");
await context.Response.Body.FlushAsync(context.RequestAborted);
context.Abort();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public IEnumerable<IFeatureInfo> GetFeatures(string[] featureIdsToLoad)
if (featureIdsToLoad.Contains(FeatureNames.MediaTheme))
{
var baseThemeId = GetBaseThemeId();
if (!string.IsNullOrEmpty(baseThemeId)) featureIdsToLoad = featureIdsToLoad.Append(baseThemeId).ToArray();
if (!string.IsNullOrEmpty(baseThemeId)) featureIdsToLoad = [.. featureIdsToLoad, baseThemeId];
}

return _decorated.GetFeatures(featureIdsToLoad);
Expand Down
2 changes: 1 addition & 1 deletion Lombiq.Hosting.MediaTheme.Bridge/Views/Admin/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

<div class="mb-3">
<div class="mb-3" asp-validation-class-for="BaseThemeId">
<label asp-for="BaseThemeId">@T["Base Theme"]</label>
<label class="form-label" asp-for="BaseThemeId">@T["Base Theme"]</label>
<select asp-for="BaseThemeId" asp-items="availableThemesSelectList" class="form-control"></select>
<span asp-validation-for="BaseThemeId"></span>
<div class="hint">@T["By updating the base theme the shape table cache will be invalidated."]</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<div class="mb-3">
<div class="form-check">
<label class="form-check-label">
<label class="form-label form-check-label">
<input class="form-check-input" asp-for="ClearMediaThemeFolder"
data-reverseToggle=".media-sel"/>
@T["Clear Media Theme files when imported."]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackAsTool>true</PackAsTool>
Expand Down
18 changes: 11 additions & 7 deletions Lombiq.Hosting.MediaTheme.Deployer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ public class CommandLineOptions
public string? RemoteDeploymentClientApiKey { get; set; }
}

internal static class Program
internal static partial class Program
{
internal static readonly string[] FeaturesToEnable = ["Lombiq.Hosting.MediaTheme.Bridge", "Lombiq.Hosting.MediaTheme"];

public static Task Main(string[] args) =>
Parser.Default.ParseArguments<CommandLineOptions>(args)
.WithNotParsed(HandleParseError)
Expand All @@ -76,7 +78,7 @@ public static Task Main(string[] args) =>
private static void HandleParseError(IEnumerable<Error> errors)
{
var errorsList = errors.ToList();
if (errorsList.Any())
if (errorsList.Count != 0)
{
foreach (var error in errorsList)
{
Expand Down Expand Up @@ -134,7 +136,7 @@ private static async Task RunOptionsInnerAsync(CommandLineOptions options)
var featureStep = JObject.FromObject(new
{
name = "Feature",
enable = new[] { "Lombiq.Hosting.MediaTheme.Bridge", "Lombiq.Hosting.MediaTheme" },
enable = FeaturesToEnable,
});
recipeSteps.Add(featureStep);

Expand All @@ -152,12 +154,11 @@ private static async Task RunOptionsInnerAsync(CommandLineOptions options)
{
var manifestPath = Path.Combine(themePath, "Manifest.cs");
var manifestContent = await File.ReadAllTextAsync(manifestPath);
var basteThemeMatch = Regex.Match(
manifestContent, @"BaseTheme\s*=\s*""(?<baseThemeId>.*)""", RegexOptions.ExplicitCapture, TimeSpan.FromSeconds(1));
var baseThemeMatch = BaseThemeRegex().Match(manifestContent);

if (basteThemeMatch.Success)
if (baseThemeMatch.Success)
{
baseThemeId = basteThemeMatch.Groups["baseThemeId"].Value;
baseThemeId = baseThemeMatch.Groups["baseThemeId"].Value;
}
}

Expand Down Expand Up @@ -343,4 +344,7 @@ private static void CreateRecipeAndWriteIt(CommandLineOptions options, JArray st

file.Close();
}

[GeneratedRegex(@"BaseTheme\s*=\s*""(?<baseThemeId>.*)""", RegexOptions.ExplicitCapture, matchTimeoutMilliseconds: 1000)]
private static partial Regex BaseThemeRegex();
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
</PropertyGroup>

Expand All @@ -10,10 +10,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="OrchardCore.Theme.Targets" Version="1.7.0" />
<PackageReference Include="OrchardCore.ContentManagement" Version="1.7.0" />
<PackageReference Include="OrchardCore.DisplayManagement" Version="1.7.0" />
<PackageReference Include="OrchardCore.ResourceManagement" Version="1.7.0" />
<PackageReference Include="OrchardCore.Theme.Targets" Version="1.8.2" />
<PackageReference Include="OrchardCore.ContentManagement" Version="1.8.2" />
<PackageReference Include="OrchardCore.DisplayManagement" Version="1.8.2" />
<PackageReference Include="OrchardCore.ResourceManagement" Version="1.8.2" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Lombiq.Hosting.MediaTheme.Tests.Theme/Manifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
Website = "https://github.com/Lombiq/Hosting-Media-Theme",
Version = "0.0.1",
Description = "A theme only used for testing that demonstrates the local development version of a Media Theme.",
Dependencies = new[] { MediaThemeBridge }
Dependencies = [MediaThemeBridge]
)]
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<DefaultItemExcludes>$(DefaultItemExcludes);.git*;node_modules\**</DefaultItemExcludes>
</PropertyGroup>

Expand All @@ -28,7 +28,7 @@
</ItemGroup>

<ItemGroup Condition="'$(NuGetBuild)' == 'true'">
<PackageReference Include="Lombiq.Tests.UI" Version="8.1.0-alpha.1.osoe-638" />
<PackageReference Include="Lombiq.Tests.UI" Version="8.2.1-alpha.22.osoe-751" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions Lombiq.Hosting.MediaTheme/Lombiq.Hosting.MediaTheme.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
</PropertyGroup>

Expand Down Expand Up @@ -32,7 +32,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="OrchardCore.Theme.Targets" Version="1.7.0" />
<PackageReference Include="OrchardCore.Theme.Targets" Version="1.8.2" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Lombiq.Hosting.MediaTheme/Manifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
Version = "0.0.1",
Description = "Allows developers to host their themes in the Orchard Core Media Library, including templates and assets.",
Category = "Hosting",
Dependencies = new[] { MediaThemeBridge }
Dependencies = [MediaThemeBridge]
)]

0 comments on commit aee5578

Please sign in to comment.