0xGA: Check-in [2c413d3bc1]

Yet another PHP framework, but made for org-mode and geeks.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Modification to the test infrastructure
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:2c413d3bc1a65e8ceafec035831cf41933c94a60
User & Date: milouse 2014-02-24 23:20:41
Context
2014-02-25
00:44
Finish first test suite module for 0xga and fix narv consequently check-in: dc28d93be1 user: milouse tags: trunk
2014-02-24
23:20
Modification to the test infrastructure check-in: 2c413d3bc1 user: milouse tags: trunk
21:20
Remove orgx script as I switch to a full emacs integration.\nRename 0xga install script to narv, in order to let it become a more generic tool for the frawework. check-in: bd2cc40bce user: milouse tags: trunk
Changes

Deleted test/start.

1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/env bash

mkdir /tmp/0xGA-test-suite
cd /tmp/0xGA-test-suite
export EDITOR=""

# Test install
/home/milouse/Dropbox/Applis/0xGA/test/test-0xga /home/milouse/Dropbox/Applis/0xGA/0xga $USER

# cleanup test
cd
rm ~/.0xGA.fossil
rm -r /tmp/0xGA-test-suite
<
<
<
<
<
<
<
<
<
<
<
<
<


























Changes to test/test-0xga.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/expect -f

set oxbin [lindex $argv 0]
set user [lindex $argv 1]


spawn $oxbin
expect "URL: "
send "http://test.com/\r"
expect "Do you use Apache Webserver ? (YES, no): "
send "no\r"
expect "login ($user): "
send "\r"
expect "password: "
send "coucou\r"




<










1
2
3
4

5
6
7
8
9
10
11
12
13
14
#!/usr/bin/expect -f

set oxbin [lindex $argv 0]
set user [lindex $argv 1]


spawn $oxbin
expect "URL: "
send "http://test.com/\r"
expect "Do you use Apache Webserver ? (YES, no): "
send "no\r"
expect "login ($user): "
send "\r"
expect "password: "
send "coucou\r"

Changes to usr/bin/narv.

57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
..
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
...
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
...
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
...
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
...
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255












256
257
258
259
260
261
262
DOCAUTHOR=$USER
COMMAND="install"
MUSTPULL="yes"
FOSSILFILE=$HOME/.0xGA.fossil
DESTDIR=`realpath public_html`
DOMAINNAME="localhost"

if [ $# -gt 0 ]; then
    while [ -n "$1" ]; do
        case $1 in
            --fossil|-f)
                shift
                FOSSILFILE=`realpath $1`
                ;;
            --dest|-d)
                shift
................................................................................
            --nopull|-n)
                MUSTPULL="no"
                ;;
            --host|-H)
                shift
                DOMAINNAME=$1
                ;;
            install|update|streamindex|-h|-v|--help|--version)
                COMMAND=$1
                ;;
            *)
                COMMAND=install
                ;;
        esac
        shift
    done
fi

if [ "$DESTDIR" = "/" ]; then
    echo ""
    echo "DO NOT RUN THIS SCRIPT AT THE ROOT OF YOUR SYSTEM, YOU FOOL"
    echo ""
    echo "Please choose a more appropriate destination"
    echo "like /srv/http, /home/whatever/public_html or /var/www"
    exit 1
fi
................................................................................
        echo "Narv - 0xGA tools suite v$VERSION"
        echo "Written by Étienne Deparis"
        ;;
    -h|--help)
        usage_help | fmt | more
        ;;
    install)
        if [ `dirname $FOSSILFILE` = "$DESTDIR" ]; then
            echo "For security reasons, install directory and fossil directory MUST be different."
            exit 1
        fi

        echo "0xGA Installation"
        echo ":: will save fossil repository file in $FOSSILFILE"
        echo ":: will install 0xGA in $DESTDIR"

        if [ -e $DESTDIR -o -e $FOSSILFILE ]; then
            echo ""
            echo "ERROR: $DESTDIR or $FOSSILFILE already exists on your system."
            echo ""
            echo "This is an installation script. Maybe you just want to update your 0xGA
installation?"
            echo ""
            echo "If you really wants to do a fresh install at this place, remove it first.
................................................................................
        cd $DESTDIR
        fossil open $FOSSILFILE
        fossil close

        cleanup_installation

        echo ":: creating necessary directories structure"
        if [ -e var ]; then
            rm -rf var
        fi
        mkdir -p var/db/
        mkdir -p var/cache/
        mkdir -p var/log/
        mkdir -p var/tmp/
        chmod -R g+w var

        if [ -n "$DOMAINNAME" ]; then
            NEWDOMAIN=$DOMAINNAME
        else
            NEWDOMAIN="http://mydomain.eu/"
        fi
        echo ""
        echo "What will be the complete URL to access your Website?"
        echo "The leading / is required! Example: $NEWDOMAIN"
................................................................................
        echo "Just hitting return key will skip the home creation process."
        echo -n "URL: "
        read NEWDOMAIN

        SITEFOLDER=`echo $NEWDOMAIN | sed "s|https\?://||" | cut -d/ -f1`
        SITEFOLDER=home/$SITEFOLDER

        if [ -e home ]; then
            if [ ! -d home]; then
                rm -rf home
                mkdir home
            fi
        else
            mkdir home
        fi

        if [ -n "$NEWDOMAIN" ]; then
            echo ":: creating the home folder for your new Website in $SITEFOLDER"

            mkdir -p $SITEFOLDER
            mkdir -p $SITEFOLDER/Documents
            chmod -R g+w $SITEFOLDER/Documents
        fi

        echo ":: configuring new Website"
        APACHESERVER="yes"
        echo ""
        echo -n "Do you use Apache Webserver ? (YES, no): "
        read APACHESERVER
        if [[ $APACHESERVER == "YES" || $APACHESERVER == "yes" || $APACHESERVER == "" ]]; then
            mv sample.htaccess .htaccess
            $EDITOR .htaccess
        else
            rm sample.htaccess
        fi

        echo ":: setting up general configuration"
................................................................................
        read ROOTLOGIN
        echo -n "password: "
        read ROOTPASS

        sed -i "s|/any/where/you/want/|$DESTDIR/|" etc/rc.sample.conf
        sed -i "s|http://mydomain.eu/|$NEWDOMAIN|" etc/rc.sample.conf

        if [ -n "$ROOTLOGIN" ]; then
            sed -i "s/= root$/= $ROOTLOGIN/" etc/rc.sample.conf
        else
            sed -i "s/= root$/= $DOCAUTHOR/" etc/rc.sample.conf
        fi
        sed -i "s/= N€w7a5s$/= $ROOTPASS/" etc/rc.sample.conf
        mv etc/rc.sample.conf etc/rc.conf
        $EDITOR etc/rc.conf
................................................................................
        mv etc/template.sample.conf etc/template.conf
        $EDITOR etc/template.conf

        mv etc/routes.sample.conf etc/routes.conf

        echo ":: setting up your new Website home page"
        echo "#+title: Home
#+date: <"`date +%Y-%m-%d`" "`date +%a`">" > $SITEFOLDER/home.org
        $EDITOR $SITEFOLDER/home.org

        echo "Installation finished."
        if [ -n "$BROWSER" ]; then
            $BROWSER $NEWDOMAIN
        fi
        ;;
    update)
        echo ":: Will use fossil repository file in $FOSSILFILE"
        echo ":: will update the installation in $DESTDIR"

        cd $DESTDIR

        echo ":: fetching sources"
        echo ":: pull is required: $MUSTPULL"
        fossil open $FOSSILFILE
        if [ "$MUSTPULL" = "yes" ]; then
            fossil pull http://projects.depar.is/0xGA
        fi
        fossil update
        fossil close

        cleanup_installation

        echo "Update process finished."
        ;;
    streamindex)
        touch $DESTDIR/var/cache/streamindextoken
        wget -q -O /dev/null ${DOMAINNAME}stream/admin/index
        rm $DESTDIR/var/cache/streamindextoken












        ;;
    *)
        echo "There's something strange
in your neighborhood.
Who ya gonna call?"
        ;;
esac







|
|







 







|










|







 







|








|







 







|








|







 







|
|







|



|
|







|







 







|







 







|
|


|












|










|

|
>
>
>
>
>
>
>
>
>
>
>
>







57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
..
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
...
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
...
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
...
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
...
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
DOCAUTHOR=$USER
COMMAND="install"
MUSTPULL="yes"
FOSSILFILE=$HOME/.0xGA.fossil
DESTDIR=`realpath public_html`
DOMAINNAME="localhost"

if [ $# -gt 0 ] ; then
    while [ -n "$1" ] ; do
        case $1 in
            --fossil|-f)
                shift
                FOSSILFILE=`realpath $1`
                ;;
            --dest|-d)
                shift
................................................................................
            --nopull|-n)
                MUSTPULL="no"
                ;;
            --host|-H)
                shift
                DOMAINNAME=$1
                ;;
            install|streamindex|test-suite|update|-h|-v|--help|--version)
                COMMAND=$1
                ;;
            *)
                COMMAND=install
                ;;
        esac
        shift
    done
fi

if [ "$DESTDIR" = "/" ] ; then
    echo ""
    echo "DO NOT RUN THIS SCRIPT AT THE ROOT OF YOUR SYSTEM, YOU FOOL"
    echo ""
    echo "Please choose a more appropriate destination"
    echo "like /srv/http, /home/whatever/public_html or /var/www"
    exit 1
fi
................................................................................
        echo "Narv - 0xGA tools suite v$VERSION"
        echo "Written by Étienne Deparis"
        ;;
    -h|--help)
        usage_help | fmt | more
        ;;
    install)
        if [ `dirname $FOSSILFILE` = "$DESTDIR" ] ; then
            echo "For security reasons, install directory and fossil directory MUST be different."
            exit 1
        fi

        echo "0xGA Installation"
        echo ":: will save fossil repository file in $FOSSILFILE"
        echo ":: will install 0xGA in $DESTDIR"

        if [ -e "$DESTDIR" -o -e "$FOSSILFILE" ] ; then
            echo ""
            echo "ERROR: $DESTDIR or $FOSSILFILE already exists on your system."
            echo ""
            echo "This is an installation script. Maybe you just want to update your 0xGA
installation?"
            echo ""
            echo "If you really wants to do a fresh install at this place, remove it first.
................................................................................
        cd $DESTDIR
        fossil open $FOSSILFILE
        fossil close

        cleanup_installation

        echo ":: creating necessary directories structure"
        if [ -e var ] ; then
            rm -rf var
        fi
        mkdir -p var/db/
        mkdir -p var/cache/
        mkdir -p var/log/
        mkdir -p var/tmp/
        chmod -R g+w var

        if [ -n "$DOMAINNAME" ] ; then
            NEWDOMAIN=$DOMAINNAME
        else
            NEWDOMAIN="http://mydomain.eu/"
        fi
        echo ""
        echo "What will be the complete URL to access your Website?"
        echo "The leading / is required! Example: $NEWDOMAIN"
................................................................................
        echo "Just hitting return key will skip the home creation process."
        echo -n "URL: "
        read NEWDOMAIN

        SITEFOLDER=`echo $NEWDOMAIN | sed "s|https\?://||" | cut -d/ -f1`
        SITEFOLDER=home/$SITEFOLDER

        if [ -e home ] ; then
            if [ ! -d home] ; then
                rm -rf home
                mkdir home
            fi
        else
            mkdir home
        fi

        if [ -n "$NEWDOMAIN" ] ; then
            echo ":: creating the home folder for your new Website in $SITEFOLDER"

            mkdir -p $SITEFOLDER
            mkdir -p ${SITEFOLDER}/Documents
            chmod -R g+w ${SITEFOLDER}/Documents
        fi

        echo ":: configuring new Website"
        APACHESERVER="yes"
        echo ""
        echo -n "Do you use Apache Webserver ? (YES, no): "
        read APACHESERVER
        if [[ $APACHESERVER == "YES" || $APACHESERVER == "yes" || $APACHESERVER == "" ]] ; then
            mv sample.htaccess .htaccess
            $EDITOR .htaccess
        else
            rm sample.htaccess
        fi

        echo ":: setting up general configuration"
................................................................................
        read ROOTLOGIN
        echo -n "password: "
        read ROOTPASS

        sed -i "s|/any/where/you/want/|$DESTDIR/|" etc/rc.sample.conf
        sed -i "s|http://mydomain.eu/|$NEWDOMAIN|" etc/rc.sample.conf

        if [ -n "$ROOTLOGIN" ] ; then
            sed -i "s/= root$/= $ROOTLOGIN/" etc/rc.sample.conf
        else
            sed -i "s/= root$/= $DOCAUTHOR/" etc/rc.sample.conf
        fi
        sed -i "s/= N€w7a5s$/= $ROOTPASS/" etc/rc.sample.conf
        mv etc/rc.sample.conf etc/rc.conf
        $EDITOR etc/rc.conf
................................................................................
        mv etc/template.sample.conf etc/template.conf
        $EDITOR etc/template.conf

        mv etc/routes.sample.conf etc/routes.conf

        echo ":: setting up your new Website home page"
        echo "#+title: Home
#+date: <"`date +%Y-%m-%d`" "`date +%a`">" > ${SITEFOLDER}/home.org
        $EDITOR ${SITEFOLDER}/home.org

        echo "Installation finished."
        if [ -n "$BROWSER" ] ; then
            $BROWSER $NEWDOMAIN
        fi
        ;;
    update)
        echo ":: Will use fossil repository file in $FOSSILFILE"
        echo ":: will update the installation in $DESTDIR"

        cd $DESTDIR

        echo ":: fetching sources"
        echo ":: pull is required: $MUSTPULL"
        fossil open $FOSSILFILE
        if [ "$MUSTPULL" = "yes" ] ; then
            fossil pull http://projects.depar.is/0xGA
        fi
        fossil update
        fossil close

        cleanup_installation

        echo "Update process finished."
        ;;
    streamindex)
        touch ${DESTDIR}/var/cache/streamindextoken
        wget -q -O /dev/null ${DOMAINNAME}stream/admin/index
        rm ${DESTDIR}/var/cache/streamindextoken
        ;;
    test-suite)
        mkdir /tmp/0xGA-test-suite
        cd /tmp/0xGA-test-suite

        TESTFILES=`ls -1 ${DESTDIR}/test/`
        
        for TESTUNIT in $TESTFILES ; do
            ${DESTDIR}/test/$TESTUNIT ${DESTDIR}/usr/bin/narv $USER
        done

        rm -r /tmp/0xGA-test-suite
        ;;
    *)
        echo "There's something strange
in your neighborhood.
Who ya gonna call?"
        ;;
esac