-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the ability to upload using a folder and not just Git
- Loading branch information
Showing
14 changed files
with
187 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,6 @@ namespace kickflip.Enums; | |
public enum FindMode | ||
{ | ||
Tags, | ||
GitHubMergePR | ||
GitHubMergePR, | ||
Folder | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace kickflip.Enums; | ||
|
||
public enum Source | ||
{ | ||
Git, | ||
Folder | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ public enum DeploymentAction | |
{ | ||
Add, | ||
Modify, | ||
AddOrModify, | ||
Delete, | ||
Ignore | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,5 @@ | ||
namespace kickflip.Models; | ||
using kickflip.Enums; | ||
|
||
public class DeploymentChange | ||
{ | ||
public DeploymentChange(DeploymentAction action, string path) | ||
{ | ||
Action = action; | ||
Path = path; | ||
} | ||
namespace kickflip.Models; | ||
|
||
public DeploymentAction Action { get; } | ||
public string Path { get; } | ||
} | ||
public record DeploymentChange(DeploymentAction Action, Source Source, string Path, string DeploymentPath); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using kickflip.Enums; | ||
|
||
namespace kickflip.Services; | ||
|
||
public class FileSystemService(IgnoreService ignoreService) | ||
{ | ||
/// <summary> | ||
/// Gets all the files in the specified directory (minus any ignored files) and returns them as a list of deployment changes. | ||
/// </summary> | ||
public List<DeploymentChange> GetChanges(string localPath, string deploymentPath) | ||
{ | ||
var changes = new List<DeploymentChange>(); | ||
|
||
// Check path is valid and a directory | ||
if (!Directory.Exists(localPath)) | ||
{ | ||
throw new DirectoryNotFoundException($"The specified path does not exist: {localPath}"); | ||
} | ||
|
||
// Get all files in the directory | ||
var files = Directory.GetFiles(localPath, "*", SearchOption.AllDirectories); | ||
|
||
// Filter out ignored files, add the rest to the list of changes | ||
foreach (string file in files) | ||
{ | ||
var relativePath = file.Replace(localPath, string.Empty).TrimStart(Path.DirectorySeparatorChar); | ||
if (ignoreService.IsIgnored(relativePath)) | ||
{ | ||
changes.Add(new DeploymentChange(DeploymentAction.Ignore, Source.Folder, relativePath, "")); | ||
continue; | ||
} | ||
|
||
var deploymentFilePath = Utilities.UrlCombine(deploymentPath, relativePath); | ||
changes.Add(new DeploymentChange(DeploymentAction.AddOrModify, Source.Folder, relativePath, deploymentFilePath)); | ||
} | ||
|
||
return changes; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.