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.

mfdoc 1006B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/usr/bin/env bash
  2. #
  3. # mfdoc
  4. #
  5. # Start Jekyll in watch mode to work on Marlin Documentation and preview locally
  6. #
  7. MFINFO=$(mfinfo "$@") || exit
  8. IFS=' ' read -a INFO <<< "$MFINFO"
  9. ORG=${INFO[0]}
  10. REPO=${INFO[2]}
  11. BRANCH=${INFO[4]}
  12. if [[ $ORG != "MarlinFirmware" || $REPO != "MarlinDocumentation" ]]; then
  13. echo "Wrong repository."
  14. exit
  15. fi
  16. if [[ $BRANCH != "master" ]]; then
  17. echo "Stashing changes and changing to master."
  18. git stash
  19. git checkout master
  20. fi
  21. opensite() {
  22. TOOL=$(which gnome-open xdg-open open | awk '{ print $1 }')
  23. URL="http://127.0.0.1:4000/"
  24. if [ -z "$TOOL" ]; then
  25. echo "Can't find a tool to open the URL:"
  26. echo $URL
  27. else
  28. echo "Opening preview site in the browser..."
  29. "$TOOL" "$URL"
  30. fi
  31. }
  32. echo "Previewing MarlinDocumentation..."
  33. # wait to open the url for about 8s
  34. ( sleep 8; opensite ) &
  35. bundle exec jekyll serve --watch --incremental
  36. if [[ $BRANCH != "master" ]]; then
  37. echo "Restoring branch '$BRANCH'"
  38. git checkout $BRANCH
  39. git stash pop
  40. fi