mirror of
https://github.com/FalloutCollaborationProject/FCP-Mod-Updater.git
synced 2026-07-27 17:04:05 -07:00
GetUpdateableMods made and public for testing
This commit is contained in:
@@ -11,6 +11,9 @@ namespace FCPModUpdater.Commands;
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class UpdateCommand : AsyncCommand<ModPathSettings>
|
public class UpdateCommand : AsyncCommand<ModPathSettings>
|
||||||
{
|
{
|
||||||
|
public static IReadOnlyList<InstalledMod> GetUpdateableMods(IReadOnlyList<InstalledMod> mods)
|
||||||
|
=> mods.Where(m => m.Source == ModSource.Git && m.Status == ModStatus.Behind).ToList();
|
||||||
|
|
||||||
public override async Task<int> ExecuteAsync(CommandContext context, ModPathSettings settings,
|
public override async Task<int> ExecuteAsync(CommandContext context, ModPathSettings settings,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
@@ -41,9 +44,7 @@ public class UpdateCommand : AsyncCommand<ModPathSettings>
|
|||||||
async () => await modDiscoveryService.DiscoverModsAsync(modsDirectory, ct: cancellationToken));
|
async () => await modDiscoveryService.DiscoverModsAsync(modsDirectory, ct: cancellationToken));
|
||||||
|
|
||||||
// Find updateable mods
|
// Find updateable mods
|
||||||
var updateableMods = mods
|
var updateableMods = GetUpdateableMods(mods);
|
||||||
.Where(m => m.Source == ModSource.Git && m.Status == ModStatus.Behind)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
if (updateableMods.Count == 0)
|
if (updateableMods.Count == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ public partial class GitService : IGitService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IReadOnlyList<GitCommitInfo> ParseCommitLog(string output)
|
internal static IReadOnlyList<GitCommitInfo> ParseCommitLog(string output)
|
||||||
{
|
{
|
||||||
var commits = new List<GitCommitInfo>();
|
var commits = new List<GitCommitInfo>();
|
||||||
var entries = output.Split("---", StringSplitOptions.RemoveEmptyEntries);
|
var entries = output.Split("---", StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ public class ModDiscoveryService : IModDiscoveryService
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tries to match a folder name to an org repo, accounting for GitHub ZIP download suffixes like -main, -master.
|
/// Tries to match a folder name to an org repo, accounting for GitHub ZIP download suffixes like -main, -master.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static string? MatchRepoName(string folderName, HashSet<string> orgRepoNames)
|
internal static string? MatchRepoName(string folderName, HashSet<string> orgRepoNames)
|
||||||
{
|
{
|
||||||
// Direct match
|
// Direct match
|
||||||
if (orgRepoNames.Contains(folderName))
|
if (orgRepoNames.Contains(folderName))
|
||||||
@@ -191,7 +191,7 @@ public class ModDiscoveryService : IModDiscoveryService
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ModStatus DetermineStatus(int behind, int ahead, bool hasLocalChanges, string? branch)
|
internal static ModStatus DetermineStatus(int behind, int ahead, bool hasLocalChanges, string? branch)
|
||||||
{
|
{
|
||||||
if (branch == null)
|
if (branch == null)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-2
@@ -29,7 +29,6 @@
|
|||||||
"Spectre.Console": "0.53.1"
|
"Spectre.Console": "0.53.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"net10.0/linux-x64": {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user