Advertisement
Guest User

post-recieve

a guest
Jul 9th, 2015
585
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.61 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # post-receive git-hook file for generating doxygen documentation
  4. # it called, when user finished push to server
  5. # it check if Doxyfile.cfg (doxygen config file) isset, and start doxygen for project
  6. #
  7. # important: packeges "doxygen" and "graphiz" must be installed on your operation system!
  8. #
  9. #
  10. # usage:
  11. # read more about custom hooks: http://doc.gitlab.com/ce/hooks/custom_hooks.html
  12. #
  13. #
  14. # 1) navigate to your repo folder:
  15. #     $ cd /home/git/repositories/<group>/<project>.git/
  16. # important! only repo folder, not to ".git" subfolder!
  17. # right: cd /home/git/repositories/superprogram/superproj.git/
  18. # wrong: cd /home/git/repositories/superprogram/superproj.git/.git/
  19. #
  20. # 2) create 'custom_hooks' folder in your repo:
  21. #     $ mkdir custom_hooks
  22. #
  23. # 3) copy this script to your 'custom_hooks' folder:
  24. #     $ cp <path/to/this/script>/post-commit custom_hooks/
  25. # example: cp /home/user/post-commit custom_hooks/
  26. #
  27. # 4) change owner and group this script to 'git':
  28. #     $ sudo chown git:git custom_hooks/post-commit
  29. #
  30. # 5) make this script executable:
  31. #     $ sudo chmod +x custom_hooks/post-commit
  32. #
  33. # 4) open this file in text editor and set OUTPUT_DOC_DIR to apache_directory
  34. # note: apache_directory must have write permissions to git user
  35. #       apache_directory must have apache "+Indexes" option:
  36. #          (create .htaccess file with text: "Options +Indexes" without doublequotes)
  37. #
  38. # 6) share apache_directory url to your clients
  39. #
  40. # 7) enjoy =)
  41.  
  42.  
  43.  
  44.  
  45. # Directory for doxygen result
  46. # just change this line!
  47. # Sample value: OUTPUT_DOC_DIR="/var/www/htdocs/program_docs"
  48. OUTPUT_DOC_DIR="c:/dddddddd"
  49.  
  50.  
  51.  
  52. # Below variables should not changed!
  53.  
  54.  
  55.  
  56.  
  57.  
  58. # set file to write logs
  59. LOGFILE="/tmp/doxygen_log"
  60. # set path to doxygen config
  61. DOXYFILE="doxygen/Doxyfile.cfg"
  62.  
  63. echo "##### Post recieve hook START" > $LOGFILE
  64.  
  65. # check, if doxygen config file not isset -> stop script
  66. if [ ! -f $DOXYFILE ]; then
  67.     echo "##### No file $DOXYFILE" >> $LOGFILE
  68.     exit 0
  69. fi
  70.  
  71.  
  72.  
  73. # convert "repo path" to "project name"
  74. # example:
  75. #     "/home/git/repositories/superprogram/superproj.git"
  76. #            -->
  77. #     "superprogram__superproj"
  78. #
  79.  
  80. CURRENT_DIR=`pwd`
  81. PROJ_NAME=`echo $CURRENT_DIR | sed -r 's/^.*\/(.*)\/(.*).git/\1__\2/'`
  82.  
  83. RESULT_DOXYGEN_DIR="$OUTPUT_DOC_DIR/$PROJ_NAME"
  84.  
  85. echo "##### Creating result dir: $RESULT_DOXYGEN_DIR" >> $LOGFILE
  86. mkdir -p $RESULT_DOXYGEN_DIR
  87.  
  88.  
  89. echo "##### start generating documentation..." >> $LOGFILE
  90.  
  91. ( ( cat $DOXYFILE ; echo "OUTPUT_DIRECTORY=$RESULT_DOXYGEN_DIR/" ) | doxygen - ) >> $LOGFILE 2>&1  
  92.  
  93. echo "##### hook FINISH" >> $LOGFILE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement