Skip to content

Commit cb34275

Browse files
authored
Renames project to ExtensibleDataPipeline (#10)
* rename ExtensibleMessageBroker to ExtensibleDataPipeline * Renames solution to Edp Refactors the solution, projects, and namespaces from 'Emb' to 'Edp' to align with the new project naming convention. This change ensures consistency across the codebase and improves maintainability. fix * Renames solution in README files. Updates README files to reflect the solution's rename, ensuring accurate naming and branding across the documentation. This change aligns the README with the new project name. * Updates project references and names Renames project-related variables and references in the release workflow file to reflect the renaming of the solution from ExtensibleMessageBroker to ExtensibleDataPipeline. This ensures that the CI/CD pipeline uses the correct project paths and file prefixes for building and releasing the application. It also updates the checkout and upload-artifact actions to newer versions. * enable NRT, fix xmlns, dispose objects * fix warnings
1 parent 4bdf9f1 commit cb34275

File tree

163 files changed

+408
-474
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+408
-474
lines changed

.github/workflows/release.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ on:
99
name: release
1010

1111
env:
12-
PROJECT_DIR: ./Emb.Cli.NetCore
13-
PROJECT_PATH: ./Emb.Cli.NetCore/Emb.Cli.NetCore.csproj
12+
PROJECT_DIR: ./Edp.Cli.NetCore
13+
PROJECT_PATH: ./Edp.Cli.NetCore/Edp.Cli.NetCore.csproj
1414
FRAMEWORK: net10.0
1515
SELF_CONTAINED: true
16-
FILE_PREFIX: ExtensibleMessageBroker_
16+
FILE_PREFIX: ExtensibleDataPipeline_
1717

1818
jobs:
1919
build:
@@ -31,12 +31,12 @@ jobs:
3131

3232
steps:
3333
- name: Checkout
34-
uses: actions/checkout@v4
34+
uses: actions/checkout@v6
3535
with:
3636
fetch-depth: 0
3737

3838
- name: Install .NET
39-
uses: actions/setup-dotnet@v4
39+
uses: actions/setup-dotnet@v5
4040
with:
4141
dotnet-version: '10.0.x'
4242

@@ -79,7 +79,7 @@ jobs:
7979
echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_OUTPUT
8080
8181
- name: Upload artifact
82-
uses: actions/upload-artifact@v4
82+
uses: actions/upload-artifact@v5
8383
with:
8484
name: ${{ steps.build_package.outputs.ZIP_NAME }}
8585
path: ${{ env.PROJECT_DIR }}/${{ steps.build_package.outputs.ZIP_NAME }}
@@ -90,7 +90,7 @@ jobs:
9090
needs: build
9191
steps:
9292
- name: Download artifacts
93-
uses: actions/download-artifact@v4
93+
uses: actions/download-artifact@v6
9494
with:
9595
path: ./artifacts
9696

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using CommandLine;
2+
3+
namespace Edp.Cli.NetCore;
4+
5+
public class CommandLineOptions
6+
{
7+
[Option('s', "schema", Required = false, HelpText = @"Generate JSON Schemas for all configuration types", Default = false)]
8+
public bool GenerateSchema { get; set; }
9+
10+
[Option('d', "directory", Required = false, HelpText = @"JSON Schemas directory path")]
11+
public string? Directory { get; set; }
12+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using System;
2+
using System.IO;
3+
using System.Reflection;
4+
using Edp.Core.Constants;
5+
using Edp.Core.Models;
6+
using Edp.Core.Services;
7+
using Microsoft.Extensions.Configuration;
8+
using Microsoft.Extensions.DependencyInjection;
9+
using Microsoft.Extensions.Logging;
10+
using Newtonsoft.Json.Schema.Generation;
11+
12+
namespace Edp.Cli.NetCore.DependencyInjection;
13+
14+
public static class ContainerConfiguration
15+
{
16+
private static ILoggerFactory CreateLoggerFactory(ApplicationSettings applicationSettings)
17+
{
18+
var logPath = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location) ?? throw new InvalidOperationException(), applicationSettings.LogDirectoryName, "log-{Date}.txt");
19+
var loggerFactory = LoggerFactory.Create(builder => builder
20+
.AddConsole()
21+
.AddFile(logPath, applicationSettings.LogLevel, retainedFileCountLimit: 10)
22+
);
23+
return loggerFactory;
24+
}
25+
26+
public static void ConfigureServices(IServiceCollection services, IConfigurationRoot configurationRoot)
27+
{
28+
var applicationSettings = configurationRoot
29+
.GetRequiredSection(Defaults.ConfigurationSectionName)
30+
.Get<ApplicationSettings>() ?? throw new InvalidOperationException("Cannot load application settings from configuration.");
31+
32+
services
33+
.AddSingleton(configurationRoot)
34+
.AddSingleton(applicationSettings)
35+
.AddScoped<ILoggerFactory>(c => CreateLoggerFactory(applicationSettings))
36+
.AddScoped<JSchemaGenerator>()
37+
.AddScoped<IPluginManager, PluginManager>()
38+
.AddScoped<DataPipelineService>();
39+
}
40+
}
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
55
<TargetFramework>net10.0</TargetFramework>
6+
<Nullable>enable</Nullable>
67
</PropertyGroup>
78

89
<ItemGroup>
@@ -15,13 +16,13 @@
1516
</ItemGroup>
1617

1718
<ItemGroup>
18-
<ProjectReference Include="..\Emb.Core\Emb.Core.csproj" />
19-
<ProjectReference Include="..\Emb.DataSourceProvider.DvachPost\Emb.DataSourceProvider.DvachPost.csproj" />
20-
<ProjectReference Include="..\Emb.DataSourceProvider.DvachThread\Emb.DataSourceProvider.DvachThread.csproj" />
21-
<ProjectReference Include="..\Emb.DataSourceProvider.TelegramChannel\Emb.DataSourceProvider.TelegramChannel.csproj" />
22-
<ProjectReference Include="..\Emb.DataSourceProvider.VkFeed\Emb.DataSourceProvider.VkFeed.csproj" />
23-
<ProjectReference Include="..\Emb.TargetProvider.File\Emb.TargetProvider.File.csproj" />
24-
<ProjectReference Include="..\Emb.TargetProvider.Telegram\Emb.TargetProvider.Telegram.csproj" />
19+
<ProjectReference Include="..\Edp.Core\Edp.Core.csproj" />
20+
<ProjectReference Include="..\Edp.DataSourceProvider.DvachPost\Edp.DataSourceProvider.DvachPost.csproj" />
21+
<ProjectReference Include="..\Edp.DataSourceProvider.DvachThread\Edp.DataSourceProvider.DvachThread.csproj" />
22+
<ProjectReference Include="..\Edp.DataSourceProvider.TelegramChannel\Edp.DataSourceProvider.TelegramChannel.csproj" />
23+
<ProjectReference Include="..\Edp.DataSourceProvider.VkFeed\Edp.DataSourceProvider.VkFeed.csproj" />
24+
<ProjectReference Include="..\Edp.TargetProvider.File\Edp.TargetProvider.File.csproj" />
25+
<ProjectReference Include="..\Edp.TargetProvider.Telegram\Edp.TargetProvider.Telegram.csproj" />
2526
</ItemGroup>
2627

2728
<ItemGroup>

Edp.Cli.NetCore/Program.cs

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Reflection;
5+
using System.Threading;
6+
using System.Threading.Tasks;
7+
using CommandLine;
8+
using Edp.Cli.NetCore.DependencyInjection;
9+
using Edp.Core.Constants;
10+
using Edp.Core.Models;
11+
using Edp.Core.Services;
12+
using Microsoft.Extensions.Configuration;
13+
using Microsoft.Extensions.DependencyInjection;
14+
15+
namespace Edp.Cli.NetCore;
16+
17+
internal static class Program
18+
{
19+
// see: https://docs.microsoft.com/en-us/windows/desktop/Debug/system-error-codes
20+
private const int Success = 0;
21+
private const int ErrorBadArguments = 160;
22+
23+
private static readonly CancellationTokenSource CancelTokenSource = new();
24+
25+
private static IConfigurationRoot GetConfigurationRoot()
26+
{
27+
var currentDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location) ?? Directory.GetCurrentDirectory();
28+
var configurationBuilder = new ConfigurationBuilder()
29+
.SetBasePath(currentDirectory)
30+
.AddJsonFile(Defaults.ConfigurationFileName);
31+
var configurationRoot = configurationBuilder.Build();
32+
return configurationRoot;
33+
}
34+
35+
private static ServiceProvider CreateServiceProvider(IConfigurationRoot configurationRoot)
36+
{
37+
var serviceCollection = new ServiceCollection();
38+
ContainerConfiguration.ConfigureServices(serviceCollection, configurationRoot);
39+
var serviceProvider = serviceCollection.BuildServiceProvider();
40+
return serviceProvider;
41+
}
42+
43+
private static async Task<int> OnParsedAsync(CommandLineOptions commandLineOptions)
44+
{
45+
var configurationRoot = GetConfigurationRoot();
46+
var serviceProvider = CreateServiceProvider(configurationRoot);
47+
var applicationSettings = configurationRoot
48+
.GetRequiredSection(Defaults.ConfigurationSectionName)
49+
.Get<ApplicationSettings>() ?? throw new InvalidOperationException("Cannot load application settings from configuration.");
50+
var dataPipelineService = serviceProvider.GetRequiredService<DataPipelineService>();
51+
52+
var cancellationToken = CancelTokenSource.Token;
53+
Console.CancelKeyPress += (_, a) =>
54+
{
55+
CancelTokenSource.Cancel();
56+
a.Cancel = true;
57+
};
58+
59+
if (commandLineOptions.GenerateSchema)
60+
{
61+
string jsonSchemasDirectory;
62+
if (string.IsNullOrWhiteSpace(commandLineOptions.Directory))
63+
{
64+
jsonSchemasDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location) ?? Directory.GetCurrentDirectory();
65+
}
66+
else
67+
{
68+
Directory.CreateDirectory(commandLineOptions.Directory);
69+
jsonSchemasDirectory = commandLineOptions.Directory;
70+
}
71+
dataPipelineService.GenerateJsonSchemas(jsonSchemasDirectory);
72+
}
73+
else
74+
{
75+
await dataPipelineService.RunOnceAsync(applicationSettings.DataFlows, cancellationToken);
76+
}
77+
78+
return Success;
79+
}
80+
81+
private static Task<int> OnNotParsed(IEnumerable<Error> errors)
82+
{
83+
return Task.FromResult(ErrorBadArguments);
84+
}
85+
86+
private static async Task<int> Main(string[] args)
87+
{
88+
using var parser = new Parser(settings =>
89+
{
90+
settings.CaseSensitive = true;
91+
settings.IgnoreUnknownArguments = false;
92+
settings.HelpWriter = Console.Error;
93+
});
94+
var exitCode = await parser.ParseArguments<CommandLineOptions>(args)
95+
.MapResult(OnParsedAsync, OnNotParsed);
96+
return exitCode;
97+
}
98+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"EmbConfiguration": {
2+
"AppConfiguration": {
33
"DataFlows": [
44
{
55
"Name": "2ch_b_to_file",
@@ -68,4 +68,4 @@
6868
"RetryCount": 3,
6969
"DelayMilliseconds": 1000
7070
}
71-
}
71+
}

Emb.Common/Abstractions/IDataFetchResult.cs renamed to Edp.Common/Abstractions/IDataFetchResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Collections.Generic;
22

3-
namespace Emb.Common.Abstractions
3+
namespace Edp.Common.Abstractions
44
{
55
public interface IDataFetchResult
66
{

Emb.Common/Abstractions/IDataSourceProvider.cs renamed to Edp.Common/Abstractions/IDataSourceProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using Microsoft.Extensions.Configuration;
55
using Microsoft.Extensions.Logging;
66

7-
namespace Emb.Common.Abstractions
7+
namespace Edp.Common.Abstractions
88
{
99
public interface IDataSourceProvider
1010
{
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Emb.Common.Abstractions
1+
namespace Edp.Common.Abstractions
22
{
33
public interface IEndpointInfo
44
{

Emb.Common/Abstractions/ITargetProvider.cs renamed to Edp.Common/Abstractions/ITargetProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using Microsoft.Extensions.Configuration;
55
using Microsoft.Extensions.Logging;
66

7-
namespace Emb.Common.Abstractions
7+
namespace Edp.Common.Abstractions
88
{
99
public interface ITargetProvider
1010
{

0 commit comments

Comments
 (0)