Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e678776

Browse files
author
Alexander Voronkov
committedNov 29, 2017
utils/utils.py: Use bot configuration
Use COBOT_ROOT variable set in config.py instead of accessing enviroment. Fixes #384
1 parent 1f5d19f commit e678776

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎utils/utils.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Utils(BotPlugin):
1717
@botcmd(admin_only=True)
1818
def sync(self, msg, arg):
1919
"""Sync the repository from github.""" # Ignore QuotesBear
20-
repo = git.Repo(os.environ.get('COBOT_ROOT'))
20+
repo = git.Repo(self.bot_config.COBOT_ROOT)
2121
try:
2222
repo.remote('origin').pull('--rebase')
2323
yield 'Sync\'d successfully! :tada:'
@@ -27,14 +27,14 @@ def sync(self, msg, arg):
2727
@botcmd
2828
def get_head(self, msg, arg):
2929
"""Yields the head commit.""" # Ignore QuotesBear
30-
repo = git.Repo(os.environ.get('COBOT_ROOT'))
30+
repo = git.Repo(self.bot_config.COBOT_ROOT)
3131
head = repo.commit('HEAD')
3232
yield '`{}`: {}'.format(head.hexsha, head.message)
3333

3434
@botcmd(admin_only=True)
3535
def install_requirements(self, msg, arg):
3636
"""Installs requirements""" # Ignore QuotesBear
37-
os.chdir(os.environ.get('COBOT_ROOT'))
37+
os.chdir(self.bot_config.COBOT_ROOT)
3838
ran = run('pip install -r requirements.txt')
3939
yield 'installing requirements...'
4040
yield ran.stdout.read().decode('utf-8')

0 commit comments

Comments
 (0)
Please sign in to comment.