Compare commits

..

No commits in common. "46e2d3166fb02a6aeabbb92e93dbe5a53263eb65" and "3361358b3c6b0cb95d7725a1a82aaeb605ceba22" have entirely different histories.

7 changed files with 2 additions and 69 deletions

3
.gitignore vendored
View File

@ -1,3 +1,2 @@
/lure /lure
/dist/ /dist/
/version.txt

View File

@ -1,7 +1,6 @@
before: before:
hooks: hooks:
- go mod tidy - go mod tidy
- go generate
builds: builds:
- id: lure - id: lure
env: env:

View File

@ -1,4 +1,4 @@
lure: version.txt lure:
go build go build
clean: clean:
@ -9,8 +9,5 @@ install: lure
uninstall: uninstall:
rm -f /usr/local/bin/lure rm -f /usr/local/bin/lure
version.txt:
go generate
.PHONY: install clean uninstall .PHONY: install clean uninstall

10
main.go
View File

@ -128,11 +128,6 @@ func main() {
Aliases: []string{"ref"}, Aliases: []string{"ref"},
Action: refreshCmd, 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() log.Error("Error while running app").Err(err).Send()
} }
} }
func displayVersion(c *cli.Context) error {
print(version)
return nil
}

43
repo.go
View File

@ -41,12 +41,6 @@ func (p PkgNotFoundError) Error() string {
return "package '" + p.pkgName + "' could not be found in any repository" 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 { func addrepoCmd(c *cli.Context) error {
name := c.String("name") name := c.String("name")
repoURL := c.String("url") repoURL := c.String("url")
@ -229,26 +223,6 @@ func pullRepos(ctx context.Context) error {
} else if err != nil { } else if err != nil {
return err 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) err = os.RemoveAll(repoDir)
@ -272,23 +246,6 @@ func pullRepos(ctx context.Context) error {
if err != nil { if err != nil {
return err 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 return nil

View File

@ -1,3 +0,0 @@
#!/bin/bash
git describe --tags > version.txt

View File

@ -19,18 +19,12 @@
package main package main
import ( import (
_ "embed"
"strconv" "strconv"
"strings" "strings"
"golang.org/x/exp/slices" "golang.org/x/exp/slices"
) )
//go:generate scripts/gen-version.sh
//go:embed version.txt
var version string
// vercmp compares two version strings. // vercmp compares two version strings.
// It returns 1 if v1 is greater, // It returns 1 if v1 is greater,
// 0 if the versions are equal, // 0 if the versions are equal,