Updated command
This commit is contained in:
parent
902d36e9b6
commit
7ecdc91e33
@ -15,11 +15,14 @@ choose() {
|
||||
user=${user%%/*}
|
||||
target=${target#*(}
|
||||
target=${target%)*}
|
||||
target=${target#/pages}
|
||||
|
||||
echo "Choice => $target.md for user $user"
|
||||
|
||||
echo cp "../content$target.md" "../content/users/$user${target%/*}/"
|
||||
cp "../content$target.md" "../content/users/$user${target%/*}/"
|
||||
mkdir -p "../content/users/$user${target%/*}/"
|
||||
cp "../content/pages$target.md" "../content/users/$user${target%/*}/"
|
||||
chmod -R g+rw "../content/users/$user${target%/*}/"
|
||||
chgrp -R www-data "../content/users/$user${target%/*}/"
|
||||
|
||||
# Delete former result files
|
||||
rm "$dir/*.result"
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
setup() {
|
||||
mkdir -p content/pages/test
|
||||
mkdir -p content/users/test
|
||||
}
|
||||
|
||||
@ -8,14 +9,14 @@ setup() {
|
||||
echo "---
|
||||
title: Basic test
|
||||
---
|
||||
" > content/test.md
|
||||
" > content/pages/test/hop.md
|
||||
|
||||
echo "---
|
||||
title: Basic choice test
|
||||
ac_choices:
|
||||
- \"[abc](/home)\"
|
||||
- \"[def](/test)\"
|
||||
- \"[ghi](/home)\"
|
||||
- \"[abc](/pages/test/home)\"
|
||||
- \"[def](/pages/test/hop)\"
|
||||
- \"[ghi](/pages/test/home)\"
|
||||
---
|
||||
" > content/users/test/choice_test.md
|
||||
|
||||
@ -29,10 +30,10 @@ ac_choices:
|
||||
[ ! -e content/users/test/choice_test.md ]
|
||||
[ ! -e content/users/test/choice_test.choice ]
|
||||
[ -e content/users/test/choice_test.result ]
|
||||
[ -e content/users/test/test.md ]
|
||||
[ -e content/users/test/test/hop.md ]
|
||||
}
|
||||
|
||||
teardown() {
|
||||
rm -f content/test.md
|
||||
rm -rf content/pages/test
|
||||
rm -rf content/users/test
|
||||
}
|
||||
|
@ -27,4 +27,4 @@ On multiple lines" > content/users/test/content_test.content
|
||||
|
||||
teardown() {
|
||||
rm -rf content/users/test
|
||||
}
|
||||
}
|
@ -9,6 +9,7 @@ kind=$(cat "$dir/$file")
|
||||
echo "Creating content/$kind/$page"
|
||||
|
||||
hugo --source=.. new "content/$kind/$page"
|
||||
chmod -R g+rw "content/$kind/$page"
|
||||
chgrp -R www-data "content/$kind/$page"
|
||||
|
||||
# Important to automated tests
|
||||
chmod g+w "../content/$kind/$page"
|
||||
./ac_route.sh "$dir/$page" _index.md
|
||||
|
@ -29,4 +29,4 @@
|
||||
[ ! -e content/users/create_test.delete ]
|
||||
[ ! -e content/users/create_test/_index.md ]
|
||||
[ ! -e content/users/create_test ]
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@
|
||||
|
||||
dir=$1 file=$2
|
||||
|
||||
echo
|
||||
echo "Default actions for $dir/$file"
|
||||
|
||||
create() {
|
||||
@ -12,8 +13,15 @@ create() {
|
||||
|
||||
for value in $values
|
||||
do
|
||||
echo "Creating $value"
|
||||
cp "../content/$value.md" "$dir/$value.md"
|
||||
target=${dir%/users/*}/users/$user/${value#/pages/}
|
||||
target=$(dirname "$target")
|
||||
|
||||
mkdir -p "$target"
|
||||
cp "../content$value.md" "$target"
|
||||
chmod -R g+rw "$target"
|
||||
chgrp -R www-data "$target"
|
||||
|
||||
./ac_route.sh "$target" "${value##*/}.md"
|
||||
done
|
||||
}
|
||||
|
||||
@ -29,6 +37,9 @@ delete() {
|
||||
|
||||
if [ -z "${dir##*/content/users/*}" ]
|
||||
then
|
||||
user=${dir#*/users/}
|
||||
user=${user%%/*}
|
||||
|
||||
create
|
||||
delete
|
||||
fi
|
||||
|
@ -9,33 +9,35 @@ setup() {
|
||||
echo "---
|
||||
title: Simple link test
|
||||
---
|
||||
" > content/simple_link_test.md
|
||||
" > content/pages/test/simple_link_test.md
|
||||
|
||||
cp content/simple_link_test.md content/users/test/
|
||||
mkdir content/users/test/test
|
||||
cp content/pages/test/simple_link_test.md content/users/test/test
|
||||
|
||||
bin/ac_route.sh "$(pwd)/content" simple_link_test.md
|
||||
bin/ac_route.sh "$(pwd)/content/users/test/test" simple_link_test.md
|
||||
|
||||
[ -e content/users/test/simple_link_test.md ]
|
||||
[ -e content/users/test/test/simple_link_test.md ]
|
||||
}
|
||||
|
||||
@test "Create file" {
|
||||
echo "---
|
||||
title: Test file to be create
|
||||
title: Test file to be created
|
||||
---
|
||||
" > content/to_create.md
|
||||
" > content/pages/test/to_create.md
|
||||
|
||||
echo "---
|
||||
title: Create test
|
||||
ac_create:
|
||||
- to_create
|
||||
- /pages/test/to_create
|
||||
---
|
||||
" > content/to_create_test.md
|
||||
" > content/pages/test/to_create_test.md
|
||||
|
||||
cp content/to_create_test.md content/users/test/
|
||||
mkdir content/users/test/test
|
||||
cp content/pages/test/to_create_test.md content/users/test/test
|
||||
|
||||
bin/ac_route.sh "$(pwd)/content/users/test" to_create_test.md
|
||||
bin/ac_route.sh "$(pwd)/content/users/test/test" to_create_test.md
|
||||
|
||||
[ -e content/users/test/to_create.md ]
|
||||
[ -e content/users/test/test/to_create.md ]
|
||||
}
|
||||
|
||||
@test "Delete file" {
|
||||
@ -67,7 +69,6 @@ teardown() {
|
||||
rm -f content/test.md
|
||||
rm -rf content/pages/test
|
||||
rm -rf content/users/test
|
||||
rm -f content/simple_link_test.md
|
||||
rm -f content/to_create_test.md
|
||||
rm -f content/to_delete_test.md
|
||||
rm -f content/to_create.md
|
||||
|
@ -1,13 +1,11 @@
|
||||
<VirtualHost *:80>
|
||||
ServerName acoeur.localhost
|
||||
ServerAlias acoeur acoeur.acoeuro.com
|
||||
ServerName acoeur
|
||||
|
||||
DocumentRoot /var/simpleWeb/apps/acoeur/public
|
||||
</VirtualHost>
|
||||
|
||||
<VirtualHost *:80>
|
||||
ServerName edit.acoeur.localhost
|
||||
ServerAlias edit.acoeur edit.acoeur.acoeuro.com
|
||||
ServerName edit.acoeur
|
||||
ServerSignature Off
|
||||
Header add Access-Control-Allow-Origin "*"
|
||||
Header add Access-Control-Allow-Methods "HEAD, GET, POST, PUT, OPTIONS, DELETE"
|
||||
|
@ -3,7 +3,7 @@ title: Nouvel utilisateur
|
||||
description: Court texte
|
||||
date: {{ .Date }}
|
||||
ac_create:
|
||||
- /pages/1er-quizz/_index
|
||||
- /pages/1er-quiz/_index
|
||||
---
|
||||
|
||||
Texte
|
||||
|
Loading…
Reference in New Issue
Block a user