summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael DeHaan <michael.dehaan@gmail.com>2014-09-26 17:10:13 -0400
committerMichael DeHaan <michael.dehaan@gmail.com>2014-09-26 17:10:13 -0400
commitbceb0026a53cfa6fcf8f9e96fa694a01f2d22a1c (patch)
treec490a4bd2cc2faabf6ad696623ff4701b3bc41d5
parente5116d2f9bd851949ae50e0c9c112750e7cec761 (diff)
downloadansible-bceb0026a53cfa6fcf8f9e96fa694a01f2d22a1c.tar.gz
Updating the module formatter to deal with the new repo structure.
-rw-r--r--Makefile4
-rw-r--r--docsite/Makefile2
-rwxr-xr-xhacking/module_formatter.py17
m---------lib/ansible/modules/core10
4 files changed, 19 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index afd7162f96..d1e1e02e8a 100644
--- a/Makefile
+++ b/Makefile
@@ -91,7 +91,7 @@ NOSETESTS ?= nosetests
all: clean python
tests:
- PYTHONPATH=./lib ANSIBLE_LIBRARY=./library $(NOSETESTS) -d -w test/units -v
+ PYTHONPATH=./lib ANSIBLE_LIBRARY=./lib/ansible/modules $(NOSETESTS) -d -w test/units -v
authors:
sh hacking/authors.sh
@@ -114,7 +114,7 @@ pep8:
@echo "# Running PEP8 Compliance Tests"
@echo "#############################################"
-pep8 -r --ignore=E501,E221,W291,W391,E302,E251,E203,W293,E231,E303,E201,E225,E261,E241 lib/ bin/
- -pep8 -r --ignore=E501,E221,W291,W391,E302,E251,E203,W293,E231,E303,E201,E225,E261,E241 --filename "*" library/
+ # -pep8 -r --ignore=E501,E221,W291,W391,E302,E251,E203,W293,E231,E303,E201,E225,E261,E241 --filename "*" library/
pyflakes:
pyflakes lib/ansible/*.py lib/ansible/*/*.py bin/*
diff --git a/docsite/Makefile b/docsite/Makefile
index f5d1b10c12..92129f7851 100644
--- a/docsite/Makefile
+++ b/docsite/Makefile
@@ -40,7 +40,7 @@ clean:
.PHONEY: docs clean
modules: $(FORMATTER) ../hacking/templates/rst.j2
- PYTHONPATH=../lib $(FORMATTER) -t rst --template-dir=../hacking/templates --module-dir=../library -o rst/
+ PYTHONPATH=../lib $(FORMATTER) -t rst --template-dir=../hacking/templates --module-dir=../lib/ansible/modules -o rst/
staticmin:
cat _themes/srtd/static/css/theme.css | sed -e 's/^[ \t]*//g; s/[ \t]*$$//g; s/\([:{;,]\) /\1/g; s/ {/{/g; s/\/\*.*\*\///g; /^$$/d' | sed -e :a -e '$$!N; s/\n\(.\)/\1/; ta' > _themes/srtd/static/css/theme.min.css
diff --git a/hacking/module_formatter.py b/hacking/module_formatter.py
index f74d09ad72..c8c077a631 100755
--- a/hacking/module_formatter.py
+++ b/hacking/module_formatter.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python
# (c) 2012, Jan-Piet Mens <jpmens () gmail.com>
+# (c) 2012-2014, Michael DeHaan <michael@ansible.com> and others
#
# This file is part of Ansible
#
@@ -44,7 +45,7 @@ TO_OLD_TO_BE_NOTABLE = 1.0
# Get parent directory of the directory this script lives in
MODULEDIR=os.path.abspath(os.path.join(
- os.path.dirname(os.path.realpath(__file__)), os.pardir, 'library'
+ os.path.dirname(os.path.realpath(__file__)), os.pardir, 'lib', 'ansible', 'modules'
))
# The name of the DOCUMENTATION template
@@ -106,7 +107,9 @@ def write_data(text, options, outputname, module):
''' dumps module output to a file or the screen, as requested '''
if options.output_dir is not None:
- f = open(os.path.join(options.output_dir, outputname % module), 'w')
+ fname = os.path.join(options.output_dir, outputname % module)
+ fname = fname.replace(".py","")
+ f = open(fname, 'w')
f.write(text.encode('utf-8'))
f.close()
else:
@@ -114,23 +117,24 @@ def write_data(text, options, outputname, module):
#####################################################################################
+
def list_modules(module_dir):
''' returns a hash of categories, each category being a hash of module names to file paths '''
categories = dict(all=dict())
- files = glob.glob("%s/*" % module_dir)
+ files = glob.glob("%s/*/*" % module_dir)
for d in files:
if os.path.isdir(d):
files2 = glob.glob("%s/*" % d)
for f in files2:
- if f.endswith(".ps1"):
+ if not f.endswith(".py") or f.endswith('__init__.py'):
# windows powershell modules have documentation stubs in python docstring
# format (they are not executed) so skip the ps1 format files
continue
tokens = f.split("/")
- module = tokens[-1]
+ module = tokens[-1].replace(".py","")
category = tokens[-2]
if not category in categories:
categories[category] = {}
@@ -191,7 +195,7 @@ def process_module(module, options, env, template, outputname, module_map):
fname = module_map[module]
# ignore files with extensions
- if "." in os.path.basename(fname):
+ if not os.path.basename(fname).endswith(".py"):
return
# use ansible core library to parse out doc metadata YAML and plaintext examples
@@ -201,6 +205,7 @@ def process_module(module, options, env, template, outputname, module_map):
if doc is None and module not in ansible.utils.module_docs.BLACKLIST_MODULES:
sys.stderr.write("*** ERROR: CORE MODULE MISSING DOCUMENTATION: %s, %s ***\n" % (fname, module))
sys.exit(1)
+
if doc is None:
return "SKIPPED"
diff --git a/lib/ansible/modules/core b/lib/ansible/modules/core
-Subproject 385a037cd6bc42fc64e387973c0e7ef539b04df
+Subproject 617a52b20d512a4eb5e88fdc76658b220ff8026