-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Major refactor of all internals (#30)
* Moved viper loaded config to config package * Created internal interfaces to: * GitManager * ExecManager * RepositoryManager * RepositoriesManager * CopyManager * Implemented gomock * Moved packages to repo patern * Removed go integration tests, and instead use afero for filesystem testing * Switched output to slog * Removed/moved unnecessary packages * Added current configuration debug log * Corrected exec to return Stderr All tests currently passing.
- Loading branch information
Showing
35 changed files
with
1,796 additions
and
1,148 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
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
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
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,58 @@ | ||
// Copyright (c) 2023 John Dewey | ||
|
||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to | ||
// deal in the Software without restriction, including without limitation the | ||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | ||
// sell copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
|
||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
|
||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
|
||
package config | ||
|
||
// Repositories perform repository operations. | ||
type Repositories struct { | ||
// Debug enable or disable debug option set from CLI. | ||
Debug bool `mapstruture:"debug"` | ||
// GiltFile path to Gilt's config file option set from CLI. | ||
GiltFile string `mapstructure:"giltFile"` | ||
// GiltDir path to Gilt's clone dir option set from CLI. | ||
GiltDir string `mapstructure:"giltDir"` | ||
// Repositories a slice of repository configurations to overlay. | ||
Repositories []Repository `mapstruture:"repositories"` | ||
} | ||
|
||
// Sources mapping of files and/or directories needing copied. | ||
type Sources struct { | ||
// Src source file or directory to copy. | ||
Src string `mapstructure:"src"` | ||
// DstFile destination of file copy. | ||
DstFile string `mapstructure:"dstFile"` | ||
// DstDir destination of directory copy. | ||
DstDir string `mapstructure:"dstDir"` | ||
} | ||
|
||
// Repository contains the repository's details for cloning. | ||
type Repository struct { | ||
// Git url of Git repository to clone. | ||
Git string `mapstructure:"git"` | ||
// Version of Git repository to use. | ||
Version string `mapstructure:"version"` | ||
// DstDir destination directory to copy clone to. | ||
DstDir string `mapstructure:"dstDir"` | ||
// Sources containing files and/or directories to copy. | ||
Sources []Sources `mapstructure:"sources"` | ||
|
||
// Directory to clone into. | ||
CloneDir string | ||
} |
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,28 @@ | ||
// Copyright (c) 2023 John Dewey | ||
|
||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to | ||
// deal in the Software without restriction, including without limitation the | ||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | ||
// sell copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
|
||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
|
||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
|
||
package internal | ||
|
||
// GitManager manager responsible for Git operations. | ||
type GitManager interface { | ||
Clone(gitURL string, cloneDir string) error | ||
Reset(cloneDir string, gitVersion string) error | ||
CheckoutIndex(dstDir string, cloneDir string) error | ||
} |
Oops, something went wrong.