Repository: girardinsamuel/masonite-inertia (language: python)

Issue:
Issue running install command
Reported by Eric Chapman (on Masonite slack) : 

Two bug to fix:
- [x] install command should be `python craft install:inertia`
- [x] the command is not working:

> When I try python craft install:inertia I got this error:
```
 [FileNotFoundError]                              
 [Errno 2] No such file or directory: '/Users/ericchapman/Documents/python/de  
 mo_masonite/venv/lib/python3.9/site-packages/masonite/inertia/commands/../sn  
 ippets/config/inertia.py'
```



Discussion / hints:

Fix patch:
diff --git a/README.md b/README.md
index 44a911b..68dbc14 100644
--- a/README.md
+++ b/README.md
@@ -110,7 +110,7 @@ HTTP_MIDDLEWARE = [
 Then install the package to get the `config/inertia.py` in your project:
 
 ```bash
-python craft inertia:install
+python craft install:inertia
 ```
 
 **Scaffold a base Vue app and a template (optional)**
diff --git a/config/inertia.py b/config/inertia.py
index e679dfa..77b49ab 100644
--- a/config/inertia.py
+++ b/config/inertia.py
@@ -27,7 +27,7 @@
 | default: app
 """
 
-ROOT_VIEW = "spa_view"
+ROOT_VIEW = "app"
 
 """
 |--------------------------------------------------------------------------
diff --git a/makefile b/makefile
index b35a87c..16f7940 100644
--- a/makefile
+++ b/makefile
@@ -11,6 +11,9 @@ init: ## Install package dependencies
 	pip install .
 	# install dev dependencies (see setup.py)
 	pip install masonite-inertia[test,dev]
+	# force correct version of cleo for tests for now
+	pip install cleo==0.8.1
+
 test: ## Run package tests
 	python -m pytest tests
 ci: ## [CI] Run package tests and lint
diff --git a/setup.py b/setup.py
index e178523..8b0708c 100644
--- a/setup.py
+++ b/setup.py
@@ -11,6 +11,7 @@
     version="2.0.0",
     packages=[
         "masonite.inertia",
+        "masonite.inertia.config",
         "masonite.inertia.providers",
         "masonite.inertia.middleware",
         "masonite.inertia.commands",
diff --git a/src/masonite/inertia/commands/InstallCommand.py b/src/masonite/inertia/commands/InstallCommand.py
index 466558d..82f99a3 100644
--- a/src/masonite/inertia/commands/InstallCommand.py
+++ b/src/masonite/inertia/commands/InstallCommand.py
@@ -1,10 +1,27 @@
 """A InstallCommand Command."""
 from cleo import Command
 import os
-from masonite.packages import create_or_append_config
+import shutil
 
 
-package_directory = os.path.dirname(os.path.realpath(__file__))
+package_root = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
+
+
+def create_if_not_exists(location, name=False):
+    if name:
+        file_name = name
+    else:
+        file_name = os.path.basename(location)
+
+    # import it into the config directory
+    config_directory = os.path.join(os.getcwd(), "config")
+
+    # if file does not exist
+    if not os.path.isfile(config_directory + "/" + file_name):
+        shutil.copyfile(location, config_directory + "/" + file_name)
+        print("\033[92mConfiguration File Created!\033[0m")
+    else:
+        print("\033[93mConfiguration File Already Exists!\033[93m")
 
 
 class InstallCommand(Command):
@@ -15,6 +32,4 @@ class InstallCommand(Command):
     """
 
     def handle(self):
-        create_or_append_config(
-            os.path.join(package_directory, "../snippets/config/inertia.py")
-        )
+        create_if_not_exists(os.path.join(package_root, "config/inertia.py"))


Test patch:
diff --git a/tests/test_commands.py b/tests/test_commands.py
new file mode 100644
index 0000000..0be13ee
--- /dev/null
+++ b/tests/test_commands.py
@@ -0,0 +1,17 @@
+from masonite.testing import TestCase
+from cleo import Application
+from cleo import CommandTester
+from src.masonite.inertia.commands.InstallCommand import InstallCommand
+
+
+class TestCommands(TestCase):
+    def setUp(self):
+        super().setUp()
+        self.application = Application()
+        self.application.add(InstallCommand())
+        cmd = self.application.find("install:inertia")
+        # self.install_cmd = CommandTester(InstallCommand())
+        self.install_cmd = CommandTester(cmd)
+
+    def test_install_package(self):
+        self.install_cmd.execute()