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)
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)

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
import urllib.parse

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

View file

@ -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()