@@ -41,9 +41,13 @@ class NewCommand extends PWConnector {
4141 private $ projectName ;
4242 private $ projectDir ;
4343 private $ version ;
44+ private $ helper ;
4445 private $ compressedFilePath ;
4546 private $ requirementsErrors = array ();
47+ private $ src ;
4648 private $ installer ;
49+ private $ verbose ;
50+ protected $ downloader ;
4751 protected $ tools ;
4852
4953 /**
@@ -66,7 +70,7 @@ class NewCommand extends PWConnector {
6670 'userpass ' => '' ,
6771 'userpass_confirm ' => '' ,
6872 'useremail ' => '' ,
69- 'color ' => 'classic ' ,
73+ 'color ' => 'classic '
7074 );
7175
7276 /**
@@ -82,6 +86,7 @@ protected function configure() {
8286 ->setName ('new ' )
8387 ->setDescription ('Creates a new ProcessWire project ' )
8488 ->addArgument ('directory ' , InputArgument::OPTIONAL , 'Directory where the new project will be created ' )
89+ ->addOption ('force ' , null , InputOption::VALUE_NONE , 'Force installation in an non empty directory ' )
8590 ->addOption ('dbUser ' , null , InputOption::VALUE_REQUIRED , 'Database user ' )
8691 ->addOption ('dbPass ' , null , InputOption::VALUE_OPTIONAL , 'Database password ' )
8792 ->addOption ('dbName ' , null , InputOption::VALUE_REQUIRED , 'Database name ' )
@@ -410,9 +415,10 @@ private function download($branch) {
410415 * @throws \RuntimeException if the downloaded archive could not be extracted
411416 */
412417 private function extract () {
418+ $ forceInstall = $ this ->input ->getOption ('force ' );
413419 $ this ->tools ->writeBlockBasic ('Preparing project... ' );
414420 $ cfp = $ this ->src ? $ this ->src : $ this ->compressedFilePath ;
415- $ this ->downloader ->extract ($ cfp , $ this ->projectDir , $ this ->getName ());
421+ $ this ->downloader ->extract ($ cfp , $ this ->projectDir , $ this ->getName (), $ forceInstall );
416422
417423 return $ this ;
418424 }
0 commit comments