Skip to content

Instantly share code, notes, and snippets.

@AlbinoDrought
Last active Apr 17, 2017
Embed
What would you like to do?
Deploying PHP to a Cygwin Windows machine using Deployer (deployer.org)
function decygwin($path) {
return preg_replace('/\/cygdrive\/(\D)\//', '$1:/', $path);
}
// use native symlinks, because non-native cygwin symlinks are not "directories": `is_dir('cygwin-symlink') == false`
set('env_vars', 'CYGWIN="winsymlinks:nativestrict"');
// cygwin release path fix
// replaces the cygwin release path (/cygdrive/c/) with the windows release path (C:/)
// increases compatibility with things like non-cygwin PHP for composer installs
// fixes "Could not open input file:" PHP errors
set('release_path', function () {
$releaseExists = run("if [ -h {{deploy_path}}/release ]; then echo 'true'; fi")->toBool();
if ($releaseExists) {
$link = run("readlink {{deploy_path}}/release")->toString();
$path = substr($link, 0, 1) === '/' ? $link : get('deploy_path') . '/' . $link;
} else {
$path = get('current_path');
}
return decygwin($path);
});
// symlink fix
// throw our environment variables before the symlink command, so cygwin creates the proper symlinks
set('bin/symlink', function () {
if (get('use_relative_symlink')) {
// Check if target system supports relative symlink.
if (run('if [[ "$(man ln)" =~ "--relative" ]]; then echo "true"; fi')->toBool()) {
$command = 'ln -nfs --relative';
}
}
if(empty($command)) {
$command = 'ln -nfs';
}
return '{{env_vars}} ' . $command;
});
@AlbinoDrought
Copy link
Author

AlbinoDrought commented Apr 17, 2017

I hope this ends up useful for anyone else who is in this unfortunate situation (deployment to a windows-based machine)

Installed the openssh, git, and curl cygwin packages and setup the openssh server as a service.

If you get this error:

setfacl: unknown option -- R

Add set('writable_mode', 'chown');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment