diff --git a/cli/__pycache__/controller.cpython-36.pyc b/cli/__pycache__/controller.cpython-36.pyc index 6277b815..e4777edd 100644 Binary files a/cli/__pycache__/controller.cpython-36.pyc and b/cli/__pycache__/controller.cpython-36.pyc differ diff --git a/cli/__pycache__/model.cpython-36.pyc b/cli/__pycache__/model.cpython-36.pyc index 2cd27207..c7402bc5 100644 Binary files a/cli/__pycache__/model.cpython-36.pyc and b/cli/__pycache__/model.cpython-36.pyc differ diff --git a/cli/controller.py b/cli/controller.py index fa185445..681ccf5d 100644 --- a/cli/controller.py +++ b/cli/controller.py @@ -15,12 +15,28 @@ class Print: model.FileOp.printJson(path_repo) -class Github: +class Create: - def __init__(self): - pass + def __init__(self, app_name: str, project_name: str): + + self.folder = None + self.app_name = app_name + self.project_name = project_name + + if self.project_name != None: + self.folder = self.project_name + else: + self.folder = self.app_name - def gitClone(name: str): - cmd = "git clone --depth=1 " + model.SmoothUrl.res(github_url) + "/websoft9/docker-" + name + " repo/docker-"+name + def downRepo(self): + cmd = "git clone --depth=1 " + model.SmoothUrl.res(github_url) + "/websoft9/docker-" + self.app_name + " " + self.folder + if os.path.exists("./"+self.folder): + print(os.path.abspath(self.folder)+" folder already exists") + else: + os.system(cmd) + + def upRepo(self): + cmd = "docker-compose -f docker-compose-production.yml --env-file .env_all up -d" print(cmd) + os.chdir(self.folder) os.system(cmd) \ No newline at end of file diff --git a/cli/drupal2 b/cli/drupal2 new file mode 160000 index 00000000..8531fd12 --- /dev/null +++ b/cli/drupal2 @@ -0,0 +1 @@ +Subproject commit 8531fd12cacfb9881de3c270f2b81e17b20f5a99 diff --git a/cli/model.py b/cli/model.py index 9d5d2e60..36c3ab25 100644 --- a/cli/model.py +++ b/cli/model.py @@ -1,5 +1,5 @@ -import os, io, sys, platform, shutil, urllib3, json, time, subprocess +import os, io, sys, platform, shutil, urllib3, json, time, subprocess, pprint from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Type, Union import urllib.parse diff --git a/cli/repo/docker-drupal2 b/cli/repo/docker-drupal2 new file mode 160000 index 00000000..8531fd12 --- /dev/null +++ b/cli/repo/docker-drupal2 @@ -0,0 +1 @@ +Subproject commit 8531fd12cacfb9881de3c270f2b81e17b20f5a99 diff --git a/cli/stackhub.py b/cli/stackhub.py index f98747a1..0a9bab23 100644 --- a/cli/stackhub.py +++ b/cli/stackhub.py @@ -1,9 +1,9 @@ #!/usr/bin/env python3 +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Type, Union import os, io, sys, platform, shutil, urllib3, json, time, subprocess import model, controller - import typer app = typer.Typer() @@ -14,9 +14,11 @@ def list(): controller.Print.printRepo() @app.command() -def gitclone(name: str): - '''git clone''' - controller.Github.gitClone(name) +def create(app_name: str, project_name: Optional[str] = None): + '''create one application''' + create = controller.Create(app_name, project_name) + create.downRepo() + create.upRepo() @app.command() def update(name: str): @@ -48,16 +50,5 @@ def package(name: str): typer.echo(f"Hello {name}") -@app.command() -def install(name: str, formal: bool = False, type: str = None): - '''install one application''' - if formal: - typer.echo(f"Goodbye Ms. {name}. Have a good day.") - else: - typer.echo(f"Bye {name}!") - - os.system("gh repo list websoft9 --public --no-archived") - - if __name__ == "__main__": app() \ No newline at end of file