Closed tiimbz closed 9 years ago
I think adding an option for the target machine OS, or the target machine path separator, would solve this. Anywhere path.join is used the code would have to find/replace to make the path separator for the target machine.
options.path_separator defaults to '/'
var releasePath = path.join(options.deploy_path, 'releases', options.release_subdir, timestamp);
if (options.path_separator = '/') {
releasePath = releasePath.replace('\', '/');
} else if (options.path_separator = '/') {
releasePath = releasePath.replace('/', '\');
}
I would probably try to stick this in a function that also calls path.join so the code copied everywhere.
I'm not sure if there are other path separators to worry about.
@hurricane766 you're right, an option to override the separator would be the cleanest approach.
For now, I've patched ssh_deploy.js on two places:
Line #60, where the path is built for the mkdir command:
var releasePath = options.deploy_path+'/releases/'+timestamp;
And line 190-191, where the symlink path is built:
var current_path = options.deploy_path + '/' + options.current_symlink;
var delete_symlink = 'rm -rf ' + current_path;
var set_symlink = 'ln -s ' + releasePath + ' ' + current_path;
can use path.posix.join
replace the path.join
I don't have a Windows machine to test this on, if someone has a fix I will accept a pull request.
I can confirm path.posix.join did the trick in Windows! Thanks @okoala . Pull request submitted.
First of all, thank you for this amazing plugin!
We are running into a problem where a member of our team is unable to deploy from his Windows machine, to our server. It fails because the release path that's being constructed at deploy is using the platform-specific "path.join". This means that if path.join is run on Windows, which is the case here, the release path gets separated by backslashes, instead of a forward slash, creating an invalid "mkdir" command on the server:
Running the same process from Mac runs fine:
Caused by ssh_deploy.js, line 60:
Any idea how to get around this?