Created
September 29, 2015 10:10
-
-
Save fprochazka/c8ebfe1269e0f0649a70 to your computer and use it in GitHub Desktop.
Project manager tools
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function composer_update($projectDir) | |
{ | |
echo "Processing ", basename($projectDir), "\n"; | |
passthru(sprintf('composer update --working-dir %s', escapeshellarg($projectDir))); | |
} | |
$dir = getcwd(); | |
if (file_exists($dir . '/composer.json')) { | |
composer_update($dir); | |
} else { | |
foreach (glob($dir . '/*') as $subDir) { | |
if (!is_dir($subDir) || !file_exists($subDir . '/composer.json')) { | |
continue; | |
} | |
composer_update($subDir); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once __DIR__ . '/symlink.php'; | |
symlink_vendor_by_name('doctrine'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once __DIR__ . '/symlink.php'; | |
symlink_vendor_by_name('kdyby'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once __DIR__ . '/symlink.php'; | |
symlink_vendor_by_name('nette'); | |
symlink_vendor_by_name('latte'); | |
symlink_vendor_by_name('tracy'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once __DIR__ . '/symlink.php'; | |
symlink_vendor_by_name('symfony'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('LIBS_DIR', '/home/fprochazka/devel/libs'); | |
function symlink_vendor($vendorDir, $linkVendorName) | |
{ | |
echo "Processing ", basename(dirname($vendorDir)), "\n"; | |
foreach (glob($vendorDir . '/' . $linkVendorName . '/*') as $vendorLib) { | |
$libName = basename($vendorLib); | |
if (!file_exists($libSource = LIBS_DIR . '/' . $linkVendorName . '/' . $libName)) { | |
echo "- library [", $libName, "] was not found in ", LIBS_DIR, "\n"; | |
continue; | |
} | |
passthru(sprintf('rm -rf %s', escapeshellarg($vendorLib))); | |
passthru(sprintf('ln -s %s %s', escapeshellarg($libSource), escapeshellarg($vendorLib))); | |
echo " - [", $libName, "] linked\n"; | |
} | |
} | |
function symlink_vendor_by_name($vendorName) | |
{ | |
$dir = getcwd(); | |
if (file_exists($dir . '/composer.json')) { | |
symlink_vendor($dir . '/vendor', $vendorName); | |
} else { | |
foreach (glob($dir . '/*') as $subDir) { | |
if (!is_dir($subDir) || !file_exists($subDir . '/composer.json')) { | |
continue; | |
} | |
symlink_vendor($subDir . '/vendor', $vendorName); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment