feat: added prerequisites
This commit is contained in:
parent
ce273209c1
commit
41d4efd624
3 changed files with 23 additions and 4 deletions
|
|
@ -62,12 +62,14 @@ func checkoutRepositories(repositories []Repository) {
|
||||||
// create clone gitlab url
|
// create clone gitlab url
|
||||||
repoName := string(repo.PathWithNamespace)
|
repoName := string(repo.PathWithNamespace)
|
||||||
gitlabUrl := fmt.Sprintf("https://gitlab-token:%s@%s/%s.git",
|
gitlabUrl := fmt.Sprintf("https://gitlab-token:%s@%s/%s.git",
|
||||||
gitlabToken, gitlabHost, repoName)
|
gitlabToken,
|
||||||
|
gitlabHost,
|
||||||
|
repoName)
|
||||||
|
|
||||||
// create repository destination
|
// create repository destination
|
||||||
repoDestination := repoDestinationPre + repoName
|
repoDestination := repoDestinationPre + repoName
|
||||||
|
|
||||||
// create bar description
|
// create and update bar description
|
||||||
descriptionPrefixPre := "Cloning repository "
|
descriptionPrefixPre := "Cloning repository "
|
||||||
descriptionPrefix := descriptionPrefixPre + repoName + " ..."
|
descriptionPrefix := descriptionPrefixPre + repoName + " ..."
|
||||||
bar.Describe(descriptionPrefix)
|
bar.Describe(descriptionPrefix)
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ var gitlabHost string
|
||||||
var clonedCount int
|
var clonedCount int
|
||||||
var errorCount int
|
var errorCount int
|
||||||
var pulledCount int
|
var pulledCount int
|
||||||
var pullError int
|
|
||||||
var pullErrorMsg []string
|
var pullErrorMsg []string
|
||||||
|
|
||||||
type Repository struct {
|
type Repository struct {
|
||||||
|
|
@ -26,6 +25,9 @@ func main() {
|
||||||
// manage all argument magic
|
// manage all argument magic
|
||||||
manageArguments()
|
manageArguments()
|
||||||
|
|
||||||
|
// check for git
|
||||||
|
verifyGitAvailable()
|
||||||
|
|
||||||
// fetch repository information from gitlab
|
// fetch repository information from gitlab
|
||||||
repositories, err := fetchRepositories()
|
repositories, err := fetchRepositories()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
15
cmd/gogitlabber/prerequisites.go
Normal file
15
cmd/gogitlabber/prerequisites.go
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
)
|
||||||
|
|
||||||
|
func verifyGitAvailable() {
|
||||||
|
_, err := exec.LookPath("git")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("Error: could not find git in path")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue