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