Added copyTree function and replaced the template copyFiles calls #21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Signed-off-by: rgee0 [email protected]
Main Change:
Created a copyTree function to address issue#18.
The function takes a similar approach to copyFiles but on finding a folder creates an equivalent folder in the build dir and then calls itself, this time passing in the source folder and newly created target folder. This means that all files and folder to n-levels will be copied.
A helper function has also been created;
pathExists()
is used withincopyTree
to try to offset errors where the destination may already exist.Finally, replaced the two
copyFile
calls for the template folders with a single call tocopyTree
and amended the TODO comment accordingly.Test:
Created 10 levels of files and folders beneath a template folder
Ran
./faas-cli -action build -yaml ./samples.yml
Confirmed that the images built successfully.
Confirmed that the expected files and folders were extant in the build folder following completion of build.
Other small edits:
Standardised some of the messages returned to the user.
Some diffs being shown are a result of vscode re-formatting.
Misc:
Used
git commit -s
as per the contribution guide