Bootstrapping updates
This commit is contained in:
1
SVSim.Bootstrap/Data/cards.json
Normal file
1
SVSim.Bootstrap/Data/cards.json
Normal file
File diff suppressed because one or more lines are too long
@@ -88,7 +88,6 @@ public static class Program
|
|||||||
|
|
||||||
private static BootstrapOptions? ParseArgs(string[] args)
|
private static BootstrapOptions? ParseArgs(string[] args)
|
||||||
{
|
{
|
||||||
string? dataDir = null;
|
|
||||||
string? cards = null;
|
string? cards = null;
|
||||||
string? captures = null;
|
string? captures = null;
|
||||||
string? referenceDataDir = null;
|
string? referenceDataDir = null;
|
||||||
@@ -103,7 +102,6 @@ public static class Program
|
|||||||
string a = args[i];
|
string a = args[i];
|
||||||
switch (a)
|
switch (a)
|
||||||
{
|
{
|
||||||
case "--data-dir": dataDir = NextArg(args, ref i); break;
|
|
||||||
case "--cards": cards = NextArg(args, ref i); break;
|
case "--cards": cards = NextArg(args, ref i); break;
|
||||||
case "--captures": captures = NextArg(args, ref i); break;
|
case "--captures": captures = NextArg(args, ref i); break;
|
||||||
case "--reference-data-dir": referenceDataDir = NextArg(args, ref i); break;
|
case "--reference-data-dir": referenceDataDir = NextArg(args, ref i); break;
|
||||||
@@ -120,28 +118,16 @@ public static class Program
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolution order:
|
// All bootstrap inputs ship in-project under SVSim.Bootstrap/Data/, copied next to the
|
||||||
// --cards beats --data-dir/cards.json beats legacy positional;
|
// binary on build. The --cards/--captures/--reference-data-dir flags are ad-hoc overrides
|
||||||
// --captures beats --data-dir/prod-captures beats Bootstrap/Data/prod-captures (shipped default);
|
// (e.g. point at a fresh loader dump before promoting it into the project).
|
||||||
// --reference-data-dir beats shipped Bootstrap/Data (the CSVs always ship next to the binary).
|
|
||||||
string baseDir = AppContext.BaseDirectory;
|
string baseDir = AppContext.BaseDirectory;
|
||||||
string shippedDataDir = Path.Combine(baseDir, "Data");
|
string shippedDataDir = Path.Combine(baseDir, "Data");
|
||||||
string shippedCaptures = Path.Combine(shippedDataDir, "prod-captures");
|
string shippedCaptures = Path.Combine(shippedDataDir, "prod-captures");
|
||||||
|
string shippedCardsFile = Path.Combine(shippedDataDir, "cards.json");
|
||||||
|
|
||||||
string cardsFile = cards
|
string cardsFile = cards ?? positionalCards ?? shippedCardsFile;
|
||||||
?? (dataDir is not null ? Path.Combine(dataDir, "cards.json") : null)
|
string capturesDir = captures ?? shippedCaptures;
|
||||||
?? positionalCards
|
|
||||||
?? "data_dumps/cards.json";
|
|
||||||
|
|
||||||
// Resolve captures dir, falling back to the shipped copy if the data-dir path is unset
|
|
||||||
// OR points at a missing folder. (Common case: user has cards.json in data_dumps/ but
|
|
||||||
// hasn't copied prod-captures/ there — the shipped snapshot is the source of truth.)
|
|
||||||
string? capturesCandidate = captures
|
|
||||||
?? (dataDir is not null ? Path.Combine(dataDir, "prod-captures") : null);
|
|
||||||
string capturesDir = capturesCandidate is not null && Directory.Exists(capturesCandidate)
|
|
||||||
? capturesCandidate
|
|
||||||
: shippedCaptures;
|
|
||||||
|
|
||||||
string refDir = referenceDataDir ?? shippedDataDir;
|
string refDir = referenceDataDir ?? shippedDataDir;
|
||||||
|
|
||||||
string connStr = connection
|
string connStr = connection
|
||||||
@@ -166,13 +152,14 @@ public static class Program
|
|||||||
Console.Error.WriteLine(
|
Console.Error.WriteLine(
|
||||||
"Usage: svsim-bootstrap [options]\n" +
|
"Usage: svsim-bootstrap [options]\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
" --data-dir <path> Directory containing cards.json and prod-captures/\n" +
|
" All inputs default to the in-project SVSim.Bootstrap/Data/ folder, copied next to\n" +
|
||||||
" (default: ./data_dumps relative to working dir)\n" +
|
" the binary at build time. Override flags below take ad-hoc paths (e.g. a fresh\n" +
|
||||||
" --cards <file> Override path to cards.json\n" +
|
" loader dump) — promote into Data/ when you're ready to make it permanent.\n" +
|
||||||
|
"\n" +
|
||||||
|
" --cards <file> Override path to cards.json (default: shipped Data/cards.json)\n" +
|
||||||
" --captures <dir> Override path to prod-captures directory\n" +
|
" --captures <dir> Override path to prod-captures directory\n" +
|
||||||
" (default: shipped Data/prod-captures next to the binary)\n" +
|
" (default: shipped Data/prod-captures)\n" +
|
||||||
" --reference-data-dir <dir> Override reference CSV directory\n" +
|
" --reference-data-dir <dir> Override reference CSV directory (default: shipped Data/)\n" +
|
||||||
" (default: shipped Data/ next to the binary)\n" +
|
|
||||||
" --connection-string <conn> Postgres connection (or NPGSQL_CONNECTION env var,\n" +
|
" --connection-string <conn> Postgres connection (or NPGSQL_CONNECTION env var,\n" +
|
||||||
$" then \"{DefaultConnectionString}\")\n" +
|
$" then \"{DefaultConnectionString}\")\n" +
|
||||||
" --skip-reference Skip reference-data import (classes, sleeves, ranks, ...)\n" +
|
" --skip-reference Skip reference-data import (classes, sleeves, ranks, ...)\n" +
|
||||||
|
|||||||
@@ -16,6 +16,11 @@
|
|||||||
<Content Include="Data\*.csv">
|
<Content Include="Data\*.csv">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<!-- cards.json is the loader-captured card master (~30 MB). Lives in-project so the
|
||||||
|
bootstrapper is self-contained; refresh by copying a newer dump over the file. -->
|
||||||
|
<Content Include="Data\cards.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user