M .gitignore +1 -0
@@ 2,4 2,5 @@
__pycache__
*.pyc
*.pid
+*.egg-info
venv
No newline at end of file
R __init__.py => +0 -0
A => setup.py +8 -0
@@ 0,0 1,8 @@
+from setuptools import setup, find_packages
+
+setup(
+ name="glue_boy",
+ install_requires=["Klein", "Twisted"],
+ package_dir={"": "src"},
+ packages=find_packages() + ['twisted.plugins'],
+)
A => src/glue_boy/__init__.py +3 -0
@@ 0,0 1,3 @@
+from glue_boy._service import PasteBin
+
+__all__ = ["PasteBin"]
A => src/glue_boy/_service.py +2 -0
@@ 0,0 1,2 @@
+class PasteBin:
+ pass
A => src/glue_boy/test/__init__.py +0 -0
A => src/glue_boy/test/test_glue_boy.py +5 -0
@@ 0,0 1,5 @@
+from twisted.trial.unittest import SynchronousTestCase
+
+class PasteBinTests(SynchronousTestCase):
+ def test_nothing(self):
+ pass
A => src/twisted/plugins/glue_boy_plugin.py +20 -0
@@ 0,0 1,20 @@
+from twisted import plugin
+from twisted.application import service, strports
+from twisted.python.usage import Options
+from twisted.web.server import Site
+from zope.interface import implementer
+
+class GlueBoyOptions(Options):
+ optParameters = [["listen", "l", "tcp:8080", "How to listen for requests"]]
+
+@implementer(plugin.IPlugin, service.IServiceMaker)
+class GlueBoyServiceMaker(service.Service):
+ tapname = "glue-boy"
+ description = "A stupidly simple pastebin"
+ options = GlueBoyOptions
+
+ def makeService(self, config):
+ factory = Site() # klein resource?
+ return strports.service(config['listen'], factory)
+
+makeGlueBoyService = GlueBoyServiceMaker()