-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from DankCity/tagged-release-deploy
Tagged release deploy
- Loading branch information
Showing
7 changed files
with
160 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,3 +60,7 @@ target/ | |
|
||
#Ipython Notebook | ||
.ipynb_checkpoints | ||
|
||
# Virtual envs | ||
venv | ||
.venv* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[distutils] | ||
index-servers= | ||
pypi | ||
pypitest | ||
|
||
[pypitest] | ||
repository = https://testpypi.python.org/pypi | ||
username = levinoeckertest | ||
|
||
[pypi] | ||
repository = https://pypi.python.org/pypi | ||
username = levinoecker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
include versioneer.py | ||
include dankbot/_version.py | ||
include dankbot/sample.dankbot.ini | ||
include dankbot/dankbot.sample.ini |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
Dankbot | ||
======= | ||
|
||
|PyPIVersion| |CircleCI| |CoverageStatus| |CodeHealth| |StoriesInReady| | ||
|
||
.. |PyPIVersion| image:: https://badge.fury.io/py/dankbot.svg | ||
:target: https://badge.fury.io/py/dankbot | ||
.. |CircleCI| image:: https://circleci.com/gh/DankCity/dankbot/tree/master.svg?style=svg | ||
:target: https://circleci.com/gh/DankCity/dankbot/tree/master | ||
.. |CoverageStatus| image:: https://coveralls.io/repos/github/DankCity/dankbot/badge.svg?branch=master | ||
:target: https://coveralls.io/github/DankCity/dankbot?branch=master | ||
.. |CodeHealth| image:: https://landscape.io/github/DankCity/dankbot/master/landscape.svg?style=flat | ||
:target: https://landscape.io/github/DankCity/dankbot/master | ||
:alt: Code Health | ||
.. |StoriesInReady| https://badge.waffle.io/DankCity/dankbot.svg?label=ready&title=Ready | ||
:target: http://waffle.io/DankCity/dankbot | ||
A Slack Bot that scrapes memes from subreddits and posts them to slack | ||
|
||
## Steps to run | ||
|
||
### Clone into directory | ||
.. code-block:: shell | ||
cd /opt | ||
sudo mkdir dankbot && sudo chown <user>:<user> dankbot | ||
git clone git@github.com:DankCity/dankbot.git | ||
### Setup INI file | ||
.. code-block:: shell | ||
cd /opt/dankbot | ||
cp dankbot/dankbot.ini.sample dankbot/dankbot.ini | ||
Edit the INI file to fill in the missing token, username, and password fields: | ||
:: | ||
(.venv35)➜ dankbot git:(master) ✗ cat dankbot/dankbot.ini.sample | ||
[slack] | ||
token: <put here> | ||
channel: #random | ||
|
||
[reddit] | ||
subreddits: dankmemes, fishpost, me_irl, 4chan | ||
|
||
[imgur] | ||
client_id: <client_id> | ||
client_secret: <client Secret> | ||
|
||
[mysql] | ||
database: <db> | ||
username: <username> | ||
password: <password> | ||
|
||
[misc] | ||
include_nsfw: <boolean> | ||
max_memes: 3 | ||
|
||
### Create and activate a virtual environment | ||
.. code-block:: shell | ||
cd /opt/dankbot | ||
virtualenv --python=`which python3` env | ||
source env/bin/activate | ||
### Install the python package | ||
.. code-block:: shell | ||
cd /opt/dankbot | ||
source env/bin/activate | ||
pip install -e . | ||
### Create logging folder | ||
.. code-block:: shell | ||
sudo mkdir /var/log/dankbot | ||
sudo chown <user> /var/log/dankbot | ||
### Add an entry to your crontab: | ||
Edit the crontab with your favorite editor | ||
.. code-block:: shell | ||
sudo vi /etc/crontab | ||
And add an entry like so: | ||
:: | ||
# /etc/crontab: system-wide crontab | ||
# Unlike any other crontab you don't have to run the 'crontab' | ||
# command to install the new version when you edit this file | ||
# and files in /etc/cron.d. These files also have username fields, | ||
# that none of the other crontabs do. | ||
|
||
SHELL=/bin/sh | ||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | ||
|
||
# m h dom mon dow usernamecommand | ||
*/5 09-17 * * 1-5 root cd /opt/dankbot && source env/bin/activate && dankbot . | ||
|
||
This will run dankbot once every 5 minutes, Monday to Friday, between 9 AM and | ||
5 PM CST |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,63 @@ | ||
""" | ||
Use setup tools to setup the dankbot as a standard python module | ||
""" | ||
import versioneer | ||
from os import path | ||
from setuptools import find_packages, setup | ||
|
||
import versioneer | ||
|
||
here = path.dirname(path.abspath(__file__)) | ||
|
||
# Get the long description from the README file | ||
with open(path.join(here, 'README.rst')) as f: | ||
long_description = f.read() | ||
|
||
install_requires = [ | ||
'appdirs==1.4.0', | ||
'configparser==3.5.0', | ||
'imgurpython==1.1.7', | ||
'mysqlclient==1.3.9', | ||
'praw==3.6.0', | ||
'retryz==0.1.8', | ||
'slacker==0.9.30', | ||
] | ||
|
||
setup( | ||
name="dankbot", | ||
version=versioneer.get_version(), | ||
cmdclass=versioneer.get_cmdclass(), | ||
description="Slack bot for posting dank memes", | ||
author='Levi Noecker', | ||
author_email='levi.noecker [at] gmail [dot] com', | ||
url='https://github.com/DankCity/dankbot', | ||
keywords=['reddit', 'slack', 'imgur', 'dank', 'memes', 'bot', 'slack bot', 'dankbot'], | ||
description="Slack bot for posting dank memes from Reddit", | ||
packages=find_packages(), | ||
license='MIT', | ||
long_description=long_description, | ||
test_suite="tests", | ||
tests_require=['tox'], | ||
install_requires=install_requires, | ||
entry_points={ | ||
"console_scripts": [ | ||
"dankbot=dankbot.cli:main", | ||
] | ||
}, | ||
install_requires=[ | ||
'appdirs==1.4.0', | ||
'configparser==3.5.0', | ||
'imgurpython==1.1.7', | ||
'mysqlclient==1.3.9', | ||
'praw==3.6.0', | ||
'retryz==0.1.8', | ||
'slacker==0.9.30', | ||
classifiers=[ | ||
'Development Status :: 3 - Alpha', | ||
'Intended Audience :: Developers', | ||
'Natural Language :: English', | ||
'License :: OSI Approved :: MIT License', | ||
'Operating System :: OS Independent', | ||
'Topic :: Communications :: Chat', | ||
'Programming Language :: Python :: 2', | ||
'Programming Language :: Python :: 2.6', | ||
'Programming Language :: Python :: 2.7', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.3', | ||
'Programming Language :: Python :: 3.4', | ||
'Programming Language :: Python :: 3.5', | ||
'Programming Language :: Python :: 3.6', | ||
'Programming Language :: Python :: Implementation :: CPython', | ||
'Programming Language :: Python :: Implementation :: PyPy', | ||
], | ||
) |