Skip to content

Commit a981f94

Browse files
authored
Merge pull request #1 from sitewards/absolute-symlink
feat(DeployStrategy): add absolute symlink class
2 parents 49257ee + eeae778 commit a981f94

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
/**
3+
* Composer Magento Installer
4+
*/
5+
6+
namespace MagentoHackathon\Composer\Magento\Deploystrategy;
7+
8+
/**
9+
* Absolute Symlink deploy strategy
10+
*/
11+
class AbsoluteSymlink extends Symlink
12+
{
13+
/**
14+
* @inheritdoc
15+
*/
16+
protected function symlink($relSourcePath, $destPath, $absSourcePath)
17+
{
18+
// make symlinks always absolute on windows because of #142
19+
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
20+
$absSourcePath = str_replace('/', '\\', $absSourcePath);
21+
}
22+
return symlink($absSourcePath, $destPath);
23+
}
24+
}

src/MagentoHackathon/Composer/Magento/Factory/DeploystrategyFactory.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ class DeploystrategyFactory
2222
* @var array
2323
*/
2424
protected static $strategies = array(
25-
'copy' => '\MagentoHackathon\Composer\Magento\Deploystrategy\Copy',
26-
'symlink' => '\MagentoHackathon\Composer\Magento\Deploystrategy\Symlink',
27-
'link' => '\MagentoHackathon\Composer\Magento\Deploystrategy\Link',
28-
'none' => '\MagentoHackathon\Composer\Magento\Deploystrategy\None',
25+
'copy' => '\MagentoHackathon\Composer\Magento\Deploystrategy\Copy',
26+
'symlink' => '\MagentoHackathon\Composer\Magento\Deploystrategy\Symlink',
27+
'absoluteSymlink' => '\MagentoHackathon\Composer\Magento\Deploystrategy\AbsoluteSymlink',
28+
'link' => '\MagentoHackathon\Composer\Magento\Deploystrategy\Link',
29+
'none' => '\MagentoHackathon\Composer\Magento\Deploystrategy\None',
2930
);
3031

3132
/**

0 commit comments

Comments
 (0)