This commit is contained in:
chendelin1982 2021-09-27 17:32:10 +08:00
parent 65500eb06e
commit ba4142e7fe
7 changed files with 30 additions and 21 deletions

Binary file not shown.

View file

@ -15,12 +15,28 @@ class Print:
model.FileOp.printJson(path_repo) model.FileOp.printJson(path_repo)
class Github: class Create:
def __init__(self): def __init__(self, app_name: str, project_name: str):
pass
def gitClone(name: str): self.folder = None
cmd = "git clone --depth=1 " + model.SmoothUrl.res(github_url) + "/websoft9/docker-" + name + " repo/docker-"+name self.app_name = app_name
print(cmd) self.project_name = project_name
if self.project_name != None:
self.folder = self.project_name
else:
self.folder = self.app_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) os.system(cmd)

1
cli/drupal2 Submodule

@ -0,0 +1 @@
Subproject commit 8531fd12cacfb9881de3c270f2b81e17b20f5a99

View file

@ -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 from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Type, Union
import urllib.parse import urllib.parse

@ -0,0 +1 @@
Subproject commit 8531fd12cacfb9881de3c270f2b81e17b20f5a99

View file

@ -1,9 +1,9 @@
#!/usr/bin/env python3 #!/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 os, io, sys, platform, shutil, urllib3, json, time, subprocess
import model, controller import model, controller
import typer import typer
app = typer.Typer() app = typer.Typer()
@ -14,9 +14,11 @@ def list():
controller.Print.printRepo() controller.Print.printRepo()
@app.command() @app.command()
def gitclone(name: str): def create(app_name: str, project_name: Optional[str] = None):
'''git clone''' '''create one application'''
controller.Github.gitClone(name) create = controller.Create(app_name, project_name)
create.downRepo()
create.upRepo()
@app.command() @app.command()
def update(name: str): def update(name: str):
@ -48,16 +50,5 @@ def package(name: str):
typer.echo(f"Hello {name}") 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__": if __name__ == "__main__":
app() app()