-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathautomate.sh
executable file
·67 lines (62 loc) · 1.86 KB
/
automate.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash -e
function my_test() {
for f in $(find . -name README.org); do
dirname=$(basename $(dirname $f))
echo "Update for $f"
# sed -ie "s/url-external://g" $f
# rm -rf $dirname/README.orge
#exit
done
}
function refresh_wordpress() {
echo "Use emacs to update wordpress posts"
for d in "concept" "design-feature" "design-project" "resource"; do
cd "$d"
for f in $(ls -1t */README.org); do
echo "Update $f"
dirname=$(basename $(dirname $f))
cd $dirname
/Applications/Emacs.app/Contents/MacOS/Emacs-x86_64-10_10 --batch -l ../../emacs-update.el
cd ..
done
cd ..
done
}
function git_push() {
for d in $(ls -1); do
if [ -d "$d" ] && [ -f "$d/.git" ] ; then
cd "$d"
echo "In ${d}, git commit and push"
git commit -am "update doc"
git push origin
cd ..
fi
done
git commit -am "update doc"
git push origin
}
function git_pull() {
for d in $(ls -1); do
if [ -d "$d" ] && [ -f "$d/.git" ] ; then
cd "$d"
echo "In ${d}, git commit and push"
git pull origin
cd ..
fi
done
git pull origin
}
function refresh_link() {
echo "refresh link"
for f in $(ls -1t */*/README.org); do
category=$(dirname $(dirname $f))
dirname=$(basename $(dirname $f))
if ! grep "github.com\/dennyzhang\/architect.dennyzhang.com.*$dirname" $f 1>/dev/null 2>&1; then
echo "Update github fork link for $f"
sed -ie "s/github.com\/dennyzhang\/architect.dennyzhang.com.*\">/github.com\/dennyzhang\/architect.dennyzhang.com\/tree\/master\/$category\/$dirname\">/g" $f
rm -rf $category/$dirname/README.orge
fi
done
}
action=${1?}
eval "$action"