x
This commit is contained in:
parent
86cd136d92
commit
6ea0ee469f
2
.gitignore
vendored
2
.gitignore
vendored
@ -23,4 +23,4 @@ conf/reply.php
|
||||
jdCookie.js
|
||||
scripts/node_modules
|
||||
task/*
|
||||
repos/*
|
||||
repos
|
||||
@ -12,22 +12,26 @@ type Repo struct {
|
||||
filename string
|
||||
}
|
||||
|
||||
var reposPath = ""
|
||||
|
||||
func (rp *Repo) init() {
|
||||
rp.filename = strings.Replace(strings.Replace(rp.Git, "https://", "", -1), "/", "_", -1)
|
||||
}
|
||||
|
||||
func initRepos() {
|
||||
reposPath = ExecPath + "/repos"
|
||||
if _, err := os.Stat(reposPath); err != nil {
|
||||
os.MkdirAll(reposPath, os.ModePerm)
|
||||
}
|
||||
for _, repo := range Config.Repos {
|
||||
repo.init()
|
||||
if _, err := os.Stat(ExecPath + "/" + repo.filename); err != nil {
|
||||
if _, err := os.Stat(reposPath + "/" + repo.filename); err != nil {
|
||||
repo.gitClone()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (rp *Repo) gitClone() {
|
||||
cmd := exec.Command("git", "clone", rp.Git, rp.filename)
|
||||
cmd.Path = ExecPath + "/repos"
|
||||
fmt.Println(cmd.Path)
|
||||
fmt.Println(cmd.Start())
|
||||
cmd := exec.Command("sh", "-c", fmt.Sprintf("git clone %s %s", rp.Git, rp.filename))
|
||||
cmd.Output()
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user