bots: Move contrib_bots to api/bots*.

This will make it convenient to include these bots in Zulip API
releases on pypi.

Fix #5009.
This commit is contained in:
Rohitt Vashishtha 2017-05-30 11:40:19 +05:30 committed by Tim Abbott
parent d36e528fdd
commit db9918f3d6
116 changed files with 64 additions and 51 deletions

2
.gitignore vendored
View File

@ -31,4 +31,4 @@ var/*
.vscode/ .vscode/
tools/conf.ini tools/conf.ini
tools/custom_provision tools/custom_provision
contrib_bots/bots/john/assets/var/database.db api/bots/john/assets/var/database.db

View File

@ -80,7 +80,7 @@ class CommuteHandler(object):
# adds API Authentication Key to url request # adds API Authentication Key to url request
def get_api_key(self): def get_api_key(self):
# commute.config must be moved from # commute.config must be moved from
# ~/zulip/contrib_bots/bots/commute/commute.config into # ~/zulip/api/bots/commute/commute.config into
# ~/commute.config for program to work # ~/commute.config for program to work
# see readme.md for more information # see readme.md for more information
with open(CONFIG_PATH) as settings: with open(CONFIG_PATH) as settings:

View File

@ -17,7 +17,7 @@ the user home directory and add an API key.
Move Move
``` ```
~/zulip/contrib_bots/bots/commute/commute.config ~/zulip/api/bots/commute/commute.config
``` ```
into into

View File

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

View File

@ -7,6 +7,7 @@ import os
import sys import sys
our_dir = os.path.dirname(os.path.abspath(__file__)) our_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.normpath(os.path.join(our_dir)))
# For dev setups, we can find the API in the repo itself. # For dev setups, we can find the API in the repo itself.
if os.path.exists(os.path.join(our_dir, '..')): if os.path.exists(os.path.join(our_dir, '..')):
sys.path.insert(0, '..') sys.path.insert(0, '..')

View File

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 73 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -7,6 +7,7 @@ import os
import sys import sys
our_dir = os.path.dirname(os.path.abspath(__file__)) our_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.normpath(os.path.join(our_dir)))
# For dev setups, we can find the API in the repo itself. # For dev setups, we can find the API in the repo itself.
if os.path.exists(os.path.join(our_dir, '..')): if os.path.exists(os.path.join(our_dir, '..')):
sys.path.insert(0, '..') sys.path.insert(0, '..')

View File

Before

Width:  |  Height:  |  Size: 287 KiB

After

Width:  |  Height:  |  Size: 287 KiB

View File

Before

Width:  |  Height:  |  Size: 180 KiB

After

Width:  |  Height:  |  Size: 180 KiB

View File

Before

Width:  |  Height:  |  Size: 160 KiB

After

Width:  |  Height:  |  Size: 160 KiB

View File

Before

Width:  |  Height:  |  Size: 170 KiB

After

Width:  |  Height:  |  Size: 170 KiB

View File

@ -7,6 +7,7 @@ import os
import sys import sys
our_dir = os.path.dirname(os.path.abspath(__file__)) our_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.normpath(os.path.join(our_dir)))
# For dev setups, we can find the API in the repo itself. # For dev setups, we can find the API in the repo itself.
if os.path.exists(os.path.join(our_dir, '..')): if os.path.exists(os.path.join(our_dir, '..')):
sys.path.insert(0, '..') sys.path.insert(0, '..')

View File

@ -9,11 +9,11 @@ from six.moves import configparser as cp
from six.moves import range from six.moves import range
home = expanduser('~') home = expanduser('~')
CONFIG_PATH = home + '/zulip/contrib_bots/bots/foursquare/foursquare.config' CONFIG_PATH = home + '/zulip/api/bots/foursquare/foursquare.config'
def get_api_key(): def get_api_key():
# foursquare.config must have been moved from # foursquare.config must have been moved from
# ~/zulip/contrib_bots/bots/foursquare/foursquare.config into # ~/zulip/api/bots/foursquare/foursquare.config into
# ~/foursquare.config for program to work # ~/foursquare.config for program to work
# see readme.md for more information # see readme.md for more information
with open(CONFIG_PATH) as settings: with open(CONFIG_PATH) as settings:

View File

@ -26,8 +26,8 @@ github_token = <oauth_token> (The personal access token for the GitHub bot)
Here is an example of running the `git_hub_comment` bot from Here is an example of running the `git_hub_comment` bot from
inside a Zulip repo: inside a Zulip repo:
`cd ~/zulip/contrib_bots` `cd ~/zulip/api`
`./run.py bots/git_hub_comment/git_hub_comment.py --config-file ~/.zuliprc-prod` `bots_api/run.py bots/git_hub_comment/git_hub_comment.py --config-file ~/.zuliprc-prod`
Once the bot code starts running, you will see a Once the bot code starts running, you will see a
message explaining how to use the bot, as well as message explaining how to use the bot, as well as

View File

@ -8,6 +8,7 @@ import sys
from six.moves import zip from six.moves import zip
our_dir = os.path.dirname(os.path.abspath(__file__)) our_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.normpath(os.path.join(our_dir)))
# For dev setups, we can find the API in the repo itself. # For dev setups, we can find the API in the repo itself.
if os.path.exists(os.path.join(our_dir, '..')): if os.path.exists(os.path.join(our_dir, '..')):
sys.path.insert(0, '..') sys.path.insert(0, '..')

View File

@ -8,6 +8,7 @@ import sys
from six.moves import zip from six.moves import zip
our_dir = os.path.dirname(os.path.abspath(__file__)) our_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.normpath(os.path.join(our_dir)))
# For dev setups, we can find the API in the repo itself. # For dev setups, we can find the API in the repo itself.
if os.path.exists(os.path.join(our_dir, '..')): if os.path.exists(os.path.join(our_dir, '..')):
sys.path.insert(0, '..') sys.path.insert(0, '..')

View File

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

View File

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

View File

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 83 KiB

View File

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

View File

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 64 KiB

View File

@ -11,14 +11,14 @@ except ImportError:
raise ImportError("""It looks like you are missing chatterbot. raise ImportError("""It looks like you are missing chatterbot.
Please: pip install chatterbot""") Please: pip install chatterbot""")
CONTRIB_BOTS_DIR = os.path.dirname(os.path.abspath(__file__)) BOTS_DIR = os.path.dirname(os.path.abspath(__file__))
os.chdir(os.path.dirname(CONTRIB_BOTS_DIR)) os.chdir(os.path.dirname(BOTS_DIR))
sys.path.insert(0, os.path.dirname(CONTRIB_BOTS_DIR)) sys.path.insert(0, os.path.dirname(BOTS_DIR))
JOKES_PATH = os.path.join(CONTRIB_BOTS_DIR, 'assets/var/jokes.json') JOKES_PATH = os.path.join(BOTS_DIR, 'assets/var/jokes.json')
DATABASE_PATH = os.path.join(CONTRIB_BOTS_DIR, 'assets/var/database.db') DATABASE_PATH = os.path.join(BOTS_DIR, 'assets/var/database.db')
DIRECTORY_PATH = os.path.join(CONTRIB_BOTS_DIR, 'assets') DIRECTORY_PATH = os.path.join(BOTS_DIR, 'assets')
VAR_PATH = os.path.join(CONTRIB_BOTS_DIR, 'assets/var') VAR_PATH = os.path.join(BOTS_DIR, 'assets/var')
if not os.path.exists(DIRECTORY_PATH): if not os.path.exists(DIRECTORY_PATH):
os.makedirs(DIRECTORY_PATH) os.makedirs(DIRECTORY_PATH)

View File

@ -29,8 +29,8 @@ to messages in any of the following settings:
Here is an example of running the "follow-up" bot from Here is an example of running the "follow-up" bot from
inside a Zulip repo (and in your remote instance): inside a Zulip repo (and in your remote instance):
cd ~/zulip/contrib_bots cd ~/zulip/api
./run.py bots/followup/followup.py --config-file ~/.zuliprc-prod bots_api/run.py bots/followup/followup.py --config-file ~/.zuliprc-prod
Once the bot code starts running, you will see a Once the bot code starts running, you will see a
message explaining how to use the bot, as well as message explaining how to use the bot, as well as

View File

@ -7,6 +7,7 @@ import os
import sys import sys
our_dir = os.path.dirname(os.path.abspath(__file__)) our_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.normpath(os.path.join(our_dir)))
# For dev setups, we can find the API in the repo itself. # For dev setups, we can find the API in the repo itself.
if os.path.exists(os.path.join(our_dir, '..')): if os.path.exists(os.path.join(our_dir, '..')):
sys.path.insert(0, '..') sys.path.insert(0, '..')

View File

@ -1,4 +1,4 @@
# See zulip/contrib_bots/bots/readme.md for instructions on running this code. # See zulip/api/bots/readme.md for instructions on running this code.
from __future__ import print_function from __future__ import print_function
import sys import sys
import logging import logging

View File

@ -7,6 +7,7 @@ import os
import sys import sys
our_dir = os.path.dirname(os.path.abspath(__file__)) our_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.normpath(os.path.join(our_dir)))
# For dev setups, we can find the API in the repo itself. # For dev setups, we can find the API in the repo itself.
if os.path.exists(os.path.join(our_dir, '..')): if os.path.exists(os.path.join(our_dir, '..')):
sys.path.insert(0, '..') sys.path.insert(0, '..')

View File

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -7,6 +7,7 @@ import os
import sys import sys
our_dir = os.path.dirname(os.path.abspath(__file__)) our_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.normpath(os.path.join(our_dir)))
# For dev setups, we can find the API in the repo itself. # For dev setups, we can find the API in the repo itself.
if os.path.exists(os.path.join(our_dir, '..')): if os.path.exists(os.path.join(our_dir, '..')):
sys.path.insert(0, '..') sys.path.insert(0, '..')

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

View File

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

View File

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -8,6 +8,7 @@ import os
import sys import sys
our_dir = os.path.dirname(os.path.abspath(__file__)) our_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.normpath(os.path.join(our_dir)))
# For dev setups, we can find the API in the repo itself. # For dev setups, we can find the API in the repo itself.
if os.path.exists(os.path.join(our_dir, '..')): if os.path.exists(os.path.join(our_dir, '..')):
sys.path.insert(0, '..') sys.path.insert(0, '..')

View File

Before

Width:  |  Height:  |  Size: 229 KiB

After

Width:  |  Height:  |  Size: 229 KiB

Some files were not shown because too many files have changed in this diff Show More