Skip to content
This repository has been archived by the owner on Jun 18, 2019. It is now read-only.

Commit

Permalink
Merge pull request #1 from marvinpinto/initial-pass
Browse files Browse the repository at this point in the history
Initial commit of all the cookiecutter generated files
  • Loading branch information
marvinpinto committed Nov 28, 2015
2 parents 347762f + f1da38b commit 5d42378
Show file tree
Hide file tree
Showing 13 changed files with 329 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .gitignore
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/
28 changes: 28 additions & 0 deletions .travis.yml
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
21 changes: 21 additions & 0 deletions LICENSE.txt
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.
56 changes: 56 additions & 0 deletions Makefile
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)
71 changes: 71 additions & 0 deletions README.rst
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.
23 changes: 23 additions & 0 deletions charlesbot_pagerduty/pagerduty.py
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)
10 changes: 10 additions & 0 deletions requirements-dev.txt
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
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
charlesbot==0.7.0
wheel==0.24.0
7 changes: 7 additions & 0 deletions setup.cfg
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]
44 changes: 44 additions & 0 deletions setup.py
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 added tests/__init__.py
Empty file.
20 changes: 20 additions & 0 deletions tests/test_pagerduty.py
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

0 comments on commit 5d42378

Please sign in to comment.