mirror of
https://github.com/go-task/task.git
synced 2025-07-15 01:35:00 +02:00
fix: HTTPNode.Location
when building graph (#2007)
* Fix HTTPNode.Location when building graph * Add test and fix cache
This commit is contained in:
@ -1218,6 +1218,10 @@ func TestIncludesRemote(t *testing.T) {
|
|||||||
firstRemote: srv.URL + "/first/Taskfile.yml",
|
firstRemote: srv.URL + "/first/Taskfile.yml",
|
||||||
secondRemote: "./second/Taskfile.yml",
|
secondRemote: "./second/Taskfile.yml",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
firstRemote: srv.URL + "/first/",
|
||||||
|
secondRemote: srv.URL + "/first/second/",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks := []string{
|
tasks := []string{
|
||||||
|
@ -17,7 +17,8 @@ import (
|
|||||||
// An HTTPNode is a node that reads a Taskfile from a remote location via HTTP.
|
// An HTTPNode is a node that reads a Taskfile from a remote location via HTTP.
|
||||||
type HTTPNode struct {
|
type HTTPNode struct {
|
||||||
*BaseNode
|
*BaseNode
|
||||||
URL *url.URL
|
URL *url.URL // stores url pointing actual remote file. (e.g. with Taskfile.yml)
|
||||||
|
entrypoint string // stores entrypoint url. used for building graph vertices.
|
||||||
logger *logger.Logger
|
logger *logger.Logger
|
||||||
timeout time.Duration
|
timeout time.Duration
|
||||||
}
|
}
|
||||||
@ -42,13 +43,14 @@ func NewHTTPNode(
|
|||||||
return &HTTPNode{
|
return &HTTPNode{
|
||||||
BaseNode: base,
|
BaseNode: base,
|
||||||
URL: url,
|
URL: url,
|
||||||
|
entrypoint: entrypoint,
|
||||||
timeout: timeout,
|
timeout: timeout,
|
||||||
logger: l,
|
logger: l,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (node *HTTPNode) Location() string {
|
func (node *HTTPNode) Location() string {
|
||||||
return node.URL.String()
|
return node.entrypoint
|
||||||
}
|
}
|
||||||
|
|
||||||
func (node *HTTPNode) Remote() bool {
|
func (node *HTTPNode) Remote() bool {
|
||||||
@ -119,6 +121,6 @@ func (node *HTTPNode) ResolveDir(dir string) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (node *HTTPNode) FilenameAndLastDir() (string, string) {
|
func (node *HTTPNode) FilenameAndLastDir() (string, string) {
|
||||||
dir, filename := filepath.Split(node.URL.Path)
|
dir, filename := filepath.Split(node.entrypoint)
|
||||||
return filepath.Base(dir), filename
|
return filepath.Base(dir), filename
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user