replace module.cue with dagger.mod.cue

Signed-off-by: Tihomir Jovicic <tihomir.jovicic.develop@gmail.com>
This commit is contained in:
Tihomir Jovicic 2021-08-02 11:17:42 +02:00
parent 92e6e693f5
commit e5c8d6eee0
4 changed files with 8 additions and 13 deletions

View File

@ -12,6 +12,8 @@ import (
"strings"
)
const FilePath = "./cue.mod/dagger.mod.cue"
// A file is the parsed, interpreted form of a cue.mod file.
type file struct {
module string
@ -162,7 +164,7 @@ func parseGithubRepoVersion(repoSuffix string) (string, string) {
}
func readModFile() (*file, error) {
f, err := os.Open("./cue.mod/module.cue")
f, err := os.Open(FilePath)
if err != nil {
return nil, err
}
@ -176,7 +178,7 @@ func readModFile() (*file, error) {
}
func writeModFile(f *file) error {
return ioutil.WriteFile("./cue.mod/module.cue", f.contents().Bytes(), 0600)
return ioutil.WriteFile(FilePath, f.contents().Bytes(), 0600)
}
func move(r *require, sourceRepoPath, destBasePath string) error {

View File

@ -1,7 +0,0 @@
package mod
import "testing"
func TestUpdateModFile(t *testing.T) {
}

View File

@ -40,8 +40,8 @@ func clone(require *require, dir string) (*repo, error) {
return nil, err
}
if _, err := os.Stat(path.Join(dir, require.path, "cue.mod", "module.cue")); err != nil {
return nil, fmt.Errorf("repo does not contain cue.mod/module.cue")
if _, err := os.Stat(path.Join(dir, require.path, FilePath)); err != nil {
return nil, fmt.Errorf("repo does not contain %s", FilePath)
}
return rr, nil

View File

@ -17,7 +17,7 @@ func TestClone(t *testing.T) {
prefix: "https://",
repo: "github.com/tjovicic/gcpcloudrun-cue",
path: "",
version: "5839b7b432b8b0c",
version: "d530f2ea2099",
},
},
{
@ -35,7 +35,7 @@ func TestClone(t *testing.T) {
prefix: "https://",
repo: "github.com/tjovicic/gcpcloudrun-cue",
path: "",
version: "v0.1",
version: "v0.3",
},
},
}