diff --git a/.vscode/tasks.json b/.vscode/tasks.json index a5ec1f4..457b408 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -88,6 +88,72 @@ ], "problemMatcher": "$msCompile" }, + { + "label": "dockerLogin", + "command": "docker", + "type": "process", + "args": [ + "login", + "gitea.phares.duckdns.org:443" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "dockerBuild", + "command": "docker", + "type": "process", + "args": [ + "build", + "-t", + "kanbn-to-quartz" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "dockerImageList", + "command": "docker", + "type": "process", + "args": [ + "image", + "ls" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "dockerRun", + "command": "docker", + "type": "process", + "args": [ + "run", + "-p", + "5001:5001", + "--name", + "kanbn-to-quartz-api-001", + "cb5bbb2e84e7" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "dockerTag", + "command": "docker", + "type": "process", + "args": [ + "tag", + "b84c1f73de01", + "gitea.phares.duckdns.org:443/phares3757/kanbn-to-quartz:latest" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "dockerPush", + "command": "docker", + "type": "process", + "args": [ + "push", + "gitea.phares.duckdns.org:443/phares3757/kanbn-to-quartz:latest" + ], + "problemMatcher": "$msCompile" + }, { "label": "Publish AOT", "command": "dotnet", diff --git a/Dockerfile b/Dockerfile index 6b7811c..234a222 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,8 +23,3 @@ EXPOSE 5001 WORKDIR /app COPY --from=publish /app/publish . ENTRYPOINT [ "dotnet", "KanbnToQuartz.dll" ] - -# docker build -t sprint-console-001 . -# docker images ls | grep -i 001 -# docker run -p 5001:5001 --name sprint-console-api-001 sprint-console-001 -# docker run -p 5001:5001 --name sprint-console-api-001 sprint-console-001 \ No newline at end of file diff --git a/src/KanbnToQuartz/Models/AppSettings.cs b/src/KanbnToQuartz/Models/AppSettings.cs index dcbf63d..cbf54bb 100644 --- a/src/KanbnToQuartz/Models/AppSettings.cs +++ b/src/KanbnToQuartz/Models/AppSettings.cs @@ -6,6 +6,7 @@ namespace KanbnToQuartz.Models; public record AppSettings(string Company, string Destination, string DirectoryFindReplace, + string DirectoryBFindReplace, string FileFindReplace, string Source, string TextBFindReplace, diff --git a/src/KanbnToQuartz/Services/CopyService.cs b/src/KanbnToQuartz/Services/CopyService.cs index c19954d..d7457a0 100644 --- a/src/KanbnToQuartz/Services/CopyService.cs +++ b/src/KanbnToQuartz/Services/CopyService.cs @@ -18,6 +18,7 @@ public class CopyService List results = []; string path; string fileB; + string pathB; string textB; string? text; Record record; @@ -37,6 +38,7 @@ public class CopyService string sourceDirectoryName = Path.GetDirectoryName(sourceDirectory); string destinationDirectory = Path.GetFullPath(appSettings.Destination); string[] directoryFindReplace = appSettings.DirectoryFindReplace.Split('|'); + string[] directoryBFindReplace = appSettings.DirectoryBFindReplace.Split('|'); string[] files = Directory.GetFiles(sourceDirectory, "*", SearchOption.AllDirectories); int sourceDirectoryLength = sourceDirectory.Length; foreach (string file in files) @@ -56,8 +58,9 @@ public class CopyService if (!lines[i].StartsWith(textBFindReplace)) continue; path = lines[i].Substring(textBFindReplace.Length, lines[i].Length - 1 - textBFindReplace.Length); - pathName = Path.GetFileName(path); - relativePath = Path.GetRelativePath(sourceDirectoryName, path); + pathB = string.IsNullOrEmpty(directoryBFindReplace[0]) ? path : path.Replace(directoryBFindReplace[0], directoryBFindReplace[1]); + pathName = Path.GetFileName(pathB); + relativePath = Path.GetRelativePath(sourceDirectoryName, pathB); lines[i] = $"- [{pathName}]({relativePath})"; } textB = string.Join(Environment.NewLine, lines);