mirror of
https://github.com/TECHNOFAB11/jsonnet-bundler.git
synced 2025-12-11 23:50:05 +01:00
Make use of File and LockFile constants of jsonnetfile package
This commit is contained in:
parent
9d10f90924
commit
30a3cde870
2 changed files with 10 additions and 12 deletions
|
|
@ -24,13 +24,12 @@ import (
|
|||
"path/filepath"
|
||||
|
||||
"github.com/fatih/color"
|
||||
"github.com/jsonnet-bundler/jsonnet-bundler/pkg/jsonnetfile"
|
||||
"github.com/jsonnet-bundler/jsonnet-bundler/spec"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
var (
|
||||
JsonnetFile = "jsonnetfile.json"
|
||||
JsonnetLockFile = "jsonnetfile.lock.json"
|
||||
VersionMismatch = errors.New("multiple colliding versions specified")
|
||||
)
|
||||
|
||||
|
|
@ -161,18 +160,18 @@ func FileExists(path string) (bool, error) {
|
|||
}
|
||||
|
||||
func ChooseJsonnetFile(dir string) (string, bool, error) {
|
||||
lockfile := path.Join(dir, JsonnetLockFile)
|
||||
jsonnetfile := path.Join(dir, JsonnetFile)
|
||||
filename := lockfile
|
||||
lockfilePath := path.Join(dir, jsonnetfile.LockFile)
|
||||
jsonnetfilePath := path.Join(dir, jsonnetfile.File)
|
||||
filename := lockfilePath
|
||||
isLock := true
|
||||
|
||||
lockExists, err := FileExists(filepath.Join(dir, JsonnetLockFile))
|
||||
lockExists, err := FileExists(filepath.Join(dir, jsonnetfile.LockFile))
|
||||
if err != nil {
|
||||
return "", false, err
|
||||
}
|
||||
|
||||
if !lockExists {
|
||||
filename = jsonnetfile
|
||||
filename = jsonnetfilePath
|
||||
isLock = false
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue