Created
October 5, 2012 04:56
-
-
Save harikt/3838180 to your computer and use it in GitHub Desktop.
A script used tp switch between all aura packages to same branch.
This file contains hidden or 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 | |
| /** | |
| * | |
| * 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