diff --git a/features/scaffold.feature b/features/scaffold.feature index 242c6a7b2..e56bbb67a 100644 --- a/features/scaffold.feature +++ b/features/scaffold.feature @@ -355,6 +355,19 @@ Feature: WordPress code scaffolding """ And the {THEME_DIR}/starter-theme/sass directory should exist + Scenario: Scaffold starter code for a WooCommerce theme + Given a WP install + Given I run `wp theme path` + And save STDOUT as {THEME_DIR} + + When I run `wp scaffold _s starter-theme --woocommerce` + Then STDOUT should contain: + """ + Success: Created theme 'Starter-theme'. + """ + And the {THEME_DIR}/starter-theme/woocommerce.css file should exist + And the {THEME_DIR}/starter-theme/inc/woocommerce.php file should exist + Scenario: Scaffold starter code for a theme and activate it Given a WP install When I run `wp scaffold _s starter-theme --activate` diff --git a/src/Scaffold_Command.php b/src/Scaffold_Command.php index 83db147e6..c85edf8a0 100644 --- a/src/Scaffold_Command.php +++ b/src/Scaffold_Command.php @@ -340,6 +340,9 @@ public function block( $args, $assoc_args ) { * [--sassify] * : Include stylesheets as SASS. * + * [--woocommerce] + * : Include WooCommerce boilerplate files. + * * [--force] * : Overwrite files that already exist. * @@ -393,6 +396,10 @@ public function _s( $args, $assoc_args ) { $body['underscoresme_sass'] = 1; } + if ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'woocommerce' ) ) { + $body['underscoresme_woocommerce'] = 1; + } + $tmpfname = wp_tempnam( $url ); $response = wp_remote_post( $url, array( 'timeout' => $timeout,