Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSOE-91: Normalize line endings to auto across all submodules #67

Merged
merged 10 commits into from
Apr 23, 2022
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* -crlf
* text=auto
24 changes: 12 additions & 12 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: publish

on:
push:
tags:
- v*

jobs:
call-publish-workflow:
uses: Lombiq/GitHub-Actions/.github/workflows/publish.yml@dev
secrets:
API_KEY: ${{ secrets.DEFAULT_NUGET_PUBLISH_API_KEY }}
name: publish

on:
push:
tags:
- v*

jobs:
call-publish-workflow:
uses: Lombiq/GitHub-Actions/.github/workflows/publish.yml@dev
secrets:
API_KEY: ${{ secrets.DEFAULT_NUGET_PUBLISH_API_KEY }}
14 changes: 7 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.vs/
obj/
bin/
artifacts/
wwwroot/
node_modules/
*.user
.vs/
obj/
bin/
artifacts/
wwwroot/
node_modules/
*.user
.pnpm-debug.log
0liver marked this conversation as resolved.
Show resolved Hide resolved
504 changes: 252 additions & 252 deletions Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions Extensions/CodeGeneration/ContentTypeMigrationsViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;

namespace Lombiq.HelpfulExtensions.Extensions.CodeGeneration;

public class ContentTypeMigrationsViewModel
{
internal Lazy<string> MigrationCodeLazy { get; set; }
public string MigrationCode => MigrationCodeLazy.Value;
}
using System;

namespace Lombiq.HelpfulExtensions.Extensions.CodeGeneration;

public class ContentTypeMigrationsViewModel
{
internal Lazy<string> MigrationCodeLazy { get; set; }
public string MigrationCode => MigrationCodeLazy.Value;
}
40 changes: 20 additions & 20 deletions Extensions/CodeGeneration/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using OrchardCore.ContentTypes.Editors;
using OrchardCore.Modules;
using System;

namespace Lombiq.HelpfulExtensions.Extensions.CodeGeneration;

[Feature(FeatureIds.CodeGeneration)]
public class Startup : StartupBase
{
public override void ConfigureServices(IServiceCollection services) =>
services.AddScoped<IContentTypeDefinitionDisplayDriver, CodeGenerationDisplayDriver>();

public override void Configure(IApplicationBuilder app, IEndpointRouteBuilder routes, IServiceProvider serviceProvider)
{
// No need for anything here yet.
}
}
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using OrchardCore.ContentTypes.Editors;
using OrchardCore.Modules;
using System;

namespace Lombiq.HelpfulExtensions.Extensions.CodeGeneration;

[Feature(FeatureIds.CodeGeneration)]
public class Startup : StartupBase
{
public override void ConfigureServices(IServiceCollection services) =>
services.AddScoped<IContentTypeDefinitionDisplayDriver, CodeGenerationDisplayDriver>();

public override void Configure(IApplicationBuilder app, IEndpointRouteBuilder routes, IServiceProvider serviceProvider)
{
// No need for anything here yet.
}
}
12 changes: 6 additions & 6 deletions Extensions/ContentTypes/ContentTypes.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Lombiq.HelpfulExtensions.Extensions.ContentTypes;

public static class ContentTypes
{
public const string Page = nameof(Page);
}
namespace Lombiq.HelpfulExtensions.Extensions.ContentTypes;

public static class ContentTypes
{
public const string Page = nameof(Page);
}
98 changes: 49 additions & 49 deletions Extensions/ContentTypes/Migrations.cs
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
using OrchardCore.Autoroute.Models;
using OrchardCore.ContentManagement.Metadata;
using OrchardCore.ContentManagement.Metadata.Settings;
using OrchardCore.Data.Migration;
using static Lombiq.HelpfulExtensions.Extensions.ContentTypes.ContentTypes;

namespace Lombiq.HelpfulExtensions.Extensions.ContentTypes;

public class Migrations : DataMigration
{
private readonly IContentDefinitionManager _contentDefinitionManager;

public Migrations(IContentDefinitionManager contentDefinitionManager) =>
_contentDefinitionManager = contentDefinitionManager;

public int Create()
{
_contentDefinitionManager.AlterTypeDefinition(Page, builder => builder
.Creatable()
.Securable()
.Draftable()
.Listable()
.Versionable()
.WithPart("TitlePart", part => part.WithPosition("0"))
.WithPart("AutoroutePart", part => part
.WithPosition("1")
.WithSettings(new AutoroutePartSettings
{
ShowHomepageOption = true,
AllowCustomPath = true,
})
)
.WithPart("FlowPart", part => part.WithPosition("2"))
);

return 2;
}

public int UpdateFrom1()
{
_contentDefinitionManager.AlterTypeDefinition(Page, builder => builder
.WithPart("TitlePart", part => part.WithPosition("0"))
.WithPart("AutoroutePart", part => part.WithPosition("1"))
.WithPart("FlowPart", part => part.WithPosition("2"))
);

return 2;
}
}
using OrchardCore.Autoroute.Models;
using OrchardCore.ContentManagement.Metadata;
using OrchardCore.ContentManagement.Metadata.Settings;
using OrchardCore.Data.Migration;
using static Lombiq.HelpfulExtensions.Extensions.ContentTypes.ContentTypes;

namespace Lombiq.HelpfulExtensions.Extensions.ContentTypes;

public class Migrations : DataMigration
{
private readonly IContentDefinitionManager _contentDefinitionManager;

public Migrations(IContentDefinitionManager contentDefinitionManager) =>
_contentDefinitionManager = contentDefinitionManager;

public int Create()
{
_contentDefinitionManager.AlterTypeDefinition(Page, builder => builder
.Creatable()
.Securable()
.Draftable()
.Listable()
.Versionable()
.WithPart("TitlePart", part => part.WithPosition("0"))
.WithPart("AutoroutePart", part => part
.WithPosition("1")
.WithSettings(new AutoroutePartSettings
{
ShowHomepageOption = true,
AllowCustomPath = true,
})
)
.WithPart("FlowPart", part => part.WithPosition("2"))
);

return 2;
}

public int UpdateFrom1()
{
_contentDefinitionManager.AlterTypeDefinition(Page, builder => builder
.WithPart("TitlePart", part => part.WithPosition("0"))
.WithPart("AutoroutePart", part => part.WithPosition("1"))
.WithPart("FlowPart", part => part.WithPosition("2"))
);

return 2;
}
}
38 changes: 19 additions & 19 deletions Extensions/ContentTypes/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using OrchardCore.Data.Migration;
using OrchardCore.Modules;
using System;

namespace Lombiq.HelpfulExtensions.Extensions.ContentTypes;

[Feature(FeatureIds.ContentTypes)]
public class Startup : StartupBase
{
public override void ConfigureServices(IServiceCollection services) => services.AddScoped<IDataMigration, Migrations>();

public override void Configure(IApplicationBuilder app, IEndpointRouteBuilder routes, IServiceProvider serviceProvider)
{
// No need for anything here yet.
}
}
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using OrchardCore.Data.Migration;
using OrchardCore.Modules;
using System;

namespace Lombiq.HelpfulExtensions.Extensions.ContentTypes;

[Feature(FeatureIds.ContentTypes)]
public class Startup : StartupBase
{
public override void ConfigureServices(IServiceCollection services) => services.AddScoped<IDataMigration, Migrations>();

public override void Configure(IApplicationBuilder app, IEndpointRouteBuilder routes, IServiceProvider serviceProvider)
{
// No need for anything here yet.
}
}
80 changes: 40 additions & 40 deletions Extensions/Emails/Extensions/EmailSenderShellScopeExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
using Lombiq.HelpfulExtensions.Extensions.Emails.Models;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using OrchardCore.Email;
using OrchardCore.Environment.Shell.Scope;
using System.Collections.Generic;
using System.Linq;

namespace Lombiq.HelpfulExtensions.Extensions.Emails.Extensions;

public static class EmailSenderShellScopeExtensions
{
/// <summary>
/// Sends an HTML email after the current shell scope has ended. If any errors occur during the process they will be
/// logged.
/// </summary>
/// <param name="parameters">Parameters required for sending emails (e.g., recipients, subject, CC).</param>
public static void SendEmailDeferred(this ShellScope shellScope, EmailParameters parameters) =>
shellScope.AddDeferredTask(async scope =>
{
var smtpService = scope.ServiceProvider.GetRequiredService<ISmtpService>();
var result = await smtpService.SendAsync(new MailMessage
{
Sender = parameters.Sender,
To = parameters.To?.Join(","),
Cc = parameters.Cc?.Join(","),
Bcc = parameters.Bcc?.Join(","),
Subject = parameters.Subject,
ReplyTo = parameters.ReplyTo,
Body = parameters.Body,
IsBodyHtml = true,
});

if (!result.Succeeded)
{
var logger = scope.ServiceProvider.GetRequiredService<ILogger<ShellScope>>();
logger.LogError("Email sending was unsuccessful: {Error}", result.Errors.Select(error => error.ToString()).Join());
}
});
}
using Lombiq.HelpfulExtensions.Extensions.Emails.Models;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using OrchardCore.Email;
using OrchardCore.Environment.Shell.Scope;
using System.Collections.Generic;
using System.Linq;

namespace Lombiq.HelpfulExtensions.Extensions.Emails.Extensions;

public static class EmailSenderShellScopeExtensions
{
/// <summary>
/// Sends an HTML email after the current shell scope has ended. If any errors occur during the process they will be
/// logged.
/// </summary>
/// <param name="parameters">Parameters required for sending emails (e.g., recipients, subject, CC).</param>
public static void SendEmailDeferred(this ShellScope shellScope, EmailParameters parameters) =>
shellScope.AddDeferredTask(async scope =>
{
var smtpService = scope.ServiceProvider.GetRequiredService<ISmtpService>();
var result = await smtpService.SendAsync(new MailMessage
{
Sender = parameters.Sender,
To = parameters.To?.Join(","),
Cc = parameters.Cc?.Join(","),
Bcc = parameters.Bcc?.Join(","),
Subject = parameters.Subject,
ReplyTo = parameters.ReplyTo,
Body = parameters.Body,
IsBodyHtml = true,
});

if (!result.Succeeded)
{
var logger = scope.ServiceProvider.GetRequiredService<ILogger<ShellScope>>();
logger.LogError("Email sending was unsuccessful: {Error}", result.Errors.Select(error => error.ToString()).Join());
}
});
}
28 changes: 14 additions & 14 deletions Extensions/Emails/Models/EmailParameters.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using System.Collections.Generic;

namespace Lombiq.HelpfulExtensions.Extensions.Emails.Models;

public class EmailParameters
{
public string Sender { get; set; }
public IEnumerable<string> To { get; set; }
public IEnumerable<string> Cc { get; set; }
public IEnumerable<string> Bcc { get; set; }
public string Subject { get; set; }
public string Body { get; set; }
public string ReplyTo { get; set; }
}
using System.Collections.Generic;

namespace Lombiq.HelpfulExtensions.Extensions.Emails.Models;

public class EmailParameters
{
public string Sender { get; set; }
public IEnumerable<string> To { get; set; }
public IEnumerable<string> Cc { get; set; }
public IEnumerable<string> Bcc { get; set; }
public string Subject { get; set; }
public string Body { get; set; }
public string ReplyTo { get; set; }
}
Loading