My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

mfpub 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #!/usr/bin/env bash
  2. #
  3. # mfpub
  4. #
  5. # Use Jekyll to generate Marlin Documentation, which is then
  6. # git-pushed to Github to publish it to the live site.
  7. # This publishes the current branch, and doesn't force
  8. # changes to be pushed to the 'master' branch. Be sure to push
  9. # any permanent changes to 'master'.
  10. #
  11. [[ $# < 2 ]] || { echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1; }
  12. MFINFO=$(mfinfo "$@") || exit 1
  13. IFS=' ' read -a INFO <<< "$MFINFO"
  14. ORG=${INFO[0]}
  15. FORK=${INFO[1]}
  16. REPO=${INFO[2]}
  17. TARG=${INFO[3]}
  18. BRANCH=${INFO[4]}
  19. if [[ $ORG != "MarlinFirmware" || $REPO != "MarlinDocumentation" ]]; then
  20. echo "Wrong repository."
  21. exit
  22. fi
  23. # Check out the named branch (or stay in current)
  24. git checkout $BRANCH
  25. if [[ $BRANCH == "gh-pages" ]]; then
  26. echo "Can't build from 'gh-pages.' Only the Jekyll branches (based on 'master')."
  27. exit
  28. fi
  29. echo "Stashing any changes to files..."
  30. echo "Don't forget to update and push 'master'!"
  31. # GOJF Card
  32. git stash
  33. COMMIT=$( git log --format="%H" -n 1 )
  34. # Clean out changes and other junk in the branch
  35. git clean -d -f
  36. # Push 'master' to the fork and make a proper PR...
  37. if [[ $BRANCH == "master" ]]; then
  38. # Don't lose upstream changes!
  39. mfup
  40. # Allow working directly with the main fork
  41. echo
  42. echo -n "Pushing to origin/master... "
  43. git push -f origin
  44. echo
  45. echo -n "Pushing to upstream/master... "
  46. git push -f upstream
  47. else
  48. if [ -z "$(git branch -vv | grep ^\* | grep \\[origin)" ]; then
  49. firstpush
  50. else
  51. echo
  52. echo -n "Pushing to origin/$BRANCH... "
  53. git push -f origin
  54. fi
  55. TOOL=$(which gnome-open xdg-open open | awk '{ print $1 }')
  56. URL="https://github.com/$ORG/$REPO/compare/$TARG...$FORK:$BRANCH?expand=1"
  57. if [ -z "$TOOL" ]; then
  58. echo "Can't find a tool to open the URL:"
  59. echo $URL
  60. else
  61. echo "Opening a New PR Form..."
  62. "$TOOL" "$URL"
  63. fi
  64. fi
  65. # Uncomment to compress the final html files
  66. # mv ./_plugins/jekyll-press.rb-disabled ./_plugins/jekyll-press.rb
  67. # bundle install
  68. echo
  69. echo "Generating MarlinDocumentation..."
  70. # build the site statically and proof it
  71. bundle exec jekyll build --profile --trace --no-watch
  72. bundle exec htmlproofer ./_site --only-4xx --allow-hash-href --check-favicon --check-html --url-swap ".*marlinfw.org/:/"
  73. # Sync the built site into a temporary folder
  74. TMPFOLDER=$( mktemp -d )
  75. rsync -av _site/ ${TMPFOLDER}/
  76. # Clean out changes and other junk in the branch
  77. git reset --hard
  78. git clean -d -f
  79. # Copy built-site into the gh-pages branch
  80. git checkout gh-pages
  81. rsync -av ${TMPFOLDER}/ ./
  82. # Commit and push the new live site directly
  83. git add --all
  84. git commit --message "Built from ${COMMIT}"
  85. git push upstream
  86. # remove the temporary folder
  87. rm -rf ${TMPFOLDER}
  88. # Go back to the branch we started from
  89. git checkout $BRANCH
  90. if [[ $BRANCH != "master" ]]; then
  91. git stash pop
  92. fi