From 41e78d90acae90ec2559a426bf9db61f8dbf2f37 Mon Sep 17 00:00:00 2001 From: Aidan Fitzgerald Date: Tue, 9 Oct 2018 13:16:45 -0400 Subject: [PATCH] Add support for excluded roles --- scripts/check_role_docs.py | 21 ++++++++++++++++----- scripts/docs_ignore | 11 +++++++++++ 2 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 scripts/docs_ignore diff --git a/scripts/check_role_docs.py b/scripts/check_role_docs.py index a7deb9c19..5a814bb94 100755 --- a/scripts/check_role_docs.py +++ b/scripts/check_role_docs.py @@ -2,15 +2,26 @@ ''' This script checks every role in the project and prints its name to stdout if -the role directory does not contain a README file. +the role directory does not contain a README file and it is not listed in +scripts/docs_ignore. For ease of use, you can pipe the output of this script to a file or to a clipboard utility (e.g. pbcopy on macOS, xclip on Linux). ''' -import os, glob +import os +from os.path import join as make_path +from glob import glob -for role in sorted(os.listdir("roles")): - readme_glob = os.path.join("roles", role, "README.*") - if not glob.glob(readme_glob): +def included_roles(): + all_roles = set(os.listdir("roles")) + excluded_roles = \ + map(str.rstrip, open(make_path("scripts", "docs_ignore"))) + included_roles = list(all_roles.difference(excluded_roles)) + included_roles.sort() + return included_roles + +for role in included_roles(): + readme = make_path("roles", role, "README.*") + if not glob(readme): print(role) diff --git a/scripts/docs_ignore b/scripts/docs_ignore new file mode 100644 index 000000000..d41d794ad --- /dev/null +++ b/scripts/docs_ignore @@ -0,0 +1,11 @@ +authserver +debian_schooltool +ejabberd_xs +idmgr +ajenti +moodle-1.9 +pathagar +schooltool +nodogsplash +docker +sugar-stats