0xGA: Check-in [dc28d93be1]

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

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

Overview
Comment:Finish first test suite module for 0xga and fix narv consequently
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:dc28d93be1c8cc5741288843f72605b6e11763cc
User & Date: milouse 2014-02-25 00:44:49
Context
2014-04-02
22:03
Fix two little bugs check-in: e7feaee5b5 user: milouse tags: trunk
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
Changes

Name change from test/test-0xga to test/installation.

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"




















|
>
|
>
>

<
>
>








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#!/usr/bin/expect -f

set install_path [lindex $argv 0]
set current_dir [lindex $argv 1]
set user [lindex $argv 2]
set ::env(EDITOR) ""
set ::env(BROWSER) ""


spawn $install_path/usr/bin/narv install -d $current_dir/fresh_install -f $current_dir/fresh_install.fossil

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"
wait
close $spawn_id

puts "\n"

if { [file isdirectory $current_dir/fresh_install] } {
    puts ":: Target directory exists       \[OK\]"
} else {
    puts ":: Target directory exists     \[FAIL\]"
}
if { [file exists $current_dir/fresh_install/etc/rc.conf] } {
    puts ":: rc.conf exists                \[OK\]"
} else {
    puts ":: rc.conf exists              \[FAIL\]"
}

file delete $current_dir/fresh_install.fossil
file delete -force $current_dir/fresh_install

Changes to usr/bin/narv.

1
2
3
4
5
6
7
8
9
10
11
12
13
..
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
..
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
..
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
...
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
...
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
...
206
207
208
209
210
211
212
213
214
215
216
217
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
...
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
#!/usr/bin/env bash

VERSION=0.2

function usage_help {
    echo -e "\t\t\t\033[1mNarv - 0xGA tools suite v$VERSION\033[0m"
    echo ""
    echo -e "\033[1mSYNOPSIS\033[0m
    narv [COMMAND [OPTIONS]]
    narv [FILE]

\033[1mCOMMANDS\033[0m
    \033[1m-h
................................................................................
function cleanup_installation {
    echo ":: cleaning up installation files"
    rm -rf .fossil-settings
    rm -rf test
    rm etc/systemd/system/multi-user.target.wants/sample.service
    rm etc/*.sample.conf
    rm sample.htaccess
    rm usr/bin/narv    
}

DOCAUTHOR=$USER
COMMAND="install"
MUSTPULL="yes"
FOSSILFILE=$HOME/.0xGA.fossil
DESTDIR=`realpath public_html`
................................................................................
            --nopull|-n)
                MUSTPULL="no"
                ;;
            --host|-H)
                shift
                DOMAINNAME=$1
                ;;
            install|streamindex|test-suite|update|-h|-v|--help|--version)
                COMMAND=$1
                ;;
            *)
                COMMAND=install
                ;;
        esac
        shift
................................................................................
    echo "Please choose a more appropriate destination"
    echo "like /srv/http, /home/whatever/public_html or /var/www"
    exit 1
fi

case $COMMAND in
    -v|--version)
        echo "Narv - 0xGA tools suite v$VERSION"
        echo "Written by Étienne Deparis"
        ;;
    -h|--help)
        usage_help | fmt | more
        ;;
    install)
        if [ `dirname $FOSSILFILE` = "$DESTDIR" ] ; then
................................................................................
        fi

        echo ":: fetching sources"
        fossil clone http://projects.depar.is/0xGA $FOSSILFILE

        mkdir $DESTDIR
        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/
................................................................................

        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"

        echo "Who will be the main user of your new Website?"
        echo -n "login ($DOCAUTHOR): "
        read ROOTLOGIN
................................................................................

        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

        echo ":: setting up template configuration"
        sed -i "s/Your Name/$DOCAUTHOR/" etc/template.sample.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





|







 







|







 







|







 







|







 







|


<
<







 







|

<
<







 







|




|


|





>
>







 







|







 







|
|
|


|
>

|


|







1
2
3
4
5
6
7
8
9
10
11
12
13
..
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
..
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
..
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
...
130
131
132
133
134
135
136
137
138
139


140
141
142
143
144
145
146
...
181
182
183
184
185
186
187
188
189


190
191
192
193
194
195
196
...
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
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
...
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
#!/usr/bin/env bash

VERSION=0.2

function usage_help {
    echo -e "\t\t\t\033[1mNarv - 0xGA toolkit v$VERSION\033[0m"
    echo ""
    echo -e "\033[1mSYNOPSIS\033[0m
    narv [COMMAND [OPTIONS]]
    narv [FILE]

\033[1mCOMMANDS\033[0m
    \033[1m-h
................................................................................
function cleanup_installation {
    echo ":: cleaning up installation files"
    rm -rf .fossil-settings
    rm -rf test
    rm etc/systemd/system/multi-user.target.wants/sample.service
    rm etc/*.sample.conf
    rm sample.htaccess
    rm usr/bin/narv
}

DOCAUTHOR=$USER
COMMAND="install"
MUSTPULL="yes"
FOSSILFILE=$HOME/.0xGA.fossil
DESTDIR=`realpath public_html`
................................................................................
            --nopull|-n)
                MUSTPULL="no"
                ;;
            --host|-H)
                shift
                DOMAINNAME=$1
                ;;
            install|specs|streamindex|update|-h|-v|--help|--version)
                COMMAND=$1
                ;;
            *)
                COMMAND=install
                ;;
        esac
        shift
................................................................................
    echo "Please choose a more appropriate destination"
    echo "like /srv/http, /home/whatever/public_html or /var/www"
    exit 1
fi

case $COMMAND in
    -v|--version)
        echo "Narv - 0xGA toolkit v$VERSION"
        echo "Written by Étienne Deparis"
        ;;
    -h|--help)
        usage_help | fmt | more
        ;;
    install)
        if [ `dirname $FOSSILFILE` = "$DESTDIR" ] ; then
................................................................................
        fi

        echo ":: fetching sources"
        fossil clone http://projects.depar.is/0xGA $FOSSILFILE

        mkdir $DESTDIR
        cd $DESTDIR
        fossil open $FOSSILFILE >/dev/null
        fossil close



        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/
................................................................................

        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
            cp sample.htaccess .htaccess
            $EDITOR .htaccess


        fi

        echo ":: setting up general configuration"

        echo "Who will be the main user of your new Website?"
        echo -n "login ($DOCAUTHOR): "
        read ROOTLOGIN
................................................................................

        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
        cp etc/rc.sample.conf etc/rc.conf
        $EDITOR etc/rc.conf

        echo ":: setting up template configuration"
        sed -i "s/Your Name/$DOCAUTHOR/" etc/template.sample.conf
        cp etc/template.sample.conf etc/template.conf
        $EDITOR etc/template.conf

        cp 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

        cleanup_installation

        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 >/dev/null
        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
        ;;
    specs)
        mkdir /tmp/0xGA-specs
        cd /tmp/0xGA-specs

        TESTFILES=`ls -1 ${DESTDIR}/test/`

        echo ":: Begin specs sequence."
        for TESTUNIT in $TESTFILES ; do
            ${DESTDIR}/test/$TESTUNIT $DESTDIR `pwd` $USER
        done

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