WIP residPackage

This commit is contained in:
Jeffrey Regan
2018-10-04 20:24:22 -07:00
parent 239db504ff
commit c9887e8c15
40 changed files with 242 additions and 215 deletions

View File

@@ -22,6 +22,7 @@ import (
"path/filepath"
"sigs.k8s.io/kustomize/pkg/fs"
"sigs.k8s.io/kustomize/pkg/ifc"
)
const currentDir = "."
@@ -52,7 +53,7 @@ func (l *fileLoader) Root() string {
// slash or not.
// Example: "/home/seans/project" or "/home/seans/project/"
// NOT "/home/seans/project/file.yaml".
func (l *fileLoader) New(newRoot string) (Loader, error) {
func (l *fileLoader) New(newRoot string) (ifc.Loader, error) {
return NewLoader(newRoot, l.root, l.fSys)
}

View File

@@ -20,6 +20,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
"sigs.k8s.io/kustomize/pkg/ifc"
"strings"
"github.com/hashicorp/go-getter"
@@ -43,7 +44,7 @@ func (l *githubLoader) Root() string {
}
// New delegates to fileLoader.New
func (l *githubLoader) New(newRoot string) (Loader, error) {
func (l *githubLoader) New(newRoot string) (ifc.Loader, error) {
return l.loader.New(newRoot)
}

View File

@@ -20,25 +20,14 @@ package loader
import (
"fmt"
"path/filepath"
"sigs.k8s.io/kustomize/pkg/ifc"
"sigs.k8s.io/kustomize/pkg/fs"
)
// Loader interface exposes methods to read bytes.
type Loader interface {
// Root returns the root location for this Loader.
Root() string
// New returns Loader located at newRoot.
New(newRoot string) (Loader, error)
// Load returns the bytes read from the location or an error.
Load(location string) ([]byte, error)
// Cleanup cleans the loader
Cleanup() error
}
// NewLoader returns a Loader given a target
// The target can be a local disk directory or a github Url
func NewLoader(target, r string, fSys fs.FileSystem) (Loader, error) {
func NewLoader(target, r string, fSys fs.FileSystem) (ifc.Loader, error) {
if !isValidLoaderPath(target, r) {
return nil, fmt.Errorf("Not valid path: root='%s', loc='%s'\n", r, target)
}