Compare commits
No commits in common. "46e2d3166fb02a6aeabbb92e93dbe5a53263eb65" and "3361358b3c6b0cb95d7725a1a82aaeb605ceba22" have entirely different histories.
46e2d3166f
...
3361358b3c
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,2 @@
|
||||
/lure
|
||||
/dist/
|
||||
/version.txt
|
||||
/dist/
|
@ -1,7 +1,6 @@
|
||||
before:
|
||||
hooks:
|
||||
- go mod tidy
|
||||
- go generate
|
||||
builds:
|
||||
- id: lure
|
||||
env:
|
||||
|
5
Makefile
5
Makefile
@ -1,4 +1,4 @@
|
||||
lure: version.txt
|
||||
lure:
|
||||
go build
|
||||
|
||||
clean:
|
||||
@ -9,8 +9,5 @@ install: lure
|
||||
|
||||
uninstall:
|
||||
rm -f /usr/local/bin/lure
|
||||
|
||||
version.txt:
|
||||
go generate
|
||||
|
||||
.PHONY: install clean uninstall
|
10
main.go
10
main.go
@ -128,11 +128,6 @@ func main() {
|
||||
Aliases: []string{"ref"},
|
||||
Action: refreshCmd,
|
||||
},
|
||||
{
|
||||
Name: "version",
|
||||
Usage: "Display the current LURE version and exit",
|
||||
Action: displayVersion,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -141,8 +136,3 @@ func main() {
|
||||
log.Error("Error while running app").Err(err).Send()
|
||||
}
|
||||
}
|
||||
|
||||
func displayVersion(c *cli.Context) error {
|
||||
print(version)
|
||||
return nil
|
||||
}
|
||||
|
43
repo.go
43
repo.go
@ -41,12 +41,6 @@ func (p PkgNotFoundError) Error() string {
|
||||
return "package '" + p.pkgName + "' could not be found in any repository"
|
||||
}
|
||||
|
||||
type RepoConfig struct {
|
||||
Repo struct {
|
||||
MinVersion string `toml:"minVersion"`
|
||||
}
|
||||
}
|
||||
|
||||
func addrepoCmd(c *cli.Context) error {
|
||||
name := c.String("name")
|
||||
repoURL := c.String("url")
|
||||
@ -229,26 +223,6 @@ func pullRepos(ctx context.Context) error {
|
||||
} else if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fl, err := w.Filesystem.Open("lure-repo.toml")
|
||||
if err != nil {
|
||||
log.Warn("Git repository does not appear to be a valid LURE repo").Str("repo", repo.Name).Send()
|
||||
continue
|
||||
}
|
||||
|
||||
var repoCfg RepoConfig
|
||||
err = toml.NewDecoder(fl).Decode(&repoCfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fl.Close()
|
||||
|
||||
currentVer, _, _ := strings.Cut(version, "-")
|
||||
if vercmp(currentVer, repoCfg.Repo.MinVersion) == -1 {
|
||||
log.Warn("LURE repo's minumum LURE version is greater than the current version. Try updating LURE if something doesn't work.").Str("repo", repo.Name).Send()
|
||||
}
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
err = os.RemoveAll(repoDir)
|
||||
@ -272,23 +246,6 @@ func pullRepos(ctx context.Context) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fl, err := os.Open(filepath.Join(repoDir, "lure-repo.toml"))
|
||||
if err != nil {
|
||||
log.Warn("Git repository does not appear to be a valid LURE repo").Str("repo", repo.Name).Send()
|
||||
}
|
||||
|
||||
var repoCfg RepoConfig
|
||||
err = toml.NewDecoder(fl).Decode(&repoCfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fl.Close()
|
||||
|
||||
currentVer, _, _ := strings.Cut(version, "-")
|
||||
if vercmp(currentVer, repoCfg.Repo.MinVersion) == -1 {
|
||||
log.Warn("LURE repo's minumum LURE version is greater than the current version. Try updating LURE if something doesn't work.").Str("repo", repo.Name).Send()
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
git describe --tags > version.txt
|
@ -19,18 +19,12 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/exp/slices"
|
||||
)
|
||||
|
||||
//go:generate scripts/gen-version.sh
|
||||
|
||||
//go:embed version.txt
|
||||
var version string
|
||||
|
||||
// vercmp compares two version strings.
|
||||
// It returns 1 if v1 is greater,
|
||||
// 0 if the versions are equal,
|
||||
|
Loading…
Reference in New Issue
Block a user