Add mkdir docs
Signed-off-by: Vasek - Tom C <tom.chauveau@epitech.eu>
This commit is contained in:
parent
d2580f4a73
commit
e11cb1b6fd
@ -152,7 +152,7 @@ _No output._
|
||||
|
||||
## engine.#Mkdir
|
||||
|
||||
Create a directory
|
||||
Create one or multiple directory in a container
|
||||
|
||||
### engine.#Mkdir Inputs
|
||||
|
||||
@ -212,8 +212,6 @@ _No output._
|
||||
|
||||
## engine.#ReadFile
|
||||
|
||||
Read a file from a filesystem tree
|
||||
|
||||
### engine.#ReadFile Inputs
|
||||
|
||||
_No input._
|
||||
|
@ -56,6 +56,18 @@ _No input._
|
||||
|
||||
_No output._
|
||||
|
||||
## engine.#Mkdir
|
||||
|
||||
Create one or multiple directory in a container
|
||||
|
||||
### engine.#Mkdir Inputs
|
||||
|
||||
_No input._
|
||||
|
||||
### engine.#Mkdir Outputs
|
||||
|
||||
_No output._
|
||||
|
||||
## engine.#Mount
|
||||
|
||||
A transient filesystem mount.
|
||||
|
@ -150,7 +150,7 @@ _No output._
|
||||
|
||||
## engine.#Mkdir
|
||||
|
||||
Create a directory
|
||||
Create one or multiple directory in a container Create a directory
|
||||
|
||||
### engine.#Mkdir Inputs
|
||||
|
||||
|
@ -69,12 +69,12 @@ func (t *mkdirTask) Run(ctx context.Context, pctx *plancontext.Context, s solver
|
||||
}
|
||||
|
||||
// Retrieve result result filesystem
|
||||
outputFs := pctx.FS.New(result)
|
||||
outputFS := pctx.FS.New(result)
|
||||
|
||||
// Init output
|
||||
output := compiler.NewValue()
|
||||
|
||||
if err := output.FillPath(cue.ParsePath("output"), outputFs.MarshalCUE()); err != nil {
|
||||
if err := output.FillPath(cue.ParsePath("output"), outputFS.MarshalCUE()); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return output, nil
|
||||
|
@ -1,20 +1,23 @@
|
||||
package engine
|
||||
|
||||
// Read a file from a filesystem tree
|
||||
// Create one or multiple directory in a container
|
||||
#Mkdir: {
|
||||
$dagger: task: _name: "Mkdir"
|
||||
|
||||
// Container filesystem
|
||||
input: #FS
|
||||
|
||||
// Path of the directory
|
||||
// Path of the directory to create
|
||||
// It can be nested (e.g : "/foo" or "/foo/bar")
|
||||
path: string
|
||||
|
||||
// Permission to set
|
||||
// Permissions to set
|
||||
mode: *0o755 | int
|
||||
|
||||
// Create parents' directory if they do not exist
|
||||
// If set, it creates parents' directory if they do not exist
|
||||
parents: *true | false
|
||||
|
||||
// Modified filesystem
|
||||
output: #FS
|
||||
}
|
||||
|
||||
@ -57,23 +60,6 @@ package engine
|
||||
output: #FS
|
||||
}
|
||||
|
||||
// Create a directory
|
||||
#Mkdir: {
|
||||
@dagger(notimplemented)
|
||||
$dagger: task: _name: "Mkdir"
|
||||
|
||||
input: #FS
|
||||
|
||||
// Path of the directory
|
||||
path: string
|
||||
// FIXME: permissions?
|
||||
mode: int
|
||||
// Create parent directories as needed?
|
||||
parents: *true | false
|
||||
|
||||
output: #FS
|
||||
}
|
||||
|
||||
// Copy files from one FS tree to another
|
||||
#Copy: {
|
||||
$dagger: task: _name: "Copy"
|
||||
|
@ -58,16 +58,15 @@ setup() {
|
||||
|
||||
|
||||
@test "task: #Mkdir" {
|
||||
# Make directory
|
||||
cd "$TESTDIR"/tasks/mkdir
|
||||
"$DAGGER" --europa up ./mkdir.cue
|
||||
}
|
||||
|
||||
@test "task: #Mkdir: create parents" {
|
||||
# Create parents
|
||||
cd "$TESTDIR"/tasks/mkdir
|
||||
"$DAGGER" --europa up ./mkdir_parents.cue
|
||||
}
|
||||
|
||||
@test "task: #Mkdir failure: disable parents creation" {
|
||||
# Disable parents creation
|
||||
cd "$TESTDIR"/tasks/mkdir
|
||||
run "$DAGGER" --europa up ./mkdir_failure_disable_parents.cue
|
||||
assert_failure
|
||||
|
@ -12,7 +12,7 @@ engine.#Plan & {
|
||||
|
||||
mkdir: engine.#Mkdir & {
|
||||
input: image.output
|
||||
path: "/test"
|
||||
path: "/test"
|
||||
}
|
||||
|
||||
writeChecker: engine.#WriteFile & {
|
||||
@ -24,7 +24,7 @@ engine.#Plan & {
|
||||
|
||||
readChecker: engine.#ReadFile & {
|
||||
input: writeChecker.output
|
||||
path: "/test/foo"
|
||||
path: "/test/foo"
|
||||
} & {
|
||||
// assert result
|
||||
contents: "bar"
|
||||
|
@ -11,8 +11,8 @@ engine.#Plan & {
|
||||
}
|
||||
|
||||
mkdir: engine.#Mkdir & {
|
||||
input: image.output
|
||||
path: "/test/baz"
|
||||
input: image.output
|
||||
path: "/test/baz"
|
||||
parents: false
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ engine.#Plan & {
|
||||
|
||||
readChecker: engine.#ReadFile & {
|
||||
input: writeChecker.output
|
||||
path: "/test/baz/foo"
|
||||
path: "/test/baz/foo"
|
||||
} & {
|
||||
// assert result
|
||||
contents: "bar"
|
||||
|
@ -12,7 +12,7 @@ engine.#Plan & {
|
||||
|
||||
mkdir: engine.#Mkdir & {
|
||||
input: image.output
|
||||
path: "/test/baz"
|
||||
path: "/test/baz"
|
||||
}
|
||||
|
||||
writeChecker: engine.#WriteFile & {
|
||||
@ -24,7 +24,7 @@ engine.#Plan & {
|
||||
|
||||
readChecker: engine.#ReadFile & {
|
||||
input: writeChecker.output
|
||||
path: "/test/baz/foo"
|
||||
path: "/test/baz/foo"
|
||||
} & {
|
||||
// assert result
|
||||
contents: "bar"
|
||||
|
Reference in New Issue
Block a user