/
kickstart-static.sh
executable file
·66 lines (52 loc) · 1.32 KB
/
kickstart-static.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
#!/bin/bash
# This script will help you start your adming using AModules3
#
# Go into directory, where you want to use AModules3 and run
# this script
#
# TODO: this needs testing!
function exists {
echo "Files in your current directory already exist. You should run" >&2
echo "this script from empty directory" >&2
exit;
}
[ -f kickstart.sh ] && {
echo "Please go to empty directory and call this script like this:" >&2
echo "> amodules3-web/kickstart.sh"
exit;
}
[ -f .htaccess ] && exists
[ -f main.php ] && exists
apdir=`dirname $0`
loader=$apdir"/lib/loader.php";
echo "apdir=$apdir"
mkdir templates 2>/dev/null
cat > .htaccess <<EOF
RewriteEngine on
RewriteRule .*\.html main.php?page=$1
RewriteRule .*/$ main.php?page=$1
# all the pages will be processed through main.php
EOF
cat > main.php <<EOF
<?
include 'amodules3/loader.php';
\$api=new ApiStatic('my_application');
\$api->main();
?>
EOF
cat > templates/components.html <<EOF
This is component library..
<?test?>
Templates works normally
<?/?>
EOF
cat >index.html<<EOF
<?test?>
Your templates DO NOT WORK :(
<?/?>
<p>
For more information on ApiStatic please read documentation.
EOF
[ -f amodules3 ] || ln -sf $apdir amodules3
echo "Edit main.php, create your templates inside templates/"
echo "consult documentation on http://adevel.com/amodules3"