Skip to content

Commit 8eb34dc

Browse files
authored
Merge pull request #146 from wp-cli/fix/fetch-default-branch-for-github
Fetch default branch for GitHub packages
2 parents 40f331b + bcd56a0 commit 8eb34dc

File tree

4 files changed

+163
-55
lines changed

4 files changed

+163
-55
lines changed

composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222
},
2323
"config": {
2424
"process-timeout": 7200,
25-
"sort-packages": true
25+
"sort-packages": true,
26+
"allow-plugins": {
27+
"dealerdirect/phpcodesniffer-composer-installer": true
28+
}
2629
},
2730
"extra": {
2831
"branch-alias": {

features/package-install.feature

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ Feature: Install WP-CLI packages
9696
When I run `wp package uninstall yoast/wp-cli-faker`
9797
Then STDOUT should contain:
9898
"""
99-
Removing require statement
99+
Removing require statement for package 'yoast/wp-cli-faker' from
100100
"""
101101
And STDOUT should contain:
102102
"""
@@ -137,7 +137,7 @@ Feature: Install WP-CLI packages
137137
"""
138138

139139
When I try `wp package install git@github.com:wp-cli.git`
140-
Then STDERR should be:
140+
Then STDERR should contain:
141141
"""
142142
Error: Couldn't parse package name from expected path '<name>/<package>'.
143143
"""
@@ -176,7 +176,7 @@ Feature: Install WP-CLI packages
176176
When I run `wp package uninstall wp-cli/google-sitemap-generator-cli`
177177
Then STDOUT should contain:
178178
"""
179-
Removing require statement from
179+
Removing require statement for package 'wp-cli/google-sitemap-generator-cli' from
180180
"""
181181
Then STDOUT should contain:
182182
"""
@@ -310,7 +310,7 @@ Feature: Install WP-CLI packages
310310
When I run `wp package uninstall wp-cli-test/github-test-command`
311311
Then STDOUT should contain:
312312
"""
313-
Removing require statement from
313+
Removing require statement for package 'wp-cli-test/github-test-command' from
314314
"""
315315
And STDOUT should contain:
316316
"""
@@ -361,7 +361,7 @@ Feature: Install WP-CLI packages
361361
When I run `wp package uninstall wp-cli-test/github-test-command`
362362
Then STDOUT should contain:
363363
"""
364-
Removing require statement from
364+
Removing require statement for package 'wp-cli-test/github-test-command' from
365365
"""
366366
And STDOUT should contain:
367367
"""
@@ -419,7 +419,7 @@ Feature: Install WP-CLI packages
419419
When I run `wp package uninstall wp-cli-test/github-test-command`
420420
Then STDOUT should contain:
421421
"""
422-
Removing require statement from
422+
Removing require statement for package 'wp-cli-test/github-test-command' from
423423
"""
424424
And STDOUT should contain:
425425
"""
@@ -470,7 +470,7 @@ Feature: Install WP-CLI packages
470470
When I run `wp package uninstall wp-cli-test/github-test-command`
471471
Then STDOUT should contain:
472472
"""
473-
Removing require statement from
473+
Removing require statement for package 'wp-cli-test/github-test-command' from
474474
"""
475475
And STDOUT should contain:
476476
"""
@@ -521,7 +521,7 @@ Feature: Install WP-CLI packages
521521
When I run `wp package uninstall wp-cli-test/github-test-command`
522522
Then STDOUT should contain:
523523
"""
524-
Removing require statement from
524+
Removing require statement for package 'wp-cli-test/github-test-command' from
525525
"""
526526
And STDOUT should contain:
527527
"""
@@ -539,9 +539,12 @@ Feature: Install WP-CLI packages
539539
Given an empty directory
540540
541541
# Install and uninstall with case-sensitive name
542-
When I run `wp package install GeekPress/wp-rocket-cli`
543-
Then STDERR should be empty
544-
And STDOUT should match /Installing package (?:GeekPress|geekpress)\/wp-rocket-cli \(dev-master\)/
542+
When I try `wp package install GeekPress/wp-rocket-cli`
543+
Then STDERR should contain:
544+
"""
545+
Warning: Package name mismatch...Updating from git name 'GeekPress/wp-rocket-cli' to composer.json name 'wp-media/wp-rocket-cli'.
546+
"""
547+
And STDOUT should match /Installing package wp-media\/wp-rocket-cli \(dev-trunk\)/
545548
# This path is sometimes changed on Macs to prefix with /private
546549
And STDOUT should contain:
547550
"""
@@ -555,28 +558,32 @@ Feature: Install WP-CLI packages
555558
"""
556559
Success: Package installed.
557560
"""
558-
And the contents of the {PACKAGE_PATH}composer.json file should match /("?:GeekPress|geekpress)\/wp-rocket-cli"/
561+
And the contents of the {PACKAGE_PATH}composer.json file should match /"wp-media\/wp-rocket-cli"/
559562
560563
When I run `wp package list --fields=name`
561564
Then STDOUT should be a table containing rows:
562-
| name |
563-
| GeekPress/wp-rocket-cli |
565+
| name |
566+
| wp-media/wp-rocket-cli |
564567
565568
When I run `wp help rocket`
566569
Then STDOUT should contain:
567570
"""
568571
wp rocket
569572
"""
570573
571-
When I run `wp package uninstall GeekPress/wp-rocket-cli`
574+
When I try `wp package uninstall GeekPress/wp-rocket-cli`
572575
Then STDOUT should contain:
573576
"""
574-
Removing require statement from
577+
Removing require statement for package 'wp-media/wp-rocket-cli' from
575578
"""
576579
And STDOUT should contain:
577580
"""
578581
Success: Uninstalled package.
579582
"""
583+
And STDERR should contain:
584+
"""
585+
Warning: Package name mismatch...Updating from git name 'GeekPress/wp-rocket-cli' to composer.json name 'wp-media/wp-rocket-cli'.
586+
"""
580587
And the {PACKAGE_PATH}composer.json file should not contain:
581588
"""
582589
rocket
@@ -604,7 +611,7 @@ Feature: Install WP-CLI packages
604611
When I run `wp package list --fields=name`
605612
Then STDOUT should be a table containing rows:
606613
| name |
607-
| GeekPress/wp-rocket-cli |
614+
| geekpress/wp-rocket-cli |
608615
609616
When I run `wp help rocket`
610617
Then STDOUT should contain:
@@ -615,7 +622,7 @@ Feature: Install WP-CLI packages
615622
When I run `wp package uninstall geekpress/wp-rocket-cli`
616623
Then STDOUT should contain:
617624
"""
618-
Removing require statement from
625+
Removing require statement for package 'geekpress/wp-rocket-cli' from
619626
"""
620627
And STDOUT should contain:
621628
"""
@@ -718,7 +725,7 @@ Feature: Install WP-CLI packages
718725
When I run `wp package uninstall wp-cli/google-sitemap-generator-cli`
719726
Then STDOUT should contain:
720727
"""
721-
Removing require statement from
728+
Removing require statement for package 'wp-cli/google-sitemap-generator-cli' from
722729
"""
723730
And STDOUT should contain:
724731
"""
@@ -782,7 +789,7 @@ Feature: Install WP-CLI packages
782789
When I run `wp package uninstall capitalwpcli/examplecommand`
783790
Then STDOUT should contain:
784791
"""
785-
Removing require statement from
792+
Removing require statement for package 'capitalwpcli/examplecommand' from
786793
"""
787794
And STDOUT should contain:
788795
"""
@@ -837,7 +844,7 @@ Feature: Install WP-CLI packages
837844
When I run `wp package uninstall wp-cli/google-sitemap-generator-cli`
838845
Then STDOUT should contain:
839846
"""
840-
Removing require statement from
847+
Removing require statement for package 'wp-cli/google-sitemap-generator-cli' from
841848
"""
842849
And STDOUT should contain:
843850
"""
@@ -925,7 +932,7 @@ Feature: Install WP-CLI packages
925932
When I run `wp package uninstall wp-cli/community-command`
926933
Then STDOUT should contain:
927934
"""
928-
Removing require statement from
935+
Removing require statement for package 'wp-cli/community-command' from
929936
"""
930937
And STDOUT should contain:
931938
"""
@@ -1004,7 +1011,7 @@ Feature: Install WP-CLI packages
10041011
When I run `wp package uninstall wp-cli/community-command`
10051012
Then STDOUT should contain:
10061013
"""
1007-
Removing require statement from
1014+
Removing require statement for package 'wp-cli/community-command' from
10081015
"""
10091016
And STDOUT should contain:
10101017
"""

features/package.feature

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,20 @@ Feature: Manage WP-CLI packages
66
When I run `wp package browse`
77
Then STDOUT should contain:
88
"""
9-
danielbachhuber/wp-cli-reset-post-date-command
9+
runcommand/hook
1010
"""
1111

12-
When I run `wp package install danielbachhuber/wp-cli-reset-post-date-command`
12+
When I run `wp package install runcommand/hook`
1313
Then STDERR should be empty
1414

15-
When I run `wp help reset-post-date`
15+
When I run `wp help hook`
1616
Then STDERR should be empty
17+
And STDOUT should contain:
18+
"""
19+
List callbacks registered to a given action or filter.
20+
"""
1721

18-
When I try `wp --skip-packages --debug help reset-post-date`
22+
When I try `wp --skip-packages --debug help hook`
1923
Then STDERR should contain:
2024
"""
2125
Debug (bootstrap): Skipped loading packages.
@@ -28,16 +32,16 @@ Feature: Manage WP-CLI packages
2832
When I run `wp package list`
2933
Then STDOUT should contain:
3034
"""
31-
danielbachhuber/wp-cli-reset-post-date-command
35+
runcommand/hook
3236
"""
3337

34-
When I run `wp package uninstall danielbachhuber/wp-cli-reset-post-date-command`
38+
When I run `wp package uninstall runcommand/hook`
3539
Then STDERR should be empty
3640

3741
When I run `wp package list`
3842
Then STDOUT should not contain:
3943
"""
40-
danielbachhuber/wp-cli-reset-post-date-command
44+
runcommand/hook
4145
"""
4246

4347
Scenario: Run package commands early, before any bad code can break them
@@ -60,20 +64,20 @@ Feature: Manage WP-CLI packages
6064
@require-php-7.2 @broken
6165
Scenario: Revert the WP-CLI packages composer.json when fail to install/uninstall a package due to memory limit
6266
Given an empty directory
63-
When I try `{INVOKE_WP_CLI_WITH_PHP_ARGS--dmemory_limit=10M -ddisable_functions=ini_set} package install danielbachhuber/wp-cli-reset-post-date-command`
67+
When I try `{INVOKE_WP_CLI_WITH_PHP_ARGS--dmemory_limit=10M -ddisable_functions=ini_set} package install runcommand/hook`
6468
Then the return code should not be 0
6569
And STDERR should contain:
6670
"""
6771
Reverted composer.json.
6872
"""
6973

70-
When I run `wp package install danielbachhuber/wp-cli-reset-post-date-command`
74+
When I run `wp package install runcommand/hook`
7175
Then STDOUT should contain:
7276
"""
7377
Success: Package installed.
7478
"""
7579

76-
When I try `{INVOKE_WP_CLI_WITH_PHP_ARGS--dmemory_limit=10M -ddisable_functions=ini_set} package uninstall danielbachhuber/wp-cli-reset-post-date-command`
80+
When I try `{INVOKE_WP_CLI_WITH_PHP_ARGS--dmemory_limit=10M -ddisable_functions=ini_set} package uninstall runcommand/hook`
7781
Then the return code should not be 0
7882
And STDERR should contain:
7983
"""
@@ -85,7 +89,7 @@ Feature: Manage WP-CLI packages
8589
Then the {RUN_DIR}/mypackages/composer.json file should exist
8690
And save the {RUN_DIR}/mypackages/composer.json file as {MYPACKAGES_COMPOSER_JSON}
8791

88-
When I try `WP_CLI_PACKAGES_DIR={RUN_DIR}/mypackages {INVOKE_WP_CLI_WITH_PHP_ARGS--dmemory_limit=10M -ddisable_functions=ini_set} package install danielbachhuber/wp-cli-reset-post-date-command`
92+
When I try `WP_CLI_PACKAGES_DIR={RUN_DIR}/mypackages {INVOKE_WP_CLI_WITH_PHP_ARGS--dmemory_limit=10M -ddisable_functions=ini_set} package install runcommand/hook`
8993
Then the return code should not be 0
9094
And STDERR should contain:
9195
"""
@@ -118,7 +122,7 @@ Feature: Manage WP-CLI packages
118122
"""
119123
And STDOUT should be empty
120124

121-
When I try `WP_CLI_PACKAGES_DIR={RUN_DIR}/packages-bad-json wp package install danielbachhuber/wp-cli-reset-post-date-command`
125+
When I try `WP_CLI_PACKAGES_DIR={RUN_DIR}/packages-bad-json wp package install runcommand/hook`
122126
Then the return code should be 1
123127
And STDERR should contain:
124128
"""
@@ -162,7 +166,7 @@ Feature: Manage WP-CLI packages
162166
"""
163167
And save the {RUN_DIR}/packages-no-such-package/composer.json file as {NO_SUCH_PACKAGE_COMPOSER_JSON}
164168

165-
When I try `WP_CLI_PACKAGES_DIR={RUN_DIR}/packages-no-such-package wp package install danielbachhuber/wp-cli-reset-post-date-command`
169+
When I try `WP_CLI_PACKAGES_DIR={RUN_DIR}/packages-no-such-package wp package install runcommand/hook`
166170
Then the return code should be 1
167171
And STDERR should contain:
168172
"""

0 commit comments

Comments
 (0)