My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mfpub 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #!/usr/bin/env bash
  2. #
  3. # mfpub
  4. #
  5. # Use Jekyll to publish Marlin Documentation to the HTML site
  6. #
  7. MFINFO=$(mfinfo "$@") || exit
  8. IFS=' ' read -a INFO <<< "$MFINFO"
  9. ORG=${INFO[0]}
  10. FORK=${INFO[1]}
  11. REPO=${INFO[2]}
  12. TARG=${INFO[3]}
  13. BRANCH=${INFO[4]}
  14. if [[ $ORG != "MarlinFirmware" || $REPO != "MarlinDocumentation" ]]; then
  15. echo "Wrong repository."
  16. exit
  17. fi
  18. if [[ $BRANCH == "gh-pages" ]]; then
  19. echo "Can't build from 'gh-pages.' Only the Jekyll branches."
  20. bundle exec jekyll serve --watch
  21. exit
  22. fi
  23. if [[ $BRANCH != "master" ]]; then
  24. echo "Don't forget to update and push 'master'!"
  25. fi
  26. git checkout $BRANCH
  27. echo "Generating MarlinDocumentation..."
  28. # GOJF Card
  29. git stash
  30. TMPFOLDER=$( mktemp -d )
  31. COMMIT=$( git log --format="%H" -n 1 )
  32. # Clean out changes and other junk in the branch
  33. git reset --hard
  34. git clean -d -f
  35. # Push 'master' to the fork and make a proper PR...
  36. if [[ $BRANCH == "master" ]]; then
  37. if [ -z "$(git branch -vv | grep ^\* | grep \\[origin)" ]; then firstpush; fi
  38. git push -f origin
  39. TOOL=$(which gnome-open xdg-open open | awk '{ print $1 }')
  40. URL="https://github.com/$ORG/$REPO/compare/$TARG...$FORK:$BRANCH?expand=1"
  41. if [ -z "$TOOL" ]; then
  42. echo "Can't find a tool to open the URL:"
  43. echo $URL
  44. else
  45. echo "Opening a New PR Form..."
  46. "$TOOL" "$URL"
  47. fi
  48. fi
  49. # Uncomment to compress the final html files
  50. # mv ./_plugins/jekyll-press.rb-disabled ./_plugins/jekyll-press.rb
  51. # bundle install
  52. bundle exec jekyll build --profile --trace --no-watch
  53. bundle exec htmlproofer ./_site --only-4xx --allow-hash-href --check-favicon --check-html --url-swap ".*marlinfw.org/:/"
  54. rsync -av _site/ ${TMPFOLDER}/
  55. # Clean out changes and other junk in the branch
  56. git reset --hard
  57. git clean -d -f
  58. # Sync built-site with gh-pages
  59. git checkout gh-pages
  60. rsync -av ${TMPFOLDER}/ ./
  61. # Commit and push the new live site directly
  62. git add --all
  63. git commit --message "Built from ${COMMIT}"
  64. git push upstream
  65. rm -rf ${TMPFOLDER}
  66. # Go back to the branch we started from
  67. git checkout $BRANCH