File tree Expand file tree Collapse file tree 3 files changed +30
-7
lines changed
Expand file tree Collapse file tree 3 files changed +30
-7
lines changed Original file line number Diff line number Diff line change 88 'package-index ' ,
99 'sample-plugin ' ,
1010 'snapshot-command ' ,
11+ 'wp-cli-dev ' ,
1112);
1213
1314$ request = 'https://api.github.com/orgs/wp-cli/repos?per_page=100 ' ;
1415$ response = shell_exec ( "curl -s {$ request }" );
1516$ repositories = json_decode ( $ response );
16-
17+ $ pwd = getcwd ();
1718
1819foreach ( $ repositories as $ repository ) {
1920 if ( in_array ( $ repository ->name , $ skip_list , true ) ) {
2021 continue ;
2122 }
2223
23- if ( is_dir ( $ repository ->name ) ) {
24- printf ( "Skipping \033[33mwp-cli/ {$ repository ->name }\033[0m, folder exists. \n" );
25- continue ;
24+ if ( ! is_dir ( $ repository ->name ) ) {
25+ printf ( "Fetching \033[32mwp-cli/ {$ repository ->name }\033[0m: \n" );
26+ system ( "git clone {$ repository ->clone_url }" );
27+ } else {
28+ printf ( "Updating \033[33mwp-cli/ {$ repository ->name }\033[0m: \n" );
29+ system ( "cd {$ repository ->name } && git checkout master && git pull; cd {$ pwd }" );
2630 }
27-
28- printf ( "Fetching \033[32mwp-cli/ {$ repository ->name }\033[0m: \n" );
29- system ( "git clone {$ repository ->clone_url }" );
3031}
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ $ repositories = glob ( '* ' , GLOB_ONLYDIR );
4+ $ pwd = getcwd ();
5+ $ symlinks = glob ( 'vendor/* ' , GLOB_ONLYDIR );
6+
7+ foreach ( $ repositories as $ repository ) {
8+ if ( ! is_dir ( "{$ repository }/vendor " ) && is_file ( "{$ repository }/composer.json " ) ) {
9+ printf ( "Symlinking \033[33mwp-cli/ {$ repository }/vendor \033[0m folder: \n" );
10+
11+ // We don't symlink the vendor folder directly, but rather create a real
12+ // vendor folder and symlink each of the subfolders instead.
13+ // This is done so that the "vendor/" rule in .gitignore still works.
14+ mkdir ( "{$ repository }/vendor " );
15+ foreach ( $ symlinks as $ symlink ) {
16+ // Symlink entries already contain the `vendor/` folder suffix.
17+ symlink ( "../../ {$ symlink }" , "{$ repository }/ {$ symlink }" );
18+ }
19+ }
20+ }
Original file line number Diff line number Diff line change 325325 "scripts" : {
326326 "pre-install-cmd" : " php .maintenance/clone-all-repositories.php" ,
327327 "pre-update-cmd" : " php .maintenance/clone-all-repositories.php" ,
328+ "post-install-cmd" : " php .maintenance/symlink-vendor-folders.php" ,
329+ "post-update-cmd" : " php .maintenance/symlink-vendor-folders.php" ,
328330 "behat" : " run-behat-tests" ,
329331 "behat-rerun" : " rerun-behat-tests" ,
330332 "lint" : " run-linter-tests" ,
You can’t perform that action at this time.
0 commit comments