This repository has been archived by the owner on Jun 18, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
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 #1 from marvinpinto/initial-pass
Initial commit of all the cookiecutter generated files
- Loading branch information
Showing
13 changed files
with
329 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
*.py[cod] | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Packages | ||
*.egg | ||
*.egg-info | ||
dist | ||
build | ||
eggs | ||
parts | ||
bin | ||
var | ||
sdist | ||
develop-eggs | ||
.installed.cfg | ||
lib | ||
lib64 | ||
|
||
# Installer logs | ||
pip-log.txt | ||
|
||
# Unit test / coverage reports | ||
.coverage | ||
.tox | ||
nosetests.xml | ||
htmlcov | ||
|
||
# Translations | ||
*.mo | ||
|
||
# Mr Developer | ||
.mr.developer.cfg | ||
.project | ||
.pydevproject | ||
|
||
# Complexity | ||
output/*.html | ||
output/*/index.html | ||
|
||
# Sphinx | ||
docs/_build | ||
|
||
# Charlesbot | ||
development.yaml | ||
env/ |
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,28 @@ | ||
language: python | ||
sudo: false | ||
python: | ||
- "3.4" | ||
|
||
install: | ||
- pip install -U twine | ||
- make install | ||
- ./env/bin/pip install coveralls | ||
|
||
script: | ||
- make checkstyle | ||
- make test | ||
|
||
after_success: | ||
- ./env/bin/coveralls | ||
|
||
deploy: | ||
- provider: pypi | ||
user: marvinpinto | ||
password: | ||
secure: "super secure pypi hashed password using the travis gem" | ||
on: | ||
tags: true | ||
repo: marvinpinto/charlesbot-pagerduty | ||
|
||
notifications: | ||
email: false |
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,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 Marvin Pinto | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,56 @@ | ||
ENV=./env | ||
|
||
all: help | ||
|
||
help: | ||
@echo '-----------------------------------------' | ||
@echo ' Pagerduty make targets' | ||
@echo '-----------------------------------------' | ||
@echo 'help: This help' | ||
@echo 'install: Install dev dependencies' | ||
@echo 'test: Run tests' | ||
@echo 'checkstyle: Run flake8' | ||
@echo 'run: Run CharlesBOT locally' | ||
|
||
# Utility target for checking required parameters | ||
guard-%: | ||
@if [ "$($*)" = '' ]; then \ | ||
echo "Missing required $* variable."; \ | ||
exit 1; \ | ||
fi; | ||
|
||
clean: | ||
py3clean . | ||
rm -f .coverage | ||
find . -name "__pycache__" -exec /bin/rm -rf {} \; | ||
|
||
clean-all: clean | ||
rm -rf env | ||
rm -rf *.egg-info | ||
|
||
env: clean | ||
test -d $(ENV) || pyvenv-3.4 $(ENV) | ||
|
||
install: env | ||
$(ENV)/bin/pip install -r requirements-dev.txt | ||
$(ENV)/bin/pip install -e . | ||
|
||
checkstyle: install | ||
$(ENV)/bin/flake8 --max-complexity 10 charlesbot_pagerduty | ||
$(ENV)/bin/flake8 --max-complexity 10 tests | ||
|
||
test: install | ||
$(ENV)/bin/nosetests \ | ||
-v \ | ||
--with-coverage \ | ||
--cover-package=charlesbot_pagerduty \ | ||
tests | ||
|
||
run: | ||
PYTHONWARNINGS=default PYTHONASYNCIODEBUG=1 $(ENV)/bin/charlesbot | ||
|
||
# e.g. PART=major make release | ||
# e.g. PART=minor make release | ||
# e.g. PART=patch make release | ||
release: guard-PART | ||
$(ENV)/bin/bumpversion $(PART) |
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,71 @@ | ||
=============================== | ||
Pagerduty | ||
=============================== | ||
|
||
.. image:: https://img.shields.io/travis/marvinpinto/charlesbot-pagerduty/master.svg?style=flat-square | ||
:target: https://travis-ci.org/marvinpinto/charlesbot-pagerduty | ||
:alt: Travis CI | ||
.. image:: https://img.shields.io/coveralls/marvinpinto/charlesbot-pagerduty/master.svg?style=flat-square | ||
:target: https://coveralls.io/github/marvinpinto/charlesbot-pagerduty?branch=master | ||
:alt: Code Coverage | ||
.. image:: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square | ||
:target: LICENSE.txt | ||
:alt: Software License | ||
|
||
A Charlesbot__ plugin to do a really awesome thing! | ||
|
||
__ https://github.com/marvinpinto/charlesbot | ||
|
||
|
||
How does this work | ||
------------------ | ||
|
||
This plugin adds the following ``!help`` targets: | ||
|
||
.. code:: text | ||
!command - Do a thing! | ||
TODO: Fill in a description about what this plugin does and how it works. | ||
Screenshots are helpful, too! | ||
|
||
|
||
Installation | ||
------------ | ||
|
||
.. code:: bash | ||
pip install charlesbot-pagerduty | ||
Instructions for how to run Charlesbot are over at https://github.com/marvinpinto/charlesbot! | ||
|
||
|
||
Configuration | ||
------------- | ||
|
||
In your Charlesbot ``config.yaml``, enable this plugin by adding the following | ||
entry to the ``main`` section: | ||
|
||
.. code:: yaml | ||
main: | ||
enabled_plugins: | ||
- 'charlesbot_pagerduty.pagerduty.Pagerduty' | ||
TODO: If there is any more configuration, mention it here. | ||
|
||
Sample config file | ||
~~~~~~~~~~~~~~~~~~ | ||
|
||
.. code:: yaml | ||
main: | ||
slackbot_token: 'xoxb-1234' | ||
enabled_plugins: | ||
- 'charlesbot_pagerduty.pagerduty.Pagerduty' | ||
License | ||
------- | ||
See the LICENSE.txt__ file for license rights and limitations (MIT). | ||
|
||
__ ./LICENSE.txt |
Empty file.
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,23 @@ | ||
from charlesbot.base_plugin import BasePlugin | ||
from charlesbot.config import configuration | ||
import asyncio | ||
|
||
|
||
class Pagerduty(BasePlugin): | ||
|
||
def __init__(self): | ||
super().__init__("Pagerduty") | ||
self.load_config() | ||
|
||
def load_config(self): # pragma: no cover | ||
config_dict = configuration.get() | ||
self.token = config_dict['pagerduty']['config_key'] | ||
|
||
def get_help_message(self): | ||
help_msg = [] | ||
help_msg.append("!command - Does a really neat thing!") | ||
return "\n".join(help_msg) | ||
|
||
@asyncio.coroutine | ||
def process_message(self, message): | ||
self.log.info("Processing message %s" % message) |
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,10 @@ | ||
-r requirements.txt | ||
|
||
asynctest==0.4.0 | ||
bumpversion==0.5.3 | ||
coverage==3.7.1 | ||
flake8==2.4.1 | ||
mccabe==0.3.1 | ||
nose==1.3.7 | ||
pep8==1.5.7 | ||
pyflakes==0.8.1 |
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,2 @@ | ||
charlesbot==0.7.0 | ||
wheel==0.24.0 |
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,7 @@ | ||
[bumpversion] | ||
current_version = 0.1.0 | ||
commit = True | ||
tag = True | ||
message = Update the charlesbot-pagerduty version from {current_version} to {new_version} | ||
|
||
[bumpversion:file:setup.py] |
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,44 @@ | ||
from setuptools import setup, find_packages | ||
|
||
with open('README.rst') as readme_file: | ||
readme = readme_file.read() | ||
|
||
requirements = [ | ||
# TODO: add any additional package requirements here | ||
'charlesbot', | ||
] | ||
|
||
test_requirements = [ | ||
# TODO: add any additional package test requirements here | ||
'asynctest', | ||
'coverage', | ||
'flake8', | ||
] | ||
|
||
setup( | ||
name='charlesbot-pagerduty', | ||
version='0.1.0', | ||
description="A charlesbot pagerduty plugin", | ||
long_description=readme, | ||
author="Marvin Pinto", | ||
author_email='marvin@pinto.im', | ||
url='https://github.com/marvinpinto/charlesbot-pagerduty', | ||
packages=[ | ||
'charlesbot_pagerduty', | ||
], | ||
package_dir={'charlesbot_pagerduty': | ||
'charlesbot_pagerduty'}, | ||
include_package_data=True, | ||
install_requires=requirements, | ||
license="MIT", | ||
zip_safe=False, | ||
keywords='slack robot chatops charlesbot charlesbot-pagerduty', | ||
classifiers=[ | ||
'Development Status :: 3 - Alpha', | ||
'Intended Audience :: Developers', | ||
'License :: OSI Approved :: MIT License', | ||
'Programming Language :: Python :: 3.4', | ||
], | ||
test_suite='nose.collector', | ||
tests_require=test_requirements | ||
) |
Empty file.
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,20 @@ | ||
import asynctest | ||
from asynctest.mock import patch | ||
|
||
|
||
class TestPagerduty(asynctest.TestCase): | ||
|
||
def setUp(self): | ||
patcher1 = patch('charlesbot_pagerduty.pagerduty.Pagerduty.load_config') # NOQA | ||
self.addCleanup(patcher1.stop) | ||
self.mock_load_config = patcher1.start() | ||
|
||
from charlesbot_pagerduty.pagerduty import Pagerduty | ||
test_plug = Pagerduty() # NOQA | ||
|
||
def tearDown(self): | ||
pass | ||
|
||
@asynctest.ignore_loop | ||
def test_something(self): | ||
pass |