Closed janeriklysander closed 8 years ago
Hey @janeriklysander, this is a perfectly fine way to contact me for questions on this plugin and I have a few for you.
Can you post what your src evaluates to in your files array? And what is the end result of this, for example where on your host are these files getting deployed to?
Setting the dest in your options sounds like what you want. For example, if your configuration is like so:
options: {
host: 'sample-domain.com',
dest: '/'
}
Then it should push files to sample-domain.com/
at the root, but depending on how your matching your src files you may need to put the destination there. See here
Oh great, cheers.
The src is going to evaluate to dist/client/**
and the root of the FTP site is the webroot and when I deploy now this is what gets uploaded to the root like this: wwglbn10349/dist/client/**
and I would want it as just wwglbn10349/**
, does that clarify it?
I tried putting dest: '/'
and also just dest: ''
but that doesn't place the contents of dist/client
in the webroot. Any advice?
Ahh ok, Yea try putting the dest in your files options as well, by default, this plugin mirrors your local directory structure at the dest
you configure at the root, but you can force files to push to a different root if you want by using the other dest
option. Try something like this:
ftp_push: {
production: {
options: {
authKey: "production",
host: "wwglbn10349",
dest: "/", // this says set the base of this operation to wwglbn10349/
port: 21,
hideCredentials: false
},
files: [
{
expand: true,
cwd: '.',
src: [ "<%= yeoman.dist %>/<%= yeoman.client %>/**" ],
dest: '/' // This says change the root from src to /
}
]
}
}
Adding the second dest configuration in the files object would take something like dist/client/**
and remap it to /
So instead of seeing files pushed to here: wwglbn10349/dist/client/**
, it should remap them to wwglbn10349/**
I've tried putting dest: '/'
in my files options but the results are the same I'm afraid.
This is my current configuration:
ftp_push: {
production: {
options: {
authKey: "production",
host: "wwglbn10349",
dest: "/",
port: 21
},
files: [
{
expand: true,
cwd: '.',
src: [ "<%= yeoman.dist %>/<%= yeoman.client %>/**" ],
dest: '/'
}
]
}
}
I am running version 0.4.4 if that is any help.
Hmm, that is the latest version, Ill change the label to bug and look into this a little later today. What you have above should work.
@janeriklysander
I have something for you to try. I forgot I am removing cwd from the filepath to push matched files, this supports starting at sub-directories. This would be the better approach for what your trying to do. So essentially you would specify your cwd as <%= yeoman.dist %>/<%= yeoman.client %>
and src as ['**']
. That will take everything from <%= yeoman.dist %>/<%= yeoman.client %>
and remap to dest
So the final configuration would look something like this:
ftp_push: {
production: {
options: {
authKey: "production",
host: "wwglbn10349",
dest: "/",
port: 21
},
files: [
{
expand: true,
cwd: '<%= yeoman.dist %>/<%= yeoman.client %>',
src: [ '**' ],
dest: '/'
}
]
}
}
What was happening with the first configuration was it would find files in dist/client
but the filepath was dist/client/sample.js
which it would push to your configured destination. If you specify the cwd as dist/client
and set src to ['**']
, this plugin would remove the dist/client
from the path and put sample.js
in the root as desired.
That worked like a charm, thank you very much! I was wondering what the cwd meant but I couldn't find anything in the documentation about it. Might I suggest adding something about it?
Again, thanks, everything works as intended now!
Yea I can do that. Ill create a new issue for now as a reminder as I probably wont be able to get to it til next week.
I have the following scenario in a angular-fullstack application I'm trying to write a deploy-task for:
When building the application it gets built to
dist/client
and when deploying I want it to deploy directly to the root.This is the configuration I have so far:
What I thought I could do was to simply add
dest: '/'
to that configuration and it would move all files from dist/client/\ to /**. Is this not possible or am I just doing it wrong?Sorry for posting this as an issue, I just found no other way of contacting you.