Skip to content

Commit

Permalink
Added help2man to create man pages for PAASTA-229
Browse files Browse the repository at this point in the history
  • Loading branch information
solarkennedy committed Feb 11, 2015
1 parent ff20467 commit 6ee879e
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ dist/
paasta_tools.egg-info/
debian/paasta-tools/
debian/files
docs/man/
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

docs:
tox -e docs
manpages:
tox -e build_manpages

test:
rm -rf .tox
Expand All @@ -11,7 +13,8 @@ itest: test
tox -e marathon_integration

# See the makefile in yelp_package/Makefile for packaging stuff
itest_%: itest
itest_%:
#itest
make -C yelp_package $@

release:
Expand Down
35 changes: 35 additions & 0 deletions build-manpages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

#..... so aparently we can't run paasta tools at all unless
# this dir exists
mkdir -p /nail/etc/services

mkdir -p docs/man/
. .tox/py/bin/activate

VERSION=`./paasta_tools/paasta_cli/paasta_cli.py version`

function build_man() {
COMMAND=$1
help2man --name=$COMMAND --version-string=$VERSION "./paasta_tools/paasta_cli/paasta_cli.py $COMMAND" > docs/man/paasta-$COMMAND.1
}



for FILE in paasta_tools/paasta_cli/cmds/*.py
do
BASE=`basename $FILE`
COMMAND=`echo "${BASE%.*}" | tr '_' '-'`
if [[ $COMMAND == '--init--' ]]; then
continue
fi
if [[ $COMMAND == 'start-stop-restart' ]]; then
continue
fi
build_man $COMMAND
done

# Start / stop / restart are munged in one file
for COMMAND in start stop restart; do
build_man $COMMAND
done
1 change: 1 addition & 0 deletions debian/paasta-tools.manpages
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docs/man/*.1
3 changes: 2 additions & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ export DH_OPTIONS
override_dh_auto_clean:
true

# do not call `make` as part of packaging
override_dh_auto_build:
# Don't let debian build stuff, but we do hook in here to make man pages
tox -e manpages
true

# do not call `make test` as part of packaging
Expand Down
5 changes: 5 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ deps =
changedir = docs
commands = sphinx-build -b html -d build/doctrees source build/html

[testenv:manpages]
deps =
{[testenv]deps}
commands = ./build-manpages.sh

[testenv:marathon_integration]
skipsdist=True
setenv =
Expand Down
1 change: 1 addition & 0 deletions yelp_package/dockerfiles/itest/itest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ RUN apt-get -y install python-yaml
RUN apt-get -y install python-pycurl
RUN apt-get -y install python-pytest
RUN apt-get -y install pyflakes
RUN apt-get -y install man

RUN mkdir -p /chronos-config/dependent
RUN mkdir -p /chronos-config/scheduled
Expand Down
1 change: 1 addition & 0 deletions yelp_package/dockerfiles/lucid/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ RUN apt-get -y install python-pycurl
RUN apt-get -y install python-pytest
RUN apt-get -y install pyflakes
RUN apt-get -y install python2.7
RUN apt-get -y install help2man

ENV HOME /work
ENV PWD /work
Expand Down
2 changes: 2 additions & 0 deletions yelp_package/itest/ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ for command in $PAASTA_COMMANDS
do
echo "Running 'paasta $command -h' to make sure it works"
paasta $command -h >/dev/null || (echo "paasta $command failed to execute!"; exit 1)
echo "Checking for a man page"
man -f paasta-$command
done
echo "Running 'paasta version', it should return non-zero"
paasta version || (echo "paasta version failed to execute!"; exit 1)
Expand Down

0 comments on commit 6ee879e

Please sign in to comment.