Added update command for cloning
This commit is contained in:
parent
fd0b12d310
commit
1bceb5b150
2 changed files with 22 additions and 6 deletions
|
@ -8,9 +8,9 @@ def cli(private):
|
|||
if not config.has_basics():
|
||||
print("You do not have all the basic requirements set.")
|
||||
return 1
|
||||
repos.clone_public_data()
|
||||
if private:
|
||||
exit_code = repos.clone_public_data()
|
||||
if private and exit_code == 0:
|
||||
if not config.get('private_repo'):
|
||||
print("private repo not set")
|
||||
return 0
|
||||
repos.clone_public_data()
|
||||
exit_code = repos.clone_public_data()
|
||||
return exit_code
|
||||
|
|
|
@ -3,6 +3,13 @@ from . import config, constants
|
|||
|
||||
|
||||
def clone_public_data():
|
||||
if os.path.isdir(constants.PUBLIC_DATA_DIR):
|
||||
initial = os.getcwd()
|
||||
go_to_data()
|
||||
exit_code = os.system("git pull")
|
||||
os.chdir(initial)
|
||||
return exit_code
|
||||
|
||||
exit_code = os.system("git clone -b master --single-branch {} {}"
|
||||
.format(config.get('public_repo'),
|
||||
constants.PUBLIC_DATA_DIR))
|
||||
|
@ -10,6 +17,13 @@ def clone_public_data():
|
|||
|
||||
|
||||
def clone_private_data():
|
||||
exit_code = 0
|
||||
if os.path.isdir(constants.PRIVATE_DATA_DIR):
|
||||
initial = os.getcwd()
|
||||
os.chdir(constants.PRIVATE_DATA_DIR)
|
||||
exit_code = os.system("git pull")
|
||||
os.chdir(initial)
|
||||
else:
|
||||
exit_code = os.system("git clone -b master --single-branch {} {}"
|
||||
.format(config.get('private_repo'), constants.PRIVATE_DATA_DIR))
|
||||
if exit_code != 0:
|
||||
|
@ -19,6 +33,8 @@ def clone_private_data():
|
|||
constants.PRIVATE_DATA_DIR,
|
||||
constants.PUBLIC_DATA_DIR
|
||||
)
|
||||
return exit_code
|
||||
|
||||
|
||||
|
||||
def has_data(data):
|
||||
|
|
Reference in a new issue