-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathupdate_workspace_diff.sh
More file actions
107 lines (74 loc) · 2.64 KB
/
update_workspace_diff.sh
File metadata and controls
107 lines (74 loc) · 2.64 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/bash
INSTALLED=~/kadai/$COURSEYEAR/
REPO=./$COURSEYEAR/env/
function ConfirmExecution() {
echo "----------------------------"
echo "テスト環境(${INSTALLED})からリポジトリに同期しますか?"
echo " 実行する場合は yes、実行をキャンセルする場合は no と入力して下さい."
read input
if [ -z $input ] ; then
echo " yes または no を入力して下さい."
ConfirmExecution
elif [ $input = 'yes' ] || [ $input = 'YES' ] || [ $input = 'y' ] ; then
echo " 同期を実行します."
ConfirmVersionUpdate
RsyncEnvironment ${INSTALLED} ${REPO}
elif [ $input = 'no' ] || [ $input = 'NO' ] || [ $input = 'n' ] ; then
echo " 同期を実行しません."
else
echo " yes または no を入力して下さい."
ConfirmExecution
fi
}
function ConfirmVersionUpdate() {
echo "----------------------------"
echo "Workspaceのバージョン番号を更新しますか?"
echo " 更新する場合は yes、しない場合は no と入力して下さい."
read input
if [ -z $input ] ; then
echo " yes または no を入力して下さい."
ConfirmVersionUpdate
elif [ $input = 'yes' ] || [ $input = 'YES' ] || [ $input = 'y' ] ; then
echo " Workspaceのバージョン番号を更新します."
UpdateVersionNumber
elif [ $input = 'no' ] || [ $input = 'NO' ] || [ $input = 'n' ] ; then
echo " バージョン番号を更新しません."
else
echo " yes または no を入力して下さい."
ConfirmVersionUpdate
fi
}
function RsyncEnvironment_old() {
echo "$1から$2への同期を行います $3"
rsync -avm --checksum $3 \
--include='*/' \
--include='.version' \
--include='settings.json' \
--include='launch.json' \
--include='org.eclipse.jdt.core.prefs' \
--include='.classpath' \
--include='.project' \
--exclude='*' \
"$1" "$2"
}
function RsyncEnvironment() {
echo "$1から$2への同期を行います $3"
rsync -avm --checksum $3 \
--include='.version' \
--exclude='.log/*' \
--exclude='*.git/' \
--exclude='*.gradle/' \
--exclude='*bin/' \
--exclude='*build/' \
"$1" "$2"
}
function UpdateVersionNumber() {
echo "./log/.versionを更新します"
echo [${COURSEYEAR}_workspace]`date "+%Y%m%d%H%M"` > ${INSTALLED}.log/.version
}
function CheckDiff() {
diff -r ${INSTALLED} ${REPO} | grep -v -e '.*\.java' -e '.*\.class' -e '.*\.git.*' -e '.*\.7z' -e '.*\.md' -e '.*\.sh' -e '.*\.history*'
}
RsyncEnvironment ${INSTALLED} ${REPO} --dry-run
CheckDiff
ConfirmExecution