Skip to content

Commit

Permalink
Add AddDeployment extensions (#15069)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeAlhayek authored and hishamco committed Feb 1, 2024
1 parent 5253bbb commit 1ac518d
Show file tree
Hide file tree
Showing 31 changed files with 126 additions and 186 deletions.
4 changes: 1 addition & 3 deletions src/OrchardCore.Modules/OrchardCore.AdminMenu/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ public override void ConfigureServices(IServiceCollection services)

services.AddRecipeExecutionStep<AdminMenuStep>();

services.AddTransient<IDeploymentSource, AdminMenuDeploymentSource>();
services.AddSingleton<IDeploymentStepFactory>(new DeploymentStepFactory<AdminMenuDeploymentStep>());
services.AddScoped<IDisplayDriver<DeploymentStep>, AdminMenuDeploymentStepDriver>();
services.AddDeployment<AdminMenuDeploymentSource, AdminMenuDeploymentStep, AdminMenuDeploymentStepDriver>();

// placeholder treeNode
services.AddSingleton<IAdminNodeProviderFactory>(new AdminNodeProviderFactory<PlaceholderAdminNode>());
Expand Down
15 changes: 3 additions & 12 deletions src/OrchardCore.Modules/OrchardCore.ContentTypes/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using OrchardCore.ContentTypes.RecipeSteps;
using OrchardCore.ContentTypes.Services;
using OrchardCore.Deployment;
using OrchardCore.DisplayManagement.Handlers;
using OrchardCore.Modules;
using OrchardCore.Mvc.Core.Utilities;
using OrchardCore.Navigation;
Expand Down Expand Up @@ -140,17 +139,9 @@ public class DeploymentStartup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddTransient<IDeploymentSource, ContentDefinitionDeploymentSource>();
services.AddSingleton<IDeploymentStepFactory>(new DeploymentStepFactory<ContentDefinitionDeploymentStep>());
services.AddScoped<IDisplayDriver<DeploymentStep>, ContentDefinitionDeploymentStepDriver>();

services.AddTransient<IDeploymentSource, ReplaceContentDefinitionDeploymentSource>();
services.AddSingleton<IDeploymentStepFactory>(new DeploymentStepFactory<ReplaceContentDefinitionDeploymentStep>());
services.AddScoped<IDisplayDriver<DeploymentStep>, ReplaceContentDefinitionDeploymentStepDriver>();

services.AddTransient<IDeploymentSource, DeleteContentDefinitionDeploymentSource>();
services.AddSingleton<IDeploymentStepFactory>(new DeploymentStepFactory<DeleteContentDefinitionDeploymentStep>());
services.AddScoped<IDisplayDriver<DeploymentStep>, DeleteContentDefinitionDeploymentStepDriver>();
services.AddDeployment<ContentDefinitionDeploymentSource, ContentDefinitionDeploymentStep, ContentDefinitionDeploymentStepDriver>();
services.AddDeployment<ReplaceContentDefinitionDeploymentSource, ReplaceContentDefinitionDeploymentStep, ReplaceContentDefinitionDeploymentStepDriver>();
services.AddDeployment<DeleteContentDefinitionDeploymentSource, DeleteContentDefinitionDeploymentStep, DeleteContentDefinitionDeploymentStepDriver>();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ public AddToDeploymentPlanStartup(IOptions<AdminOptions> adminOptions)

public override void ConfigureServices(IServiceCollection services)
{
services.AddTransient<IDeploymentSource, ContentItemDeploymentSource>();
services.AddSingleton<IDeploymentStepFactory>(new DeploymentStepFactory<ContentItemDeploymentStep>());
services.AddScoped<IDisplayDriver<DeploymentStep>, ContentItemDeploymentStepDriver>();
services.AddDeployment<ContentItemDeploymentSource, ContentItemDeploymentStep, ContentItemDeploymentStepDriver>();
services.AddScoped<IContentDisplayDriver, AddToDeploymentPlanContentDriver>();
services.AddScoped<IDisplayDriver<ContentOptionsViewModel>, AddToDeploymentPlanContentsAdminListDisplayDriver>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ public override void ConfigureServices(IServiceCollection services)

services.AddScoped<IDisplayDriver<ISite>, ExportContentToDeploymentTargetSettingsDisplayDriver>();

services.AddTransient<IDeploymentSource, ExportContentToDeploymentTargetDeploymentSource>();
services.AddSingleton<IDeploymentStepFactory>(new DeploymentStepFactory<ExportContentToDeploymentTargetDeploymentStep>());
services.AddScoped<IDisplayDriver<DeploymentStep>, ExportContentToDeploymentTargetDeploymentStepDriver>();
services.AddDeployment<ExportContentToDeploymentTargetDeploymentSource, ExportContentToDeploymentTargetDeploymentStep, ExportContentToDeploymentTargetDeploymentStepDriver>();

services.AddDataMigration<ExportContentToDeploymentTargetMigrations>();
services.AddScoped<IContentDisplayDriver, ExportContentToDeploymentTargetContentDriver>();
Expand Down
10 changes: 2 additions & 8 deletions src/OrchardCore.Modules/OrchardCore.Contents/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -317,14 +317,8 @@ public class DeploymentStartup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddTransient<IDeploymentSource, AllContentDeploymentSource>();
services.AddSingleton<IDeploymentStepFactory>(new DeploymentStepFactory<AllContentDeploymentStep>());
services.AddScoped<IDisplayDriver<DeploymentStep>, AllContentDeploymentStepDriver>();

services.AddTransient<IDeploymentSource, ContentDeploymentSource>();
services.AddSingleton<IDeploymentStepFactory>(new DeploymentStepFactory<ContentDeploymentStep>());
services.AddScoped<IDisplayDriver<DeploymentStep>, ContentDeploymentStepDriver>();

services.AddDeployment<AllContentDeploymentSource, AllContentDeploymentStep, AllContentDeploymentStepDriver>();
services.AddDeployment<ContentDeploymentSource, ContentDeploymentStep, ContentDeploymentStepDriver>();
services.AddSiteSettingsPropertyDeploymentStep<ContentAuditTrailSettings, DeploymentStartup>(S => S["Content Audit Trail settings"], S => S["Exports the content audit trail settings."]);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ public class DeploymentStartup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddTransient<IDeploymentSource, CustomSettingsDeploymentSource>();
services.AddSingleton<IDeploymentStepFactory>(new DeploymentStepFactory<CustomSettingsDeploymentStep>());
services.AddScoped<IDisplayDriver<DeploymentStep>, CustomSettingsDeploymentStepDriver>();
services.AddDeployment<CustomSettingsDeploymentSource, CustomSettingsDeploymentStep, CustomSettingsDeploymentStepDriver>();
}
}
}
16 changes: 4 additions & 12 deletions src/OrchardCore.Modules/OrchardCore.Deployment/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using OrchardCore.Deployment.Indexes;
using OrchardCore.Deployment.Recipes;
using OrchardCore.Deployment.Steps;
using OrchardCore.DisplayManagement.Handlers;
using OrchardCore.Modules;
using OrchardCore.Mvc.Core.Utilities;
using OrchardCore.Navigation;
Expand Down Expand Up @@ -40,13 +39,10 @@ public override void ConfigureServices(IServiceCollection services)
services.AddSingleton<IDeploymentTargetProvider, FileDownloadDeploymentTargetProvider>();

// Custom File deployment step
services.AddTransient<IDeploymentSource, CustomFileDeploymentSource>();
services.AddSingleton<IDeploymentStepFactory>(new DeploymentStepFactory<CustomFileDeploymentStep>());
services.AddScoped<IDisplayDriver<DeploymentStep>, CustomFileDeploymentStepDriver>();
services.AddDeployment<CustomFileDeploymentSource, CustomFileDeploymentStep, CustomFileDeploymentStepDriver>();

// Recipe File deployment step
services.AddSingleton<IDeploymentStepFactory>(new DeploymentStepFactory<RecipeFileDeploymentStep>());
services.AddScoped<IDisplayDriver<DeploymentStep>, RecipeFileDeploymentStepDriver>();
services.AddDeploymentWithoutSource<RecipeFileDeploymentStep, RecipeFileDeploymentStepDriver>();

services.AddIndexProvider<DeploymentPlanIndexProvider>();
services.AddDataMigration<Migrations>();
Expand All @@ -55,13 +51,9 @@ public override void ConfigureServices(IServiceCollection services)

services.AddRecipeExecutionStep<DeploymentPlansRecipeStep>();

services.AddTransient<IDeploymentSource, DeploymentPlanDeploymentSource>();
services.AddSingleton<IDeploymentStepFactory>(new DeploymentStepFactory<DeploymentPlanDeploymentStep>());
services.AddScoped<IDisplayDriver<DeploymentStep>, DeploymentPlanDeploymentStepDriver>();
services.AddDeployment<DeploymentPlanDeploymentSource, DeploymentPlanDeploymentStep, DeploymentPlanDeploymentStepDriver>();

services.AddTransient<IDeploymentSource, JsonRecipeDeploymentSource>();
services.AddSingleton<IDeploymentStepFactory>(new DeploymentStepFactory<JsonRecipeDeploymentStep>());
services.AddScoped<IDisplayDriver<DeploymentStep>, JsonRecipeDeploymentStepDriver>();
services.AddDeployment<JsonRecipeDeploymentSource, JsonRecipeDeploymentStep, JsonRecipeDeploymentStepDriver>();
}

public override void Configure(IApplicationBuilder app, IEndpointRouteBuilder routes, IServiceProvider serviceProvider)
Expand Down
4 changes: 1 addition & 3 deletions src/OrchardCore.Modules/OrchardCore.Facebook/StartupLogin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ public class DeploymentStartup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddScoped<IDisplayDriver<DeploymentStep>, FacebookLoginDeploymentStepDriver>();
services.AddTransient<IDeploymentSource, FacebookLoginDeploymentSource>();
services.AddSingleton<IDeploymentStepFactory, DeploymentStepFactory<FacebookLoginDeploymentStep>>();
services.AddDeployment<FacebookLoginDeploymentSource, FacebookLoginDeploymentStep, FacebookLoginDeploymentStepDriver>();
}
}
}
5 changes: 1 addition & 4 deletions src/OrchardCore.Modules/OrchardCore.Features/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using Microsoft.Extensions.Options;
using OrchardCore.Admin;
using OrchardCore.Deployment;
using OrchardCore.DisplayManagement.Handlers;
using OrchardCore.Environment.Shell.Configuration;
using OrchardCore.Features.Controllers;
using OrchardCore.Features.Deployment;
Expand Down Expand Up @@ -40,9 +39,7 @@ public override void ConfigureServices(IServiceCollection services)
services.AddScoped<IModuleService, ModuleService>();
services.AddScoped<INavigationProvider, AdminMenu>();

services.AddTransient<IDeploymentSource, AllFeaturesDeploymentSource>();
services.AddSingleton<IDeploymentStepFactory>(new DeploymentStepFactory<AllFeaturesDeploymentStep>());
services.AddScoped<IDisplayDriver<DeploymentStep>, AllFeaturesDeploymentStepDriver>();
services.AddDeployment<AllFeaturesDeploymentSource, AllFeaturesDeploymentStep, AllFeaturesDeploymentStepDriver>();
}

public override void Configure(IApplicationBuilder builder, IEndpointRouteBuilder routes, IServiceProvider serviceProvider)
Expand Down
5 changes: 1 addition & 4 deletions src/OrchardCore.Modules/OrchardCore.Layers/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@ public override void ConfigureServices(IServiceCollection services)
services.AddDataMigration<Migrations>();
services.AddScoped<IPermissionProvider, Permissions>();
services.AddRecipeExecutionStep<LayerStep>();

services.AddTransient<IDeploymentSource, AllLayersDeploymentSource>();
services.AddSingleton<IDeploymentStepFactory>(new DeploymentStepFactory<AllLayersDeploymentStep>());
services.AddScoped<IDisplayDriver<DeploymentStep>, AllLayersDeploymentStepDriver>();
services.AddDeployment<AllLayersDeploymentSource, AllLayersDeploymentStep, AllLayersDeploymentStepDriver>();
services.AddSingleton<IGlobalMethodProvider, DefaultLayersMethodProvider>();
}

Expand Down
10 changes: 2 additions & 8 deletions src/OrchardCore.Modules/OrchardCore.Media/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
using OrchardCore.ContentTypes.Editors;
using OrchardCore.Data.Migration;
using OrchardCore.Deployment;
using OrchardCore.DisplayManagement.Handlers;
using OrchardCore.DisplayManagement.Liquid.Tags;
using OrchardCore.Environment.Shell;
using OrchardCore.FileStorage;
Expand Down Expand Up @@ -389,13 +388,8 @@ public class DeploymentStartup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddTransient<IDeploymentSource, MediaDeploymentSource>();
services.AddSingleton<IDeploymentStepFactory>(new DeploymentStepFactory<MediaDeploymentStep>());
services.AddScoped<IDisplayDriver<DeploymentStep>, MediaDeploymentStepDriver>();

services.AddTransient<IDeploymentSource, AllMediaProfilesDeploymentSource>();
services.AddSingleton<IDeploymentStepFactory>(new DeploymentStepFactory<AllMediaProfilesDeploymentStep>());
services.AddScoped<IDisplayDriver<DeploymentStep>, AllMediaProfilesDeploymentStepDriver>();
services.AddDeployment<MediaDeploymentSource, MediaDeploymentStep, MediaDeploymentStepDriver>();
services.AddDeployment<AllMediaProfilesDeploymentSource, AllMediaProfilesDeploymentStep, AllMediaProfilesDeploymentStepDriver>();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ public class DeploymentStartup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddScoped<IDisplayDriver<DeploymentStep>, AzureADDeploymentStepDriver>();
services.AddTransient<IDeploymentSource, AzureADDeploymentSource>();
services.AddSingleton<IDeploymentStepFactory, DeploymentStepFactory<AzureADDeploymentStep>>();
services.AddDeployment<AzureADDeploymentSource, AzureADDeploymentStep, AzureADDeploymentStepDriver>();
}
}
}
8 changes: 2 additions & 6 deletions src/OrchardCore.Modules/OrchardCore.OpenId/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,7 @@ public class ServerDeploymentStartup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddScoped<IDisplayDriver<DeploymentStep>, OpenIdServerDeploymentStepDriver>();
services.AddTransient<IDeploymentSource, OpenIdServerDeploymentSource>();
services.AddSingleton<IDeploymentStepFactory, DeploymentStepFactory<OpenIdServerDeploymentStep>>();
services.AddDeployment<OpenIdServerDeploymentSource, OpenIdServerDeploymentStep, OpenIdServerDeploymentStepDriver>();
}
}

Expand Down Expand Up @@ -339,9 +337,7 @@ public class ValidationDeploymentStartup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddScoped<IDisplayDriver<DeploymentStep>, OpenIdValidationDeploymentStepDriver>();
services.AddTransient<IDeploymentSource, OpenIdValidationDeploymentSource>();
services.AddSingleton<IDeploymentStepFactory, DeploymentStepFactory<OpenIdValidationDeploymentStep>>();
services.AddDeployment<OpenIdValidationDeploymentSource, OpenIdValidationDeploymentStep, OpenIdValidationDeploymentStepDriver>();
}
}

Expand Down
5 changes: 1 addition & 4 deletions src/OrchardCore.Modules/OrchardCore.Placements/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using OrchardCore.ContentTypes.Editors;
using OrchardCore.Deployment;
using OrchardCore.DisplayManagement.Descriptors;
using OrchardCore.DisplayManagement.Handlers;
using OrchardCore.Modules;
using OrchardCore.Mvc.Core.Utilities;
using OrchardCore.Navigation;
Expand Down Expand Up @@ -98,9 +97,7 @@ public class DeploymentStartup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddTransient<IDeploymentSource, PlacementsDeploymentSource>();
services.AddSingleton<IDeploymentStepFactory>(new DeploymentStepFactory<PlacementsDeploymentStep>());
services.AddScoped<IDisplayDriver<DeploymentStep>, PlacementsDeploymentStepDriver>();
services.AddDeployment<PlacementsDeploymentSource, PlacementsDeploymentStep, PlacementsDeploymentStepDriver>();
}
}
}
10 changes: 2 additions & 8 deletions src/OrchardCore.Modules/OrchardCore.Queries/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,10 @@ public override void ConfigureServices(IServiceCollection services)
{
services.AddScoped<INavigationProvider, AdminMenu>();
services.AddScoped<IQueryManager, QueryManager>();

services.AddScoped<IDisplayDriver<Query>, QueryDisplayDriver>();
services.AddRecipeExecutionStep<QueryStep>();
services.AddScoped<IPermissionProvider, Permissions>();

services.AddTransient<IDeploymentSource, AllQueriesDeploymentSource>();
services.AddSingleton<IDeploymentStepFactory>(new DeploymentStepFactory<AllQueriesDeploymentStep>());
services.AddScoped<IDisplayDriver<DeploymentStep>, AllQueriesDeploymentStepDriver>();
services.AddDeployment<AllQueriesDeploymentSource, AllQueriesDeploymentStep, AllQueriesDeploymentStepDriver>();
services.AddSingleton<IGlobalMethodProvider, QueryGlobalMethodProvider>();

services.Configure<TemplateOptions>(o =>
Expand Down Expand Up @@ -110,9 +106,7 @@ public class DeploymentStartup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddTransient<IDeploymentSource, QueryBasedContentDeploymentSource>();
services.AddSingleton<IDeploymentStepFactory>(new DeploymentStepFactory<QueryBasedContentDeploymentStep>());
services.AddScoped<IDisplayDriver<DeploymentStep>, QueryBasedContentDeploymentStepDriver>();
services.AddDeployment<QueryBasedContentDeploymentSource, QueryBasedContentDeploymentStep, QueryBasedContentDeploymentStepDriver>();
}
}
}
5 changes: 1 addition & 4 deletions src/OrchardCore.Modules/OrchardCore.Roles/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using Microsoft.Extensions.Options;
using OrchardCore.Admin;
using OrchardCore.Deployment;
using OrchardCore.DisplayManagement.Handlers;
using OrchardCore.Environment.Shell;
using OrchardCore.Modules;
using OrchardCore.Mvc.Core.Utilities;
Expand Down Expand Up @@ -81,9 +80,7 @@ public class DeploymentStartup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddTransient<IDeploymentSource, AllRolesDeploymentSource>();
services.AddSingleton<IDeploymentStepFactory>(new DeploymentStepFactory<AllRolesDeploymentStep>());
services.AddScoped<IDisplayDriver<DeploymentStep>, AllRolesDeploymentStepDriver>();
services.AddDeployment<AllRolesDeploymentSource, AllRolesDeploymentStep, AllRolesDeploymentStepDriver>();
}
}

Expand Down
19 changes: 4 additions & 15 deletions src/OrchardCore.Modules/OrchardCore.Search.AzureAI/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,9 @@ public class DeploymentStartup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddTransient<IDeploymentSource, AzureAISearchIndexDeploymentSource>();
services.AddSingleton<IDeploymentStepFactory>(new DeploymentStepFactory<AzureAISearchIndexDeploymentStep>());
services.AddScoped<IDisplayDriver<DeploymentStep>, AzureAISearchIndexDeploymentStepDriver>();

services.AddTransient<IDeploymentSource, AzureAISearchSettingsDeploymentSource>();
services.AddSingleton<IDeploymentStepFactory>(new DeploymentStepFactory<AzureAISearchSettingsDeploymentStep>());
services.AddScoped<IDisplayDriver<DeploymentStep>, AzureAISearchSettingsDeploymentStepDriver>();

services.AddTransient<IDeploymentSource, AzureAISearchIndexRebuildDeploymentSource>();
services.AddSingleton<IDeploymentStepFactory>(new DeploymentStepFactory<AzureAISearchIndexRebuildDeploymentStep>());
services.AddScoped<IDisplayDriver<DeploymentStep>, AzureAISearchIndexRebuildDeploymentStepDriver>();

services.AddTransient<IDeploymentSource, AzureAISearchIndexResetDeploymentSource>();
services.AddSingleton<IDeploymentStepFactory>(new DeploymentStepFactory<AzureAISearchIndexResetDeploymentStep>());
services.AddScoped<IDisplayDriver<DeploymentStep>, AzureAISearchIndexResetDeploymentStepDriver>();
services.AddDeployment<AzureAISearchIndexDeploymentSource, AzureAISearchIndexDeploymentStep, AzureAISearchIndexDeploymentStepDriver>();
services.AddDeployment<AzureAISearchSettingsDeploymentSource, AzureAISearchSettingsDeploymentStep, AzureAISearchSettingsDeploymentStepDriver>();
services.AddDeployment<AzureAISearchIndexRebuildDeploymentSource, AzureAISearchIndexRebuildDeploymentStep, AzureAISearchIndexRebuildDeploymentStepDriver>();
services.AddDeployment<AzureAISearchIndexResetDeploymentSource, AzureAISearchIndexResetDeploymentStep, AzureAISearchIndexResetDeploymentStepDriver>();
}
}
Loading

0 comments on commit 1ac518d

Please sign in to comment.