~launchpad-pqm/launchpad/devel

2415 by Canonical.com Patch Queue Manager
[trivial] Fix missing pagetitles, improve our basic test coverage for those pages, and add utilities/check-templates.sh which verifies if all templates are registered and properly pagetitled. Only one page title missing, but that's Salgado's fault
1
#!/bin/sh
2
#
3
# Lists pages that are unregistered or missing titles
4
#
5
6
LPDIR=lib/canonical/launchpad
7
REGISTRY="lib/canonical/launchpad/zcml/*.zcml lib/canonical/*.zcml
1716.1.159 by Christian Reis
Improve check-templates removing false positives
8
          lib/canonical/launchpad/*.zcml lib/canonical/lp/*.zcml *.zcml 
9
          lib/zope/app/exception/browser/configure.zcml
10
          lib/zope/app/debugskin/configure.zcml
11
          lib/canonical/launchpad/webapp/*.zcml
1716.1.163 by Christian Reis
Removing unused page templates, and updating check-templates to deal with corner cases
12
          lib/canonical/widgets/*.py
1716.1.159 by Christian Reis
Improve check-templates removing false positives
13
          lib/canonical/launchpad/browser/*.py"
2415 by Canonical.com Patch Queue Manager
[trivial] Fix missing pagetitles, improve our basic test coverage for those pages, and add utilities/check-templates.sh which verifies if all templates are registered and properly pagetitled. Only one page title missing, but that's Salgado's fault
14
15
MASTER_MACRO='metal:use-macro="context/@@main_template/master"'
16
17
for f in $LPDIR/templates/*.pt; do 
18
    base=`basename $f`
19
    clean=`echo $base | cut -d. -f1 | tr - _`
1716.1.163 by Christian Reis
Removing unused page templates, and updating check-templates to deal with corner cases
20
    if echo $base | grep -qa ^template-; then
21
        # Ignore template-* prefixed files.
22
        continue
23
    fi
2415 by Canonical.com Patch Queue Manager
[trivial] Fix missing pagetitles, improve our basic test coverage for those pages, and add utilities/check-templates.sh which verifies if all templates are registered and properly pagetitled. Only one page title missing, but that's Salgado's fault
24
    if grep -qs $base $REGISTRY; then
25
        if grep -q $MASTER_MACRO $f; then
1716.1.163 by Christian Reis
Removing unused page templates, and updating check-templates to deal with corner cases
26
            # If this is a page that should require a title
3644.1.33 by Brad Bollenbach
move pagetitles back to the launchpad directory, with a comment explaining why it's there and not in webapp or browser
27
            grep -qs $clean $LPDIR/pagetitles.py || \
2415 by Canonical.com Patch Queue Manager
[trivial] Fix missing pagetitles, improve our basic test coverage for those pages, and add utilities/check-templates.sh which verifies if all templates are registered and properly pagetitled. Only one page title missing, but that's Salgado's fault
28
                echo "** Missing Title: $base"
29
        fi
30
    else
3644.1.33 by Brad Bollenbach
move pagetitles back to the launchpad directory, with a comment explaining why it's there and not in webapp or browser
31
        if grep $clean $LPDIR/pagetitles.py | grep -vqs ^\# ; then
1716.1.163 by Christian Reis
Removing unused page templates, and updating check-templates to deal with corner cases
32
            # Why is the page not registered but has a title listed?
2415 by Canonical.com Patch Queue Manager
[trivial] Fix missing pagetitles, improve our basic test coverage for those pages, and add utilities/check-templates.sh which verifies if all templates are registered and properly pagetitled. Only one page title missing, but that's Salgado's fault
33
            echo Not registered, but has title: $base
34
        else
35
            echo Not registered: $base
36
        fi
37
    fi
38
done
39