Skip to content

Commit

Permalink
Merge pull request #2 from dave-shawley/releases/0.0.1
Browse files Browse the repository at this point in the history
Release 0.0.1
  • Loading branch information
dave-shawley committed Jun 6, 2016
2 parents ede41dc + 3f3c455 commit 6fbe09e
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 44 deletions.
21 changes: 21 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
language: python
python:
- '2.7'
- '3.4'
- '3.5'
sudo: false
install:
- pip install -q -r requires/development.txt
script:
- "./setup.py build_sphinx"
deploy:
provider: pypi
user: daveshawley
password:
secure: AFKcQSyfXnZGUAF5jfKZV8R5c+dFyPhJKBqaiVBaLoisOYpPksS4CBof/XTQfcB7lADWVHkIUv4vClmYaBU5CQ7XTJAwUQapDZMtNPiG7LIIxfecBeUI9kv+hnyqtVzzqZ/4cTP4J0+IqrmfePkNZ5QOgI+4pYiA/mvK6oBImx3LGc501vOxaLa9kag75u6J0ZCS0w4hq5LIhZZAWbVn963SZ4ChkAZJ7r2uzudKnQDD5EqJPLqWHzBA90sbnPkD2uin7r1BHHyKyYrxG9WcnSrqs98Hw/5AgypU2KEBS3XxJZqHI4eV5eAeG/pGmu2j51tYWG376Jnv5EaTfcFMYTsoXH2zrQjxQ3QzMi38BVIhQ+wIzcjY8nqVjT9oMpPFa8JEiPnVvES/hzdEFUjocakS/OtlePHy/6So8Dnbx25y4+YS7NnVytH6NEe6NqWuZ74CYQPiH5y+tjWL2P1QUZoka0Io1KsUSC8B+uKJpGrkbip1eQQsOm01zz2wGQ26Rb+Qrzu77iSZ75eZLCQw0zg0w26+SGHOfvB4qWNgspxrnZAeZyZTVFxuSm0yaG1CGj3vIyQD1kdIUE7sAK+XLNQefIUSgRlhP3uf3gczLo65AjnHJVyAfiBjW2M3Ffhu1rudt4DfimYjMKxwN3BFDms//ExgC0uLwaM+OYAGC4I=
distributions: sdist bdist_wheel
on:
tags: true
all_branches: true
repo: dave-shawley/sphinx-swagger
python: 3.5
7 changes: 6 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
release = '.'.join(str(v) for v in sphinxswagger.version_info[:2])
version = sphinxswagger.__version__
needs_sphinx = '1.0'
extensions = []
extensions = [
'sphinx.ext.intersphinx',
]

master_doc = 'index'
html_theme = 'alabaster'
Expand All @@ -21,3 +23,6 @@
'github_user': 'dave-shawley',
'github_repo': 'sphinx-swagger',
}
intersphinx_mapping = {
'python': ('https://docs.python.org/3', None),
}
9 changes: 9 additions & 0 deletions docs/history.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Release History
===============

`0.0.1`_ (2016 Jun 06)
----------------------
- Initial release with simple Sphinx writer+builder.

.. _Next Release: https://github.com/dave-shawley/sphinx-swagger/compare/0.0.1...HEAD
.. _0.0.1: https://github.com/dave-shawley/sphinx-swagger/compare/0.0.0...0.0.1
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@

advanced
contributing
history
12 changes: 12 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,22 @@ def read_requirements(name):
setuptools.setup(
name='sphinx-swagger',
version=sphinxswagger.__version__,
url='https://github.com/dave-shawley/sphinx-swagger',
description='Generate swagger definitions from sphinx docs',
long_description='\n'+open('README.rst').read(),
author='Dave Shawley',
author_email='[email protected]',
packages=['sphinxswagger'],
install_requires=read_requirements('installation.txt'),
classifiers=[
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Framework :: Sphinx :: Extension',
],
)
2 changes: 1 addition & 1 deletion sphinxswagger/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version_info = (0, 0, 0)
version_info = (0, 0, 1)
__version__ = '.'.join(str(v) for v in version_info)


Expand Down
49 changes: 7 additions & 42 deletions sphinxswagger/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,12 @@ def depart_desc(self, node):
return

# TODO remove this ... useful for debugging only
with open('out-{}.json'.format(len(self._swagger_doc._paths)), 'w') as f:
data = _generate_debug_tree(node)
data['signature'] = desc_signature['path']
data['url_template'] = url_template
json.dump(data, f, indent=2)
# debug_name = 'out-{}.json'.format(len(self._swagger_doc._paths))
# with open(debug_name, 'w') as f:
# data = _generate_debug_tree(node)
# data['signature'] = desc_signature['path']
# data['url_template'] = url_template
# json.dump(data, f, indent=2)
# END TODO

default = 'default'
Expand Down Expand Up @@ -216,7 +217,7 @@ def _generate_status_codes(body):
:rtype: tuple
"""
if len(body.children) > 1 or not isinstance(body[0], nodes.bullet_list):
return None
return

bullet_list = body[0]

Expand Down Expand Up @@ -314,42 +315,6 @@ def _convert_url(url):
'after {} tries'.format(start_url, attempt))


"""
{"swagger":"2.0"
,"info":{"title":"Title String"
,"description":"in Github-Flavored Markdown"
,"termsOfService":"http://swagger.io/terms/"
,"contact":{"name":"$AUTHOR_NAME"
,"email":"[email protected]"
,"url":"http://api.aweber.com/"}
,"license":{"name":"BSD"
,"url":"http://license.url"}
,"version":"$PROJECT_VERSION"}
,"host":"localhost:8000"
,"basePath":"/"
,"schemes":["http"]
,"consumes":["application/json"]
,"produces":["application/json"]
,"paths":{"/status":{"get":{"description":""
,"responses":{"200":{"description":"the application is functional"
,"schema":{"$ref":"#/definitions/Status"}}}}}}
,"definitions":{"Status":{"type":"object"
,"description":"Application status information"
,"required":["application","version","status"]
,"properties":{"application":{"type":"string"
,"description":"the name of the service"}
,"version":{"type":"string"
,"description":"the deployed application version"}
,"status":{"type":"string"
,"description":"status of the application"}}}}
,"parameters":{}
,"responses":{}
,"securityDefinitions":{}
,"security":[]
,"tags":[]}
"""


class SwaggerDocument(object):

def __init__(self):
Expand Down

0 comments on commit 6fbe09e

Please sign in to comment.