vs-deploy
vs-deploy copied to clipboard
Add option to deploy chosen file without parent directory
Whenever I deploy a single file plugin copies to file across along with its parent folder. Can we have an option which disables that behaviour? I looked through the wiki and I could not find anything about getting the setting right to eliminate this behaviour.
On my Windows machine, I have a workspace folder with several folders, each with several files, I want to be able to send individual files across to my remote Linux machine. I played around with the mapping parameter but it does not seem to be helping in any way.
Can you give me some examples?
Windows machine workspace C:\Proj1\ has folders F1, F2, and F3. Each folder has some files. Whenever I deploy any of the files they get uploaded to the target along with their parent folder. Let's say F1 has file A inside, when I deploy A to target it creates folder F1 on the target and then puts the file I want to deploy in that folder so I get location_on_taget/F1/A
"targets": [
{
"type": "sftp",
"name": "Linux Machine",
"description": "Linux machine folder",
"dir": "/home/user/app",
"host": "10.50.12.110", "port": 22,
"user": "user", "password": "pass",
"mappings": [
{
"source": "\\",
"target": "/"
}
]
}
]
@kwmlodozeniec
Would you like to upload the files inside F1
, F2
and F3
relative to /home/user/app
?
If so, you should do the following:
{
"deploy": {
"targets": [
{
// ...
"mappings": [
{
"source": "/F1",
"target": "/"
},
{
"source": "/F2",
"target": "/"
},
{
"source": "/F3",
"target": "/"
}
]
}
]
}
}
The paths of source
properties are relative to your workspace.
The paths of target
properties are relative to /home/user/app
.
That works but it means I need to list all subfolders in my workspace and update the setting file after adding more folders.
My idea is to add a new, optional setting to the target mappings like isRegEx
:
{
"deploy": {
"targets": [
{
// ...
"mappings": [
{
"isRegEx": true,
"source": "^(\\/F[0-9]+)$",
"target": "/"
}
]
}
]
}
}
This would handle the value of source
property as regular expression.
Okay that would provide some workaround for more complex situations. However, for folders where user would like this kind of behaviour by default for all subfolders it would be easier just to have some flag let's say "flat": true, this way one would not have to write a regex to enable flat upload behaviour.