blob: 825c4d8971338763342f392ed03c5d866c92d3a6 (
plain)
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
|
#!/bin/bash
#
# Setup a new code project.
#
# Parameters
PROGRAM="$0"
BASENAME="`basename $0`"
PROJECT="$1"
shift
MODULES="$*"
BOOTSTRAP="https://git.fluxo.info/puppet-bootstrap"
CWD="`pwd`"
# Set shared files location
if [ -e "`dirname $(readlink -f $0)`/share/$BASENAME" ]; then
# Development or local installation layout
SHARE="`dirname $(readlink -f $0)`/share/$BASENAME"
else
# System installation layout
SHARE="`dirname $(readlink -f $0)`/../share/$BASENAME"
fi
# Include basic functions
source $SHARE/templater/functions || exit 1
# Syntax check
if [ -z "$PROJECT" ]; then
echo "$BASENAME: create a new project folder and/or setup helper utilities"
echo ""
echo "usage: $BASENAME <path> [<module1> ... <moduleN>]"
echo ""
echo "examples":
echo ""
echo -e "\t templater myproject git ikiwiki # adds git and ikiwiki config into myproject"
echo -e "\t templater . pelican # add pelican config into the current folder"
echo ""
echo "available modules:"
echo ""
#__templater_implementations | xargs -L 6 | column -t -c 6 | sed -e 's/^/\t/'
for module in `__templater_implementations`; do
echo -e "\t $module: `cat $SHARE/$module/description`"
done
echo ""
exit 1
fi
# Initialize
__templater_init
# Go to project folder
cd $PROJECT &> /dev/null
# Setup modules
if [ -z "$MODULES" ]; then
for project in `__templater_implementations`; do
__templater_ask $project
done
else
for module in $MODULES; do
if `__templater_implementations | grep -q "^$module"`; then
#templater_$module
$SHARE/$module/setup $SHARE
else
__templater_echo "No such module $module, skipping"
fi
done
fi
# Teardown
cd $CWD
__templater_echo "Done processing the project :)"
|