Kaynağa Gözat

Update mfdoc, mfpub

Scott Lahteine 4 yıl önce
ebeveyn
işleme
d3a8a81756
2 değiştirilmiş dosya ile 32 ekleme ve 47 silme
  1. 2
    4
      buildroot/share/git/mfdoc
  2. 30
    43
      buildroot/share/git/mfpub

+ 2
- 4
buildroot/share/git/mfdoc Dosyayı Görüntüle

@@ -5,7 +5,7 @@
5 5
 # Start Jekyll in watch mode to work on Marlin Documentation and preview locally
6 6
 #
7 7
 
8
-[[ $# == 0 ]] || { echo "usage: `basename $0`" 1>&2 ; exit 1; }
8
+[[ $# == 0 ]] || { echo "Usage: `basename $0`" 1>&2 ; exit 1; }
9 9
 
10 10
 MFINFO=$(mfinfo "$@") || exit 1
11 11
 IFS=' ' read -a INFO <<< "$MFINFO"
@@ -16,10 +16,8 @@ BRANCH=${INFO[5]}
16 16
 [[ $ORG == "MarlinFirmware" && $REPO == "MarlinDocumentation" ]] || { echo "Wrong repository." 1>&2; exit 1; }
17 17
 
18 18
 opensite() {
19
-  which xdg-open >/dev/null && TOOL=xdg-open
20
-  which gnome-open >/dev/null && TOOL=gnome-open
21
-  which open >/dev/null && TOOL=open
22 19
   URL="http://127.0.0.1:4000/"
20
+  OPEN=$(echo $(which gnome-open xdg-open open) | awk '{ print $1 }')
23 21
   if [ -z "$OPEN" ]; then
24 22
     echo "Can't find a tool to open the URL:"
25 23
     echo $URL

+ 30
- 43
buildroot/share/git/mfpub Dosyayı Görüntüle

@@ -5,11 +5,11 @@
5 5
 # Use Jekyll to generate Marlin Documentation, which is then
6 6
 # git-pushed to Github to publish it to the live site.
7 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'.
8
+# changes to be pushed to the 'master' branch. Be sure to
9
+# push any permanent changes to 'master'.
10 10
 #
11 11
 
12
-[[ $# < 2 && $1 != "-h" && $1 != "--help" ]] || { echo "usage: `basename $0` [branch]" 1>&2 ; exit 1; }
12
+[[ $# < 2 && $1 != "-h" && $1 != "--help" ]] || { echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1; }
13 13
 
14 14
 MFINFO=$(mfinfo "$@") || exit 1
15 15
 IFS=' ' read -a INFO <<< "$MFINFO"
@@ -18,6 +18,7 @@ FORK=${INFO[1]}
18 18
 REPO=${INFO[2]}
19 19
 TARG=${INFO[3]}
20 20
 BRANCH=${INFO[4]}
21
+CURR=${INFO[5]}
21 22
 
22 23
 if [[ $ORG != "MarlinFirmware" || $REPO != "MarlinDocumentation" ]]; then
23 24
   echo "Wrong repository."
@@ -30,34 +31,46 @@ if [[ $BRANCH == "gh-pages" ]]; then
30 31
 fi
31 32
 
32 33
 # Check out the named branch (or stay in current)
33
-git checkout $BRANCH
34 34
 
35
-echo "Stashing any changes to files..."
36
-echo "Don't forget to update and push 'master'!"
37
-# GOJF Card
38
-[[ $(git stash) != "No local "* ]] && HAS_STASH=1
35
+if [[ $BRANCH != $CURR ]]; then
36
+  git checkout $BRANCH
37
+  echo "Stashing any changes to files..."
38
+  [[ $(git stash) != "No local "* ]] && HAS_STASH=1
39
+fi
39 40
 
40 41
 COMMIT=$( git log --format="%H" -n 1 )
41 42
 
42 43
 # Clean out changes and other junk in the branch
43 44
 git clean -d -f
44 45
 
46
+opensite() {
47
+  URL="$1"
48
+  OPEN=$(echo $(which gnome-open xdg-open open) | awk '{ print $1 }')
49
+  if [ -z "$OPEN" ]; then
50
+    echo "Can't find a tool to open the URL:"
51
+    echo $URL
52
+  else
53
+    echo "Opening the site in the browser..."
54
+    "$OPEN" "$URL"
55
+  fi
56
+}
57
+
45 58
 # Push 'master' to the fork and make a proper PR...
46
-if [[ $BRANCH == "master" ]]; then
59
+if [[ $BRANCH == $TARG ]]; then
47 60
 
48 61
   # Don't lose upstream changes!
49 62
   git fetch upstream
50 63
 
51 64
   # Rebase onto latest master
52
-  if git rebase upstream/master; then
65
+  if git rebase upstream/$TARG; then
53 66
 
54 67
     # Allow working directly with the main fork
55 68
     echo
56
-    echo -n "Pushing to origin/master... "
69
+    echo -n "Pushing to origin/$TARG... "
57 70
     git push -f origin
58 71
 
59 72
     echo
60
-    echo -n "Pushing to upstream/master... "
73
+    echo -n "Pushing to upstream/$TARG... "
61 74
     git push -f upstream
62 75
 
63 76
   else
@@ -77,18 +90,7 @@ else
77 90
     git push -f origin
78 91
   fi
79 92
 
80
-  which xdg-open >/dev/null && TOOL=xdg-open
81
-  which gnome-open >/dev/null && TOOL=gnome-open
82
-  which open >/dev/null && TOOL=open
83
-  URL="https://github.com/$ORG/$REPO/compare/$TARG...$FORK:$BRANCH?expand=1"
84
-
85
-  if [ -z "$OPEN" ]; then
86
-    echo "Can't find a tool to open the URL:"
87
-    echo $URL
88
-  else
89
-    echo "Opening a New PR Form..."
90
-    "$OPEN" "$URL"
91
-  fi
93
+  opensite "https://github.com/$ORG/$REPO/compare/$TARG...$FORK:$BRANCH?expand=1"
92 94
 
93 95
 fi
94 96
 
@@ -117,27 +119,14 @@ git clean -d -f
117 119
 git checkout gh-pages || { echo "Something went wrong!"; exit 1; }
118 120
 rsync -av ${TMPFOLDER}/ ./
119 121
 
120
-opensite() {
121
-  which xdg-open >/dev/null && TOOL=xdg-open
122
-  which gnome-open >/dev/null && TOOL=gnome-open
123
-  which open >/dev/null && TOOL=open
124
-  URL="http://marlinfw.org/"
125
-  if [ -z "$OPEN" ]; then
126
-    echo "Can't find a tool to open the URL:"
127
-    echo $URL
128
-  else
129
-    echo "Opening the site in the browser..."
130
-    "$OPEN" "$URL"
131
-  fi
132
-}
133
-
134 122
 # Commit and push the new live site directly
135 123
 git add --all
136 124
 git commit --message "Built from ${COMMIT}"
137
-git push upstream | {
125
+git push -f origin
126
+git push -f upstream | {
138 127
   while IFS= read -r line
139 128
   do
140
-    [[ $line =~ "gh-pages -> gh-pages" ]] && opensite
129
+    [[ $line =~ "gh-pages -> gh-pages" ]] && opensite "http://marlinfw.org/"
141 130
     echo "$line"
142 131
   done
143 132
 }
@@ -146,6 +135,4 @@ git push upstream | {
146 135
 rm -rf ${TMPFOLDER}
147 136
 
148 137
 # Go back to the branch we started from
149
-git checkout $BRANCH
150
-
151
-[[ $HAS_STASH == 1 ]] && git stash pop
138
+[[ $BRANCH != $CURR ]] && { git checkout $BRANCH ; [[ $HAS_STASH == 1 ]] && git stash pop ; }

Loading…
İptal
Kaydet