Skip to content
This repository has been archived by the owner on Jul 20, 2022. It is now read-only.

Commit

Permalink
Beta release 0.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
andresbott committed Feb 17, 2019
1 parent 061ce10 commit 04ae7e7
Show file tree
Hide file tree
Showing 26 changed files with 33 additions and 23 deletions.
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include LICENSE
recursive-include src/ansibleautodoc/templates *
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ Note: this project is currently in Beta, issues, ideas and pull requests are wel
* tags: the autodoc will search for used tags in the project

# Installation
## Manual
1. download / git clone this project
2. run `install.py` Note sudo is required ( I use this locally while developing)
## Manual (for dev)
1. download / git clone this project
2. cd ansible-autodoc
3. `pip install -e ./`

## Pip
using pip
Expand Down Expand Up @@ -129,11 +130,17 @@ if they have been annotated more than once or if there are tags used in more tha
* r.fprn(role_name,replace_value="Playbook"): "filter playbook role name" replace the internal playbook role name
"_ansible_playbook_" with a different value.

# changelog
# changelog

2019/02/17 - Version 0.5.1
2019/02/17 - Version 0.5.2
* FIX: run only in playbook or role project
* add -V | --version to cli
* solve pip install issues

2019/02/17 - Version 0.5.1.1
* add missing feature @example
* improve default template "readme"
* update install dependency on yaml for pip

2019/02/17 - Version 0.5.0
* added uint tests
Expand Down
13 changes: 5 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
sys.path.insert(0, os.path.abspath('src'))
from ansibleautodoc import __version__


try:
from setuptools import setup, find_packages,Command
except ImportError:
print("ansible-docgen needs setuptools in order to build. Install it using"
print("ansible-autodoc needs setuptools in order to build. Install it using"
" your package manager (usually python-setuptools) or via pip (pip"
" install setuptools).")
sys.exit(1)
Expand Down Expand Up @@ -50,9 +51,9 @@ def get_template_files():
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/AndresBott/ansible-autodoc",
package_dir={
'': 'src'},
package_dir={'': 'src'},
packages=find_packages("src"),
include_package_data=True,
classifiers=[
'Environment :: Console',
'Intended Audience :: Developers',
Expand All @@ -70,16 +71,12 @@ def get_template_files():
],
install_requires=[
'jinja2',
'yaml',
'pyyaml',
],
setup_requires=['setupext'],
scripts=[
'src/bin/ansible-autodoc',
],
data_files = [
("", ["LICENSE"]),
("templates",template_files)
],
cmdclass=cmd_classes,

)
Expand Down
12 changes: 8 additions & 4 deletions src/ansibleautodoc/AutodocCli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from ansibleautodoc.Config import SingleConfig
from ansibleautodoc.DocumentationParser import Parser
from ansibleautodoc.DocumentationGenerator import Generator
from ansibleautodoc import __version__

class AnsibleAutodoc:

Expand Down Expand Up @@ -47,6 +48,7 @@ def _cli_args(self):
parser.add_argument('-p', nargs='?', default="_unset_", help='use print template instead of writing to files, '
'sections: all, info, tags, todo, var')

parser.add_argument('-V',"--version", action='store_true', help='Get versions')

debug_level = parser.add_mutually_exclusive_group()
debug_level.add_argument('-v', action='store_true', help='Set debug level to info')
Expand All @@ -61,9 +63,6 @@ def _parse_args(self,args):
:param args:
:return: None
"""

print(args.project_dir)

self.config.set_base_dir(os.path.abspath(args.project_dir))

# search for config file
Expand All @@ -87,6 +86,11 @@ def _parse_args(self,args):
print(self.config.sample_config)
sys.exit()

# version
if args.version:
print(__version__)
sys.exit()

# Debug levels
if args.v is True:
self.log.set_level("info")
Expand Down Expand Up @@ -127,7 +131,7 @@ def _parse_args(self,args):

if self.config.is_role:
self.log.info("This is detected as: ROLE ")
elif not self.config.is_role:
elif self.config.is_role is not None and not self.config.is_role:
self.log.info("This is detected as: PLAYBOOK ")
else:
self.log.error([
Expand Down
4 changes: 2 additions & 2 deletions src/ansibleautodoc/Config.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,15 @@ def get_template_base_dir(self):
:return: str abs path
"""
if self.use_print_template:
return os.path.realpath(self.script_base_dir+"/../templates/cliprint")
return os.path.realpath(self.script_base_dir+"/templates/cliprint")

if self.template == "":
template = self.default_template
else:
template = self.template

if self.template_dir == "":
return os.path.realpath(self.script_base_dir+"/../templates/"+template)
return os.path.realpath(self.script_base_dir+"/templates/"+template)
elif os.path.isabs(self.template_dir):
return os.path.realpath(self.template_dir+"/"+template)
elif not os.path.isabs(self.template_dir):
Expand Down
2 changes: 1 addition & 1 deletion src/ansibleautodoc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name = "ansibleautodoc"
__version__ = '0.5.1'
__version__ = '0.5.2'
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ Duplicate Vars:
{% endfor %}
{% endfor %}

{{ var | pprint }}
{#{{ var | pprint }}#}
4 changes: 2 additions & 2 deletions test/ansibleautodoc/test_Config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ def test_is_role():
def test_default_template_dir():
conf = Config()
basedir = conf.get_template_base_dir()
basedir = basedir[len(project_dir):]
assert basedir == "/src/templates/readme"
sample = "ansibleautodoc/templates/readme"
assert basedir[-len(sample):] == sample

def test_get_annotation_definition():
conf = Config()
Expand Down

0 comments on commit 04ae7e7

Please sign in to comment.