Skip to content

Instantly share code, notes, and snippets.

@harikt
Created October 5, 2012 04:56
Show Gist options
  • Select an option

  • Save harikt/3838180 to your computer and use it in GitHub Desktop.

Select an option

Save harikt/3838180 to your computer and use it in GitHub Desktop.
A script used tp switch between all aura packages to same branch.
<?php
/**
*
* A script used tp switch between all aura packages to same branch.
*
* This is still experimental one :)
*
* Usage
*
* php checkout.php <branch>
*
* Currently branches are only master and develop.
*
*/
$branch = isset( $argv[1] ) ? $argv[1] : 'develop';
switch ($branch) {
case 'develop':
case 'master':
break;
default:
echo "Expecting master or develop $branch given" . PHP_EOL;
exit;
}
$path = __DIR__ . DIRECTORY_SEPARATOR;
$package_path = $path . 'package';
$dir = new DirectoryIterator( $package_path );
foreach ($dir as $fileinfo) {
if (!$fileinfo->isDot()) {
$dirname = $fileinfo->getFilename();
if ( $dirname == '.placeholder' ) {
continue;
}
$generate[] = $dirname;
}
}
foreach ($generate as $package ) {
$destination = $package_path . DIRECTORY_SEPARATOR . $package;
echo "Switching to $branch of $package" . PHP_EOL;
passthru("cd $destination; git checkout $branch");
}
echo 'Done!' . PHP_EOL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment