-
Notifications
You must be signed in to change notification settings - Fork 0
/
mon-systems-move-to-git.sh
executable file
·182 lines (159 loc) · 3.81 KB
/
mon-systems-move-to-git.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
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#!/bin/sh
#
#
### ==============================
### :FILE-CREATED <Timestamp: #{2011-04-20T19:24:08-04:00Z}#{11163} - by MON KEY>
### :FILE mon-systems/mon-systems-move-to-git.sh
### ==============================
### :NOTE This script won't work unless $DEVHOME is in your environment
### elisp> (getenv "DEVHOME")
### shell> $DEVHOME
###
### $DEVHOME
### No doubt there are better ways of doing this with a shell script, but...
### I F*CKING HATE SHELL SCRIPTING!!!
### ==============================
### CL_MON_CODE=$DEVHOME/some/path/to/mon
MON_SYSTEM_SRC=$CL_MON_CODE/mon-systems
MON_SYSTEM_GIT=$CL_MON_CODE/mon-systems-GIT
# TESTING
#NOT_GIT_DIR=$MON_SYSTEM_GIT/non-existent-dir
# mon-systems/mon-systems-move-to-git.sh
MON_SYSTEM_FILES="mon.asd
mon-test.asd
alist.lisp
arrays.lisp
bit-twiddle.lisp
char-numeric.lisp
chars.lisp
chronos.lisp
class-doc.lisp
class-utils.lisp
compose.lisp
conditions.lisp
environ.lisp
file-dir.lisp
file-io.lisp
format.lisp
hash.lisp
image-rotate.lisp
introspect.lisp
io.lisp
loadtime-bind.lisp
macros.lisp
numbers.lisp
package.lisp
plist.lisp
regexp.lisp
seqs.lisp
specials.lisp
strings.lisp
types.lisp
LICENSE.txt
make-mon-systems-etags.sh
mon-systems-move-to-git.sh"
# $MON_SYSTEM_SRC/tests
MON_SYSTEM_TEST_FILES="defalias-test
package.lisp
testing.lisp
test.lisp
timing.lisp
timings.lisp
usec-tests.lisp"
ensure_abort_dirs ()
{
for j in `echo "$MON_SYSTEM_SRC $MON_SYSTEM_SRC/tests $MON_SYSTEM_GIT"`;do
if [ ! -d "$j" ]
then
echo "A required directory was non-existent: $j";
printf "\tdeclining to proceed further\n";
exit 1;
fi
done;
}
ensure_tests_dir ()
{
if [ ! -d "$MON_SYSTEM_GIT/tests" ]
then
mkdir -p "$MON_SYSTEM_GIT/tests";
echo "Created previously non-existent directory: $MON_SYSTEM_GIT/tests"
echo
fi
}
ensure_readme ()
{
if [ ! -e $MON_SYSTEM_GIT/README ]
then
echo "Creating empty README file: $MON_SYSTEM_GIT/README"
echo
touch $MON_SYSTEM_GIT/README
fi
}
ensure_loadtime_bind ()
{
if [ ! -e $MON_SYSTEM_GIT/loadtime-bind ]
then
echo "Creating template file: $MON_SYSTEM_GIT/loadtime-bind"
printf "\n(\"<USERNAME>\" . \"<MONIKER>\")\n\n" > $MON_SYSTEM_GIT/loadtime-bind
fi
}
copy_mon_files ()
{
for f in $MON_SYSTEM_FILES; do
if [ ! -e "$MON_SYSTEM_SRC/$f" ] # Check if file exists.
then
echo ":FILE $MON_SYSTEM_SRC/$f does not exist";
echo
else # On to next.
cp "$MON_SYSTEM_SRC/$f" "$MON_SYSTEM_GIT/$f";
echo "Copied :FILE $f";
echo "From :SOURCE $MON_SYSTEM_SRC/ to :DEST $MON_SYSTEM_GIT/";
echo
fi
done;
}
#
copy_mon_test_files ()
{
for f in $MON_SYSTEM_TEST_FILES; do
if [ ! -e "$MON_SYSTEM_SRC/tests/$f" ] # Check if file exists.
then
echo ":FILE $MON_SYSTEM_SRC/tests/$f does not exist";
echo
else # On to next.
# cp `echo $MON_SYSTEM_SRC/tests/$f $MON_SYSTEM_GIT/tests/$f`;
cp $MON_SYSTEM_SRC/tests/$f $MON_SYSTEM_GIT/tests/$f;
echo "Copied :FILE $f";
echo "From :SOURCE $MON_SYSTEM_SRC/tests to :DEST $MON_SYSTEM_GIT/tests";
echo
fi
done;
}
etags_src ()
{
cd $MON_SYSTEM_SRC
if [ -e "$MON_SYSTEM_SRC/make-mon-systems-etags.sh" ]
then
./make-mon-systems-etags.sh
echo "executing make-mon-systems-etags.sh"
fi
}
etags_after_copy ()
{
cd $MON_SYSTEM_GIT
find . -name '*.lisp' -print | xargs etags -o ./TAGS --language=lisp
echo "etags created :FILE $MON_SYSTEM_GIT/TAGS"
echo
}
cd $MON_SYSTEM_SRC
ensure_abort_dirs
ensure_tests_dir
copy_mon_files
copy_mon_test_files
ensure_readme
ensure_loadtime_bind
etags_src
etags_after_copy
exit 0
### ==============================
### EOF