This pull request introduces two new commands to the bundle server CLI: list and repair. The list command lists the route and remote URL pairs for each route active within the bundle server. It is implemented by the first three commits:
Commit 1 adds a missing mock method for GitHelper
Commit 2 adds a new method to GitHelper to retrieve the origin remote URL
Commit 3 implements the list command, including documentation
The repair command is meant to be a general-purpose tool for keeping the bundle server internally consistent. The first subcommand (implemented here) is the routes option, which checks the repo content in the reporoot directory and compares it to the routes file. The remaining commits implement it:
Commit 4 removes an unused function mock
Commit 5 adds a FileSystem helper function for recursively listing directory contents
Commit 6 replaces any remaining manual path concatenations associated with RepoProvider with filepath.Joins
Commit 7 adds a RepoProvider function for getting the repo content that exists at reporoot (independent of the routes file)
Commit 8 makes the method to write the routes file accessible to external packages
Commit 9 implements the repair routes command, including documentation and two options (--dry-run and --start-all)
Future work
There's lots of room for future improvement on these commands/things related to them, including:
adding an option to have list include the "inactive" repos not in the routes file
adding an --all option to start or stop to enable or disable all repos in the server at once
adding a --cleanup flag to repair routes to delete files that aren't part of a valid repository in the reporoot
adding more subcommands to repair, such as bundle (to correct the bundle list(s))
store all repos tracked by the bundle server in the routes file, each having an Active boolean flag to indicate active status
Part of #35
Summary
This pull request introduces two new commands to the bundle server CLI:
list
andrepair
. Thelist
command lists the route and remote URL pairs for each route active within the bundle server. It is implemented by the first three commits:GitHelper
GitHelper
to retrieve theorigin
remote URLlist
command, including documentationThe
repair
command is meant to be a general-purpose tool for keeping the bundle server internally consistent. The first subcommand (implemented here) is theroutes
option, which checks the repo content in thereporoot
directory and compares it to theroutes
file. The remaining commits implement it:FileSystem
helper function for recursively listing directory contentsRepoProvider
withfilepath.Join
sRepoProvider
function for getting the repo content that exists atreporoot
(independent of theroutes
file)routes
file accessible to external packagesrepair routes
command, including documentation and two options (--dry-run
and--start-all
)Future work
There's lots of room for future improvement on these commands/things related to them, including:
list
include the "inactive" repos not in theroutes
file--all
option tostart
orstop
to enable or disable all repos in the server at once--cleanup
flag torepair routes
to delete files that aren't part of a valid repository in thereporoot
repair
, such asbundle
(to correct the bundle list(s))routes
file, each having anActive
boolean flag to indicate active status