diff --git a/src/NewCommand.php b/src/NewCommand.php
index 1335a3c..6f7e439 100644
--- a/src/NewCommand.php
+++ b/src/NewCommand.php
@@ -82,13 +82,13 @@ public function execute(InputInterface $input, OutputInterface $output)
$helper = $this->getHelper("question");
- $question = new Question("Name of your theme? (Awps) ", "Awps");
+ $question = new Question("Name of your theme? (Awps) ", null);
$themeName = $helper->ask($input, $output, $question);
- $question = new Question("PHP Namespace of your theme? (awps) ", "awps");
+ $question = new Question("PHP Namespace of your theme? (Awps) ", null);
$namespace = $helper->ask($input, $output, $question);
- $question = new Question("Description? (Alecaddd WordPress Starter theme) ", "Alecaddd WordPress Starter theme");
+ $question = new Question("Description? (Alecaddd WordPress Starter theme) ", null);
$description = $helper->ask($input, $output, $question);
$output->writeln('Downloading Package..');
@@ -206,6 +206,8 @@ private function renameAllTheThings($directory, OutputInterface $output, $themeN
return $this;
}
+ $output->writeln('Updating namespaces..');
+
$file_info = array();
$this->recursiveScanFiles($directory, $file_info);
@@ -213,12 +215,16 @@ private function renameAllTheThings($directory, OutputInterface $output, $themeN
foreach ($file_info as $file) {
$str = file_get_contents($file);
- if (! is_null($themeName)) {
- $str = str_replace("Awps", $themeName, $str);
- }
-
if (! is_null($namespace)) {
$str = str_replace("awps", $namespace, $str);
+ $str = str_replace("use Awps", "use " . $namespace, $str);
+ $str = str_replace("namespace Awps", "namespace " . $namespace, $str);
+ $str = str_replace("Awps\\", $namespace . "\\", $str);
+ $str = str_replace("Awps\Init", $namespace . "\Init", $str);
+ }
+
+ if (! is_null($themeName)) {
+ $str = str_replace("Awps", $themeName, $str);
}
if (! is_null($description)) {