Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # post-receive git-hook file for generating doxygen documentation
- # it called, when user finished push to server
- # it check if Doxyfile.cfg (doxygen config file) isset, and start doxygen for project
- #
- # important: packeges "doxygen" and "graphiz" must be installed on your operation system!
- #
- #
- # usage:
- # read more about custom hooks: http://doc.gitlab.com/ce/hooks/custom_hooks.html
- #
- #
- # 1) navigate to your repo folder:
- # $ cd /home/git/repositories/<group>/<project>.git/
- # important! only repo folder, not to ".git" subfolder!
- # right: cd /home/git/repositories/superprogram/superproj.git/
- # wrong: cd /home/git/repositories/superprogram/superproj.git/.git/
- #
- # 2) create 'custom_hooks' folder in your repo:
- # $ mkdir custom_hooks
- #
- # 3) copy this script to your 'custom_hooks' folder:
- # $ cp <path/to/this/script>/post-commit custom_hooks/
- # example: cp /home/user/post-commit custom_hooks/
- #
- # 4) change owner and group this script to 'git':
- # $ sudo chown git:git custom_hooks/post-commit
- #
- # 5) make this script executable:
- # $ sudo chmod +x custom_hooks/post-commit
- #
- # 4) open this file in text editor and set OUTPUT_DOC_DIR to apache_directory
- # note: apache_directory must have write permissions to git user
- # apache_directory must have apache "+Indexes" option:
- # (create .htaccess file with text: "Options +Indexes" without doublequotes)
- #
- # 6) share apache_directory url to your clients
- #
- # 7) enjoy =)
- # Directory for doxygen result
- # just change this line!
- # Sample value: OUTPUT_DOC_DIR="/var/www/htdocs/program_docs"
- OUTPUT_DOC_DIR="c:/dddddddd"
- # Below variables should not changed!
- # set file to write logs
- LOGFILE="/tmp/doxygen_log"
- # set path to doxygen config
- DOXYFILE="doxygen/Doxyfile.cfg"
- echo "##### Post recieve hook START" > $LOGFILE
- # check, if doxygen config file not isset -> stop script
- if [ ! -f $DOXYFILE ]; then
- echo "##### No file $DOXYFILE" >> $LOGFILE
- exit 0
- fi
- # convert "repo path" to "project name"
- # example:
- # "/home/git/repositories/superprogram/superproj.git"
- # -->
- # "superprogram__superproj"
- #
- CURRENT_DIR=`pwd`
- PROJ_NAME=`echo $CURRENT_DIR | sed -r 's/^.*\/(.*)\/(.*).git/\1__\2/'`
- RESULT_DOXYGEN_DIR="$OUTPUT_DOC_DIR/$PROJ_NAME"
- echo "##### Creating result dir: $RESULT_DOXYGEN_DIR" >> $LOGFILE
- mkdir -p $RESULT_DOXYGEN_DIR
- echo "##### start generating documentation..." >> $LOGFILE
- ( ( cat $DOXYFILE ; echo "OUTPUT_DIRECTORY=$RESULT_DOXYGEN_DIR/" ) | doxygen - ) >> $LOGFILE 2>&1
- echo "##### hook FINISH" >> $LOGFILE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement