Compare commits

...

2 Commits

Author SHA1 Message Date
c64143f320 Inner links 2025-02-02 14:12:21 -07:00
3c4e465084 Docker commands 2025-01-30 19:41:15 -07:00
5 changed files with 103 additions and 10 deletions

2
.gitignore vendored
View File

@ -335,3 +335,5 @@ ASALocalRun/
.vscode/.UserSecrets/secrets.json
.vscode/jsonl/*
.vscode/.year-season-source
.vscode/.year-season-destination

67
.vscode/tasks.json vendored
View File

@ -88,6 +88,73 @@
],
"problemMatcher": "$msCompile"
},
{
"label": "podmanLogin",
"command": "podman",
"type": "process",
"args": [
"login",
"gitea.phares.duckdns.org:443"
],
"problemMatcher": "$msCompile"
},
{
"label": "podmanBuild",
"command": "podman",
"type": "process",
"args": [
"build",
"-t",
"kanbn-to-quartz",
"."
],
"problemMatcher": "$msCompile"
},
{
"label": "podmanImageList",
"command": "podman",
"type": "process",
"args": [
"image",
"ls"
],
"problemMatcher": "$msCompile"
},
{
"label": "podmanRun",
"command": "podman",
"type": "process",
"args": [
"run",
"-p",
"5001:5001",
"--name",
"kanbn-to-quartz-api-001",
"a3de856b5731"
],
"problemMatcher": "$msCompile"
},
{
"label": "podmanTag",
"command": "podman",
"type": "process",
"args": [
"tag",
"a3de856b5731",
"gitea.phares.duckdns.org:443/phares3757/kanbn-to-quartz:latest"
],
"problemMatcher": "$msCompile"
},
{
"label": "podmanPush",
"command": "podman",
"type": "process",
"args": [
"push",
"gitea.phares.duckdns.org:443/phares3757/kanbn-to-quartz:latest"
],
"problemMatcher": "$msCompile"
},
{
"label": "Publish AOT",
"command": "dotnet",

View File

@ -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

View File

@ -6,6 +6,7 @@ namespace KanbnToQuartz.Models;
public record AppSettings(string Company,
string Destination,
string DirectoryFindReplace,
string DirectoryBFindReplace,
string FileFindReplace,
string Source,
string TextBFindReplace,

View File

@ -18,6 +18,9 @@ public class CopyService
List<Record> results = [];
string path;
string fileB;
string pathB;
string pathC;
string pathD;
string textB;
string? text;
Record record;
@ -25,6 +28,7 @@ public class CopyService
string[] lines;
string pathName;
string directory;
string[] segments;
string destination;
string relativePath;
string directoryName;
@ -37,6 +41,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)
@ -53,12 +58,33 @@ public class CopyService
relativeDirectory = Path.GetRelativePath(sourceDirectoryName, directoryName);
for (int i = 0; i < lines.Length; i++)
{
if (!lines[i].StartsWith(textBFindReplace))
if (!lines[i].Contains(textBFindReplace))
continue;
path = lines[i].Substring(textBFindReplace.Length, lines[i].Length - 1 - textBFindReplace.Length);
pathName = Path.GetFileName(path);
relativePath = Path.GetRelativePath(sourceDirectoryName, path);
lines[i] = $"- [{pathName}]({relativePath})";
if (!lines[i].EndsWith(')') && !lines[i].EndsWith(")~~"))
continue;
if (lines[i].StartsWith(textBFindReplace))
path = lines[i].Substring(textBFindReplace.Length, lines[i].Length - 1 - textBFindReplace.Length);
else
{
segments = lines[i].Split("~~");
if (segments.Length < 2 || !segments[1].StartsWith(textBFindReplace))
continue;
path = segments[1].Substring(textBFindReplace.Length, segments[1].Length - 1 - textBFindReplace.Length);
}
if (string.IsNullOrEmpty(directoryBFindReplace[0]))
{
pathD = path;
pathName = Path.GetFileName(path);
}
else
{
pathB = path.Replace(directoryBFindReplace[0], directoryBFindReplace[1]);
pathC = directoryBFindReplace[1][0] != '/' ? pathB : pathB.Replace('\\', '/');
pathName = Path.GetFileName(pathC);
pathD = $"{pathC}{directoryFindReplace[1]}{pathName}";
}
relativePath = Path.GetRelativePath(sourceDirectoryName, pathD);
lines[i] = lines[i].Replace($"{textBFindReplace}{path}", $"- [{pathName}]({relativePath}");
}
textB = string.Join(Environment.NewLine, lines);
text = textB.Replace(textFindReplace[0], textFindReplace[1].Replace("%", relativeDirectory));
@ -88,6 +114,8 @@ public class CopyService
public void CopyDirectory()
{
if (!Directory.Exists(_AppSettings.Source))
_ = Directory.CreateDirectory(_AppSettings.Source);
if (Directory.Exists(_AppSettings.Destination))
Directory.Delete(_AppSettings.Destination, recursive: true);
ReadOnlyCollection<Record> records = GetRecords(_AppSettings);