Compare commits
3 Commits
1b0cd57284
...
baa8e51b3e
Author | SHA1 | Date | |
---|---|---|---|
baa8e51b3e | |||
7bc66cae90 | |||
6a8aa6c5a3 |
6
Makefile
6
Makefile
@ -15,6 +15,12 @@ jx-cli:
|
||||
test: jx-cli
|
||||
go test -coverprofile=artifacts/coverage.profile ./...
|
||||
go tool cover -html=artifacts/coverage.profile -o artifacts/code-coverage.html
|
||||
alpine-deps:
|
||||
apk add make
|
||||
apk add golangci-lint
|
||||
apk add git
|
||||
apk add luajit luajit-dev
|
||||
apk add gpg gpg-agent
|
||||
fedora-deps:
|
||||
./jx apply build/rpm.jx.yaml
|
||||
spectool -g -R build/jx.spec
|
||||
|
@ -8,6 +8,7 @@ import (
|
||||
|
||||
var (
|
||||
ErrConfigUndefinedName = errors.New("Config block is missing a defined name")
|
||||
ErrConfigUndefined = errors.New("Config block is missing")
|
||||
)
|
||||
|
||||
|
||||
|
@ -27,6 +27,7 @@ import (
|
||||
"strings"
|
||||
"embed"
|
||||
"compress/gzip"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -99,7 +100,6 @@ type File struct {
|
||||
FileType FileType `json:"filetype" yaml:"filetype"`
|
||||
SerializeContent bool `json:"serializecontent,omitempty" yaml:"serializecontent,omitempty"`
|
||||
GzipContent bool `json:"gzipcontent,omitempty" yaml:"gzipcontent,omitempty"`
|
||||
Resources data.ResourceMapper `json:"-" yaml:"-"`
|
||||
}
|
||||
|
||||
type ResourceFileInfo struct {
|
||||
@ -135,10 +135,6 @@ func (f *File) Init(u data.URIParser) error {
|
||||
return f.SetParsedURI(u)
|
||||
}
|
||||
|
||||
func (f *File) NormalizePath() error {
|
||||
return f.Common.NormalizePath()
|
||||
}
|
||||
|
||||
func (f *File) ContentType() string {
|
||||
var ext strings.Builder
|
||||
if f.parsedURI.Scheme != "file" {
|
||||
@ -153,10 +149,6 @@ func (f *File) ContentType() string {
|
||||
return ext.String()
|
||||
}
|
||||
|
||||
func (f *File) SetResourceMapper(resources data.ResourceMapper) {
|
||||
f.Resources = resources
|
||||
}
|
||||
|
||||
func (f *File) Clone() data.Resource {
|
||||
return &File {
|
||||
Common: f.Common.Clone(),
|
||||
@ -372,6 +364,15 @@ func (f *File) ResolveId(ctx context.Context) string {
|
||||
return f.Common.Path
|
||||
}
|
||||
|
||||
func (f *File) NormalizePath() error {
|
||||
if f.config != nil {
|
||||
if prefixPath, configErr := f.config.GetValue("prefix"); configErr == nil {
|
||||
f.Common.Path = filepath.Join(prefixPath.(string), f.Common.Path)
|
||||
}
|
||||
}
|
||||
return f.Common.NormalizePath()
|
||||
}
|
||||
|
||||
/*
|
||||
func (f *File) NormalizePath() (err error) {
|
||||
if f.config != nil {
|
||||
@ -595,11 +596,11 @@ func (f *File) ContentSourceRefStat() (info fs.FileInfo) {
|
||||
|
||||
func (f *File) ReadStat() (err error) {
|
||||
var info fs.FileInfo
|
||||
slog.Info("ReadStat()", "filesystem", f.Filesystem, "path", f.Common.Path)
|
||||
slog.Info("File.ReadStat()", "filesystem", f.Filesystem, "path", f.Common.Path)
|
||||
|
||||
info, err = f.Stat()
|
||||
|
||||
slog.Info("ReadStat()", "filesystem", f.Filesystem, "path", f.Common.Path, "info", info, "error", err)
|
||||
slog.Info("File.ReadStat()", "filesystem", f.Filesystem, "path", f.Common.Path, "info", info, "error", err)
|
||||
|
||||
if err == nil {
|
||||
_ = f.SetFileInfo(info)
|
||||
@ -613,7 +614,7 @@ func (f *File) ReadStat() (err error) {
|
||||
}
|
||||
|
||||
|
||||
slog.Info("ReadStat()", "stat", info, "path", f.Common.Path)
|
||||
slog.Info("File.ReadStat()", "stat", info, "path", f.Common.Path)
|
||||
if err != nil {
|
||||
f.Common.State = "absent"
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user