From ef47ed38f5abea346987c59caa26c341a1efd539 Mon Sep 17 00:00:00 2001 From: Brandon Lavigne Date: Mon, 4 Feb 2013 19:40:41 -0800 Subject: [PATCH] Instead of using bash unzip, using WP_CLI native theme install, with optional activate --- php/commands/scaffold.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/php/commands/scaffold.php b/php/commands/scaffold.php index 8a64ab07..5e5f466e 100644 --- a/php/commands/scaffold.php +++ b/php/commands/scaffold.php @@ -141,6 +141,9 @@ class Scaffold_Command extends WP_CLI_Command { $theme_slug = $args[0]; $theme_path = WP_CONTENT_DIR . "/themes"; + $zip_path = $theme_path.'/underscores.zip'; + $activate = ( isset( $assoc_args['activate'] ) ) ? 1 : 0; + $data = wp_parse_args( $assoc_args, array( 'theme_name' => ucfirst( $theme_slug ), 'author' => "Me", @@ -154,18 +157,15 @@ class Scaffold_Command extends WP_CLI_Command { $prepare .= ' -d underscoresme_description="'.$theme_description.'"'; $prepare .= ' -d underscoresme_generate_submit="Generate"'; $prepare .= ' -d underscoresme_generate="1"'; - $prepare .= ' http://underscores.me > '.$theme_path.'/underscores.zip'; - $prepare .= ' && unzip -d '.$theme_path.' '.$theme_path.'/underscores.zip && rm '.$theme_path.'/underscores.zip'; - - shell_exec($prepare); // Don't know the WordPress way of doing this. - - WP_CLI::success( "Created Theme: ".$data['theme_name'] ); + $prepare .= ' http://underscores.me > '.$zip_path; + shell_exec($prepare); + + WP_CLI::run_command( array( 'theme', 'install', $zip_path ), array( 'activate' => $activate ) ); - if ( isset( $assoc_args['activate'] ) ) - WP_CLI::run_command( array( 'theme', 'activate', $theme_slug ) ); } + private function get_output_path( $assoc_args, $subdir ) { extract( $assoc_args, EXTR_SKIP ); -- 2.11.0