Skip to content

Commit ab7cae0

Browse files
committed
Merge branch 'master' into add-probot-move-support
2 parents 1920962 + f2ae20b commit ab7cae0

File tree

9 files changed

+34
-496
lines changed

9 files changed

+34
-496
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ vendor/
55
*.zip
66
*.tar.gz
77
composer.lock
8+
*.log

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ install:
4141

4242
script:
4343
- composer phpunit
44-
- composer behat
44+
- ccomposer behat || composer behat-rerun
4545

4646
jobs:
4747
include:

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
},
1717
"require-dev": {
1818
"wp-cli/extension-command": "^1.2 || ^2",
19-
"wp-cli/wp-cli-tests": "^2"
19+
"wp-cli/wp-cli-tests": "^2.0.7"
2020
},
2121
"config": {
2222
"process-timeout": 7200,
@@ -51,6 +51,7 @@
5151
"prefer-stable": true,
5252
"scripts": {
5353
"behat": "run-behat-tests",
54+
"behat-rerun": "rerun-behat-tests",
5455
"lint": "run-linter-tests",
5556
"phpcs": "run-phpcs-tests",
5657
"phpunit": "run-php-unit-tests",

features/scaffold.feature

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Feature: WordPress code scaffolding
4444
When I try `wp scaffold child-theme hello-world --parent_theme=just-test --enable-network --quiet`
4545
Then STDERR should contain:
4646
"""
47-
Error: This is not a multisite install.
47+
Error: This is not a multisite install
4848
"""
4949
And the return code should be 1
5050

@@ -338,7 +338,8 @@ Feature: WordPress code scaffolding
338338
Given I run `wp theme path`
339339
And save STDOUT as {THEME_DIR}
340340
341-
When I run `wp scaffold _s starter-theme`
341+
# Allow for warnings to be generated due to https://github.com/wp-cli/scaffold-command/issues/181
342+
When I try `wp scaffold _s starter-theme`
342343
Then STDOUT should contain:
343344
"""
344345
Success: Created theme 'Starter-theme'.
@@ -351,7 +352,8 @@ Feature: WordPress code scaffolding
351352
Given I run `wp theme path`
352353
And save STDOUT as {THEME_DIR}
353354
354-
When I run `wp scaffold _s starter-theme --sassify`
355+
# Allow for warnings to be generated due to https://github.com/wp-cli/scaffold-command/issues/181
356+
When I try `wp scaffold _s starter-theme --sassify`
355357
Then STDOUT should contain:
356358
"""
357359
Success: Created theme 'Starter-theme'.
@@ -363,7 +365,8 @@ Feature: WordPress code scaffolding
363365
Given I run `wp theme path`
364366
And save STDOUT as {THEME_DIR}
365367
366-
When I run `wp scaffold _s starter-theme --woocommerce`
368+
# Allow for warnings to be generated due to https://github.com/wp-cli/scaffold-command/issues/181
369+
When I try `wp scaffold _s starter-theme --woocommerce`
367370
Then STDOUT should contain:
368371
"""
369372
Success: Created theme 'Starter-theme'.
@@ -373,7 +376,8 @@ Feature: WordPress code scaffolding
373376
374377
Scenario: Scaffold starter code for a theme and activate it
375378
Given a WP install
376-
When I run `wp scaffold _s starter-theme --activate`
379+
# Allow for warnings to be generated due to https://github.com/wp-cli/scaffold-command/issues/181
380+
When I try `wp scaffold _s starter-theme --activate`
377381
Then STDOUT should contain:
378382
"""
379383
Success: Switched to 'Starter-theme' theme.
@@ -488,7 +492,8 @@ Feature: WordPress code scaffolding
488492
489493
Scenario: Scaffold starter code for a theme and network enable it
490494
Given a WP multisite install
491-
When I run `wp scaffold _s starter-theme --enable-network`
495+
# Allow for warnings to be generated due to https://github.com/wp-cli/scaffold-command/issues/181
496+
When I try `wp scaffold _s starter-theme --enable-network`
492497
Then STDOUT should contain:
493498
"""
494499
Success: Network enabled the 'Starter-theme' theme.

src/Scaffold_Command.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,13 +400,25 @@ public function _s( $args, $assoc_args ) {
400400
$body['underscoresme_woocommerce'] = 1;
401401
}
402402

403-
$tmpfname = wp_tempnam( $url );
404-
$response = wp_remote_post( $url, array(
403+
$tmpfname = wp_tempnam( $url );
404+
$post_args = array(
405405
'timeout' => $timeout,
406406
'body' => $body,
407407
'stream' => true,
408408
'filename' => $tmpfname,
409-
) );
409+
);
410+
411+
$response = wp_remote_post( $url, $post_args );
412+
413+
// Workaround to get scaffolding to work within Travis CI.
414+
// See https://github.com/wp-cli/scaffold-command/issues/181
415+
if ( is_wp_error( $response )
416+
&& false !== strpos( $response->get_error_message(), 'gnutls_handshake() failed' ) ) {
417+
// Certificate problem, falling back to unsecured request instead.
418+
$alt_url = str_replace( 'https://', 'http://', $url );
419+
WP_CLI::warning( "Secured request to {$url} failed, using {$alt_url} as a fallback." );
420+
$response = wp_remote_post( $alt_url, $post_args );
421+
}
410422

411423
if ( is_wp_error( $response ) ) {
412424
WP_CLI::error( $response );

0 commit comments

Comments
 (0)