-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define document nodes content with template #64
Conversation
pkg/api/types.go
Outdated
@@ -234,7 +234,7 @@ type Template struct { | |||
// Sources maps variable names to ContentSelectors that will be | |||
// used as specification for the content to fetch and assign ot that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
used as specification for the content to fetch and assign to those variables
pkg/reactor/document_worker.go
Outdated
templateBlob []byte | ||
tmpl *template.Template | ||
) | ||
if tmpl, ok = w.templates[task.Node.Template.Path]; !ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we have concurrent reads
pkg/resourcehandlers/fs/fs.go
Outdated
|
||
// Accept implements resourcehandlers.ResourceHandler#Accept | ||
func (fs *fsHandler) Accept(uri string) bool { | ||
if _, err := os.Stat(uri); err == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could just return err == nil
pkg/resourcehandlers/fs/fs.go
Outdated
if path != parentPath { | ||
if len(strings.Split(path, "/"))-len(strings.Split(parentPath, "/")) != 1 { | ||
node = node.Parent() | ||
parentPathSegments := strings.Split(path, "/") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pathSegments intead of parentPathSegments
pkg/resourcehandlers/fs/fs.go
Outdated
return nil | ||
} | ||
|
||
func buildNodes(path string, info os.FileInfo) *api.Node { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this used
pkg/resourcehandlers/fs/fs.go
Outdated
} | ||
|
||
git := exec.Command("git", "log", "--date=short", `--pretty=format:'{%n "sha": "%H",%n "author": "%aN <%aE>",%n "date": "%ad",%n "message": "%s",%n "email": "%aE",%n "name": "%aN"%n },'`, "--follow", path) | ||
if log, err = git.CombinedOutput(); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if we use CombinedOutput here and the git command fails the stderr will be again saved to log. Is this desired?
@swilen-iwanow ready for review after fixing requested changes |
lgtm |
What this PR does / why we need it:
Adds the third option for content assignment to document nodes - templates.
Contributes file system resource handler enabling local file system nodes in structures and git info for them.
With local file system support, template paths can be local file system paths too.
Which issue(s) this PR fixes:
Fixes #18
Completes #54
Release note: