mirror of
https://github.com/TECHNOFAB11/jsonnet-bundler.git
synced 2025-12-11 23:50:05 +01:00
refactor: switch to pkg/jsonnetfile
So far, `pkg` and `pkg/jsonnetfile` had overlapping functionality when it came to choosing and loading jsonnetfiles. This fully switches to the separate package `pkg/jsonnetfile` that seems to be created for exactly this purpose
This commit is contained in:
parent
a718f48cd8
commit
71938456ae
10 changed files with 55 additions and 180 deletions
|
|
@ -18,13 +18,13 @@ import (
|
|||
"io/ioutil"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/jsonnet-bundler/jsonnet-bundler/pkg"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
|
||||
"github.com/jsonnet-bundler/jsonnet-bundler/pkg/jsonnetfile"
|
||||
"gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
func initCommand(dir string) int {
|
||||
exists, err := pkg.FileExists(jsonnetfile.File)
|
||||
exists, err := jsonnetfile.Exists(jsonnetfile.File)
|
||||
if err != nil {
|
||||
kingpin.Errorf("Failed to check for jsonnetfile.json: %v", err)
|
||||
return 1
|
||||
|
|
|
|||
|
|
@ -21,10 +21,11 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
|
||||
"github.com/jsonnet-bundler/jsonnet-bundler/pkg"
|
||||
"github.com/jsonnet-bundler/jsonnet-bundler/pkg/jsonnetfile"
|
||||
"github.com/jsonnet-bundler/jsonnet-bundler/spec"
|
||||
"gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
func installCommand(dir, jsonnetHome string, uris ...string) int {
|
||||
|
|
|
|||
|
|
@ -21,8 +21,9 @@ import (
|
|||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/jsonnet-bundler/jsonnet-bundler/pkg/jsonnetfile"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/jsonnet-bundler/jsonnet-bundler/pkg/jsonnetfile"
|
||||
)
|
||||
|
||||
func TestInstallCommand(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -18,8 +18,9 @@ import (
|
|||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/jsonnet-bundler/jsonnet-bundler/spec"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/jsonnet-bundler/jsonnet-bundler/spec"
|
||||
)
|
||||
|
||||
func TestParseDependency(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -21,13 +21,14 @@ import (
|
|||
"net/url"
|
||||
"os"
|
||||
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
|
||||
"github.com/jsonnet-bundler/jsonnet-bundler/pkg"
|
||||
"github.com/jsonnet-bundler/jsonnet-bundler/pkg/jsonnetfile"
|
||||
"gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
func updateCommand(jsonnetHome string, urls ...*url.URL) int {
|
||||
m, err := pkg.LoadJsonnetfile(jsonnetfile.File)
|
||||
m, err := jsonnetfile.Load(jsonnetfile.File)
|
||||
if err != nil {
|
||||
kingpin.Fatalf("failed to load jsonnetfile: %v", err)
|
||||
return 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue