Skip to content

Commit

Permalink
Update main.py
Browse files Browse the repository at this point in the history
  • Loading branch information
HarryLudemann committed Nov 11, 2021
1 parent d43d164 commit 41c0ae4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ngoto/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,16 @@ def __init__(self):
self.workplace_path ='configuration/workplace/' # workplace file path
self.plugin_path = 'configuration/plugin/'
self.check_dirs()
# download plugins
# load plugins into tree
self.root = self.load_plugins(Node('root'), self.plugin_path)
self.curr_pos = self.root

def download_plugins(self):
""" Download all plugins from github dir and add to plugins dir (does not create folders) """
for url in self.get_plugins_urls():
r = requests.get(url)
with open(self.plugin_path + url.rsplit('/', 1)[-1], 'w') as f:
f.write(r.text)
# load plugins into tree
self.root = self.load_plugins(Node('root'), self.plugin_path)
self.curr_pos = self.root

def get_plugins_urls(self, path = 'https://github.com/HarryLudemann/Ngoto/tree/main/configuration/plugin/', modules = []):
""" Given string of root directory from github returns list of plugin URLS """
Expand Down

0 comments on commit 41c0ae4

Please sign in to comment.