Subversion Repositories oidplus

Rev

Rev 1438 | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. #!/bin/bash
  2.  
  3. # OIDplus 2.0
  4. # Copyright 2019 - 2023 Daniel Marschall, ViaThinkSoft
  5. #
  6. # Licensed under the Apache License, Version 2.0 (the "License");
  7. # you may not use this file except in compliance with the License.
  8. # You may obtain a copy of the License at
  9. #
  10. #     http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17.  
  18. echo "==============================="
  19. echo "PREPARE FOR NEW OIDPLUS VERSION"
  20. echo "==============================="
  21. echo ""
  22.  
  23. # Please make sure to do all these steps before committing ANYTHING:
  24.  
  25. # TODO: should we ask the user to do a "svn update"?
  26.  
  27. DIR=$( dirname "$0" )
  28.  
  29. # 0. Search for SPONGE (Marker invented by Terry A Davis)
  30. echo "0. Checking for forgotten sponges"
  31. grep -r "SPONGE" | grep -v "\.svn/pristine" | grep -v "dev/release.sh"
  32. if [ $? -eq 0 ]; then
  33.         echo "STOP! There are missing files. Please fix this problem (remove them from the SVN)"
  34.         exit 1
  35. fi
  36.  
  37. # 1. Recommended: Run dev/vendor_update.sh and make sure new/deleted files are added/deleted from the SVN/Git working copy
  38. echo "1. Run composer vendor update? (Recommended to do regularly)"
  39. select yn in "Yes" "No"; do
  40.     case $yn in
  41.         Yes ) "$DIR"/vendor_update.sh; break;;
  42.         No ) break;;
  43.     esac
  44. done
  45.  
  46. # 2. Make sure there are no unversioned files (otherwise systemfile check will generate wrong stuff)
  47. # PLEASE MAKE SURE that the SVN/Git-Working copy has no unversioned files, otherwise they would be included in the checksum catalog
  48. echo "2. Checking unversioned files"
  49. if [ -d "$DIR"/../.svn ]; then
  50.         cd "$DIR"/.. && svn stat | grep "^?"
  51.         if [ $? -eq 0 ]; then
  52.                 echo "STOP! There are unversioned files. Please add or remove them. (Otherwise systemfile check plugin will add these files)"
  53.                 exit 1
  54.         fi
  55.         cd "$DIR"/.. && svn stat | grep "^!"
  56.         if [ $? -eq 0 ]; then
  57.                 echo "STOP! There are missing files. Please fix this problem (remove them from the SVN)"
  58.                 exit 1
  59.         fi
  60. fi
  61. if [ -d "$DIR"/../.git ]; then
  62.         cd "$DIR"/.. && git status
  63.         echo "Is everything OK? (All files committed, no unversioned stuff? Otherwise system file check plugin will not work correctly)"
  64.         select yn in "Yes" "No"; do
  65.             case $yn in
  66.                 Yes ) break;;
  67.                 No ) echo "Please fix the issue first"; exit 1;;
  68.             esac
  69.         done
  70. fi
  71.  
  72. # 3. Run dev/translation/message_regenerate.phps and translate things which are missing in plugins/viathinksoft/language/dede/messages.xml (search for "TODO")
  73. echo "3. Checking translation..."
  74. while true; do
  75.         "$DIR"/translation/message_regenerate.phps
  76.         cat "$DIR"/../plugins/viathinksoft/language/dede/messages.xml | grep TODO > /dev/null
  77.         if [ $? -eq 0 ]; then
  78.                 echo "Problem: There are untranslated strings! Please translate them."
  79.                 sleep 2
  80.                 nano "$DIR"/../plugins/viathinksoft/language/dede/messages.xml
  81.         else
  82.                 break
  83.         fi
  84. done
  85.  
  86. # 4. Run dev/logger/verify_maskcodes.phps
  87. echo "4. Verify OIDplus Logger Maskcodes..."
  88. "$DIR"/logger/verify_maskcodes.phps
  89. if [ $? -ne 0 ]; then
  90.         echo "Please fix the issues and run release script again"
  91.         exit 1
  92. fi
  93.  
  94. # 5. Run phpstan
  95. echo "5. Running PHPSTAN..."
  96. cd "$DIR"/.. && phpstan
  97. echo "Is PHPSTAN output OK?"
  98. select yn in "Yes" "No"; do
  99.     case $yn in
  100.         Yes ) break;;
  101.         No ) echo "Please fix the issues and run release script again"; exit 1;;
  102.     esac
  103. done
  104.  
  105. # 6. Only if you want to start a new release: Add new entry to the top of changelog.json.php
  106. echo "6. Please edit changelog.json.php (add '-dev' for non-stable versions)"
  107. sleep 2
  108. while true; do
  109.     nano "$DIR"/../changelog.json.php
  110.     echo '<?php if (!@json_decode(@file_get_contents("'$DIR'/../changelog.json.php"))) exit(1);' | php
  111.     if [ $? -eq 0 ]; then
  112.         break
  113.     else
  114.         echo "JSON Syntax error! Please fix it"
  115.         sleep 2
  116.     fi
  117. done
  118.  
  119. # 7. Run plugins/viathinksoft/adminPages/902_systemfile_check/private/gen_serverside_v3
  120. echo "7. Generate system file check checksum file..."
  121. "$DIR"/../plugins/viathinksoft/adminPages/902_systemfile_check/private/gen_serverside_v3
  122.  
  123. # 8. Commit to SVN or GIT
  124. if [ -d "$DIR"/../.svn ]; then
  125.         echo "8. Committing to SVN"
  126.         svn commit
  127. elif [ -d "$DIR"/../.git ]; then
  128.         echo "8. ALL GOOD! PLEASE NOW COMMIT TO GIT"
  129. else
  130.         echo "8. ALL GOOD! YOU CAN RELEASE IT"
  131. fi
  132. exit 0
  133.  
  134. # 9. (ViaThinkSoft internal / runs automatically) Sync SVN to GitHub
  135.  
  136. # 10. (ViaThinkSoft internal / runs automatically) Run plugins/viathinksoft/adminPages/900_software_update/private/gen_serverside_git
  137. #                                                  or  plugins/viathinksoft/adminPages/900_software_update/private/gen_serverside_svn
  138. #                                                  depending wheather you want to use GIT or SVN as your development base
  139. #                                                  (Repos are read from includes/edition.ini)
  140.