My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

mfpub 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. # Allow working directly with the main fork
  39. echo
  40. echo -n "Pushing to origin/master... "
  41. git push -f origin
  42. echo
  43. echo -n "Pushing to upstream/master... "
  44. git push -f upstream
  45. else
  46. if [ -z "$(git branch -vv | grep ^\* | grep \\[origin)" ]; then
  47. firstpush
  48. else
  49. echo
  50. echo -n "Pushing to origin/$BRANCH... "
  51. git push -f origin
  52. fi
  53. TOOL=$(which gnome-open xdg-open open | awk '{ print $1 }')
  54. URL="https://github.com/$ORG/$REPO/compare/$TARG...$FORK:$BRANCH?expand=1"
  55. if [ -z "$TOOL" ]; then
  56. echo "Can't find a tool to open the URL:"
  57. echo $URL
  58. else
  59. echo "Opening a New PR Form..."
  60. "$TOOL" "$URL"
  61. fi
  62. fi
  63. # Uncomment to compress the final html files
  64. # mv ./_plugins/jekyll-press.rb-disabled ./_plugins/jekyll-press.rb
  65. # bundle install
  66. echo
  67. echo "Generating MarlinDocumentation..."
  68. # build the site statically and proof it
  69. bundle exec jekyll build --profile --trace --no-watch
  70. bundle exec htmlproofer ./_site --only-4xx --allow-hash-href --check-favicon --check-html --url-swap ".*marlinfw.org/:/"
  71. # Sync the built site into a temporary folder
  72. TMPFOLDER=$( mktemp -d )
  73. rsync -av _site/ ${TMPFOLDER}/
  74. # Clean out changes and other junk in the branch
  75. git reset --hard
  76. git clean -d -f
  77. # Copy built-site into the gh-pages branch
  78. git checkout gh-pages
  79. rsync -av ${TMPFOLDER}/ ./
  80. # Commit and push the new live site directly
  81. git add --all
  82. git commit --message "Built from ${COMMIT}"
  83. git push upstream
  84. # remove the temporary folder
  85. rm -rf ${TMPFOLDER}
  86. # Go back to the branch we started from
  87. git checkout $BRANCH
  88. if [[ $BRANCH != "master" ]]; then
  89. git stash pop
  90. fi