allow setting 'master' and 'devel' branches
This commit is contained in:
parent
cff4af7935
commit
98b0d445bc
|
@ -1,7 +1,7 @@
|
||||||
VERSION = $(shell git describe --tags)
|
VERSION = $(shell git describe --tags)
|
||||||
BUILDTIME = $(shell date +%Y.%m.%d)
|
BUILDTIME = $(shell date +%Y.%m.%d)
|
||||||
|
|
||||||
build:
|
build: goimports
|
||||||
GO111MODULE=off go build \
|
GO111MODULE=off go build \
|
||||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ test2:
|
||||||
FORGE_HOME=/tmp/forge ./forgeConfig
|
FORGE_HOME=/tmp/forge ./forgeConfig
|
||||||
FORGE_HOME=/tmp/forge ./forgeConfig --list
|
FORGE_HOME=/tmp/forge ./forgeConfig --list
|
||||||
|
|
||||||
install:
|
install: goimports
|
||||||
GO111MODULE=off go install \
|
GO111MODULE=off go install \
|
||||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,9 @@ type args struct {
|
||||||
Favorite bool `arg:"--favorite" default:"false" help:"forge will always go-clone or git clone this"`
|
Favorite bool `arg:"--favorite" default:"false" help:"forge will always go-clone or git clone this"`
|
||||||
Private bool `arg:"--private" default:"false" help:"repo can not be published"`
|
Private bool `arg:"--private" default:"false" help:"repo can not be published"`
|
||||||
Interesting bool `arg:"--interesting" default:"false" help:"something you decided was cool"`
|
Interesting bool `arg:"--interesting" default:"false" help:"something you decided was cool"`
|
||||||
|
Master string `arg:"--master" help:"the git 'master' or 'main' branch name"`
|
||||||
|
Devel string `arg:"--devel" help:"the git devel branch name"`
|
||||||
|
User string `arg:"--user" help:"the git user branch name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a args) Description() string {
|
func (a args) Description() string {
|
||||||
|
|
|
@ -11,26 +11,29 @@ import (
|
||||||
var VERSION string
|
var VERSION string
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
f := forgepb.Init()
|
var f *forgepb.Forge
|
||||||
|
f = forgepb.Init()
|
||||||
|
|
||||||
if argv.List {
|
if argv.List {
|
||||||
f.ConfigPrintTable()
|
f.ConfigPrintTable()
|
||||||
loop := f.Config.SortByGoPath() // get the list of forge configs
|
/*
|
||||||
for loop.Scan() {
|
loop := f.Config.SortByGoPath() // get the list of forge configs
|
||||||
r := loop.Next()
|
for loop.Scan() {
|
||||||
log.Info("repo:", r.GoPath)
|
r := loop.Next()
|
||||||
}
|
log.Info("repo:", r.GoPath)
|
||||||
|
}
|
||||||
|
*/
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to delete, then save config and exit
|
// try to delete, then save config and exit
|
||||||
if argv.Delete {
|
if argv.Delete {
|
||||||
if f.Config.DeleteByGoPath(argv.GoPath) {
|
if deleteGoPath(f, argv.GoPath) {
|
||||||
log.Info("deleted", argv.GoPath, "did not exist. did nothing")
|
log.Info("deleted", argv.GoPath, "ok")
|
||||||
|
f.ConfigSave()
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
log.Info("deleted", argv.GoPath, "ok")
|
log.Info("deleted", argv.GoPath, "did not exist. did nothing")
|
||||||
f.ConfigSave()
|
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,14 +51,18 @@ func main() {
|
||||||
// try to add, then save config and exit
|
// try to add, then save config and exit
|
||||||
if argv.Add {
|
if argv.Add {
|
||||||
log.Info("going to add a new repo", argv.GoPath)
|
log.Info("going to add a new repo", argv.GoPath)
|
||||||
|
deleteGoPath(f, argv.GoPath)
|
||||||
new1 := forgepb.ForgeConfig{
|
new1 := forgepb.ForgeConfig{
|
||||||
GoPath: argv.GoPath,
|
GoPath: argv.GoPath,
|
||||||
Writable: argv.Writable,
|
Writable: argv.Writable,
|
||||||
ReadOnly: argv.ReadOnly,
|
ReadOnly: argv.ReadOnly,
|
||||||
Private: argv.Private,
|
Private: argv.Private,
|
||||||
Directory: argv.Directory,
|
Directory: argv.Directory,
|
||||||
Favorite: argv.Favorite,
|
Favorite: argv.Favorite,
|
||||||
Interesting: argv.Interesting,
|
Interesting: argv.Interesting,
|
||||||
|
MasterBranchName: argv.Master,
|
||||||
|
DevelBranchName: argv.Devel,
|
||||||
|
UserBranchName: argv.User,
|
||||||
}
|
}
|
||||||
|
|
||||||
if f.Config.Append(&new1) {
|
if f.Config.Append(&new1) {
|
||||||
|
@ -68,66 +75,18 @@ func main() {
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// testMemoryCorruption(f)
|
|
||||||
f.ConfigSave()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
func deleteGoPath(f *forgepb.Forge, gopath string) bool {
|
||||||
// this fucks shit up
|
var deleted bool = false
|
||||||
func testMemoryCorruption(all *forgepb.Repos) *forgepb.Repos {
|
for {
|
||||||
new1 := new(forgepb.Repo)
|
if f.Config.DeleteByGoPath(gopath) {
|
||||||
new1.Name = "bash1"
|
log.Info("deleted ok", gopath)
|
||||||
new1.Version = "5.2.21"
|
deleted = true
|
||||||
if all.Append(new1) {
|
} else {
|
||||||
log.Info("added", new1.Name, "ok")
|
log.Info("did not delete", gopath)
|
||||||
} else {
|
break
|
||||||
log.Info("added", new1.Name, "failed")
|
}
|
||||||
}
|
}
|
||||||
|
return deleted
|
||||||
new1 = new(forgepb.Repo)
|
|
||||||
new1.Name = "zookeeper1"
|
|
||||||
new1.Debname = "zookeeper-go"
|
|
||||||
if all.Append(new1) {
|
|
||||||
log.Info("added", new1.Name, "ok")
|
|
||||||
} else {
|
|
||||||
log.Info("added", new1.Name, "failed")
|
|
||||||
}
|
|
||||||
|
|
||||||
new1 = new(forgepb.Repo)
|
|
||||||
new1.Name = "wit-package"
|
|
||||||
new1.Private = true
|
|
||||||
if all.Append(new1) {
|
|
||||||
log.Info("added", new1.Name, "ok")
|
|
||||||
} else {
|
|
||||||
log.Info("added", new1.Name, "failed")
|
|
||||||
}
|
|
||||||
|
|
||||||
new1 = new(forgepb.Repo)
|
|
||||||
new1.Name = "networkQuality"
|
|
||||||
new1.Debname = "networkquality"
|
|
||||||
new1.Readonly = true
|
|
||||||
if all.Append(new1) {
|
|
||||||
log.Info("added", new1.Name, "ok")
|
|
||||||
} else {
|
|
||||||
log.Info("added", new1.Name, "failed")
|
|
||||||
}
|
|
||||||
|
|
||||||
new2 := new(forgepb.Repo)
|
|
||||||
new2.Name = "go-clone"
|
|
||||||
new2.Version = "0.6.8" // good version of the macos
|
|
||||||
if all.Append(new2) {
|
|
||||||
log.Info("added", new2.Name, "ok")
|
|
||||||
} else {
|
|
||||||
log.Info("added", new2.Name, "failed")
|
|
||||||
}
|
|
||||||
|
|
||||||
if all.Append(new2) {
|
|
||||||
log.Info("added", new2.Name, "ok (this is bad)")
|
|
||||||
} else {
|
|
||||||
log.Info("added", new2.Name, "failed (but ok)")
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Println("packages are:", len(all.Repos))
|
|
||||||
return all
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
Loading…
Reference in New Issue