Added main loop for moving through repos

This commit is contained in:
Gregory Ballantine 2016-09-14 16:58:33 -04:00
parent 60ed108749
commit b64858b442

View File

@ -28,6 +28,14 @@ def check_formula_dir(conf):
else: else:
os.makedirs(conf['formulas_dir']) os.makedirs(conf['formulas_dir'])
# loops through the array of repos and downloads them
def get_formulas(conf):
for formula in conf['formulas']:
if isinstance(formula, dict):
print('Downloading ' + str(formula['url']) + ' into ' + str(conf['formulas_dir']) + '/' + str(formula['name']))
elif isinstance(formula, str):
print('Downloading ' + str(conf['formulas_url']) + str(formula) + '-formula into ' + str(conf['formulas_dir']) + '/' + str(formula) + '-formula')
# main program # main program
def main(): def main():
# read configuration settings # read configuration settings
@ -36,5 +44,8 @@ def main():
# make sure the formulas directory exists # make sure the formulas directory exists
check_formula_dir(conf) check_formula_dir(conf)
# do the formula stuff
get_formulas(conf)
# run main # run main
main() main()