Description
During the update of the blueprints, I tried to use the step writeFiles
like this (which didn't work)
"step": "writeFiles",
"writeToPath": "/wordpress/wp-content",
"filesTree": {
"resource": "literal:directory",
"name": "wp-content",
"files": {
"postcontent.md": {
"resource": "url",
"url": "https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/wpcli-post-with-image/postcontent.md"
},
"Select-storage-method.png": {
"resource": "url",
"url": "https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/wpcli-post-with-image/Select-storage-method.png"
}
}
}
@bgrgicak took another look at this and found the following:
Your original Blueprint created a directory with the name postcontent.md and added files named resource and url to the directory.
This behavior matches our implementation of writeFile where a file can only be a literal value or another file tree (represented as a JSON object in the Blueprint).
"It would be mind blowing if we could append resource types like URLs in the way you attempted it, so it might be worth submitting a feature request to start a discussion." -- @bgrgicak
I strongly agree. It feels natural and allows for a more organized approach.
this is the current working implementation using writeFile
step.
{
"step": "writeFile",
"path": "/wordpress/wp-content/postcontent.md",
"data": {
"resource": "url",
"url": "https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/wpcli-post-with-image/postcontent.md"
}
},
{
"step": "writeFile",
"path": "/wordpress/wp-content/Select-storage-method.png",
"data": {
"resource": "url",
"url": "https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/wpcli-post-with-image/Select-storage-method.png"
}
},
It could look like this or something similar
{
"step": "writeFiles",
"writeToPath": "/wordpress/wp-content",
"filesTree": {
"resource": "literal:directory",
"name": "wp-content",
"files": {
"postcontent": {
"resource": "url",
"postcontent.md": "https://github.com/WordPress/blueprints/blob/trunk/blueprints/wpcli-post-with-image/postcontent.md"
},
{
"resource": "url",
"Select-storage-method.png": "https://github.com/WordPress/blueprints/blob/trunk/blueprints/wpcli-post-with-image/Select-storage-method.png"}
}
}
}
}
this would place the two files into the same directory
±---/wp-content
|------/postcontent/
|-- postcontent.md
|-- Select-storage-method.png