Skip to content
Permalink
05cfa943e4
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
102 lines (87 sloc) 2.72 KB
# Some useful shell functions. Source them from your shell rc file. Only tested on zsh.
# Please configure the path, preferably by using an environment variable
# For example, put those two lines into your zshrc.local:
# export rootpath="path to where the dockers run"
# xsource ~/eoa-utilities/eoa.rc
# shortcuts for some directories
eskr=$rootpath/EOASkripts
di=$rootpath/EOASkripts/runtime/input
do=$rootpath/EOASkripts/runtime/output
e15=$rootpath/eoa-1.5
e2=$rootpath/eoa2-xmldb
e2i=$e2/runtime_data/res.rt/input
# build sphinx documentation and open in browser
function msx(){
cd $1;
make clean;
make html;
open $1/_build/html/index.html;
cd -
}
# build sphinx documentation silently
function msxs(){
cd $1;
make clean;
make html;
cd -
}
# get latest hashes of some django apps for inclusion in requirements.txt of eoa-1.5 and other dependencies
function get_head_hash(){
current_dir=$(pwd);
for part in publications forthcoming series authors;
do
cd $1/django-eoa$part;
revision=$(git rev-parse HEAD);
echo $revision: $part;
done
for part in webdesign_platform eoa-publication-model;
do
cd $1/$part;
revision=$(git rev-parse HEAD);
echo $revision: $part;
done
cd $current_dir
}
# copy relevant publication files to workflow input
function cpdi(){
cpdir=$(dirname $1)
destination=$di/$(basename $cpdir)
mkdir $destination
for part in texfiles preambel images;
do
cp -r $cpdir/$part $destination
done
cp $1 $destination
}
# function to import new publication into EOAPP1.5
function pimp15(){
current_dir=$(pwd);
pnumber=$(egrep '^Number( )?:' $do/$1/django/publication.cfg| cut -f 2 -d ":"| tr -d '[:space:]');
pseries=$(egrep '^Serie( )?:' $do/$1/django/publication.cfg| cut -f 2 -d ":"| tr -d '[:space:]'| tr '[:upper:]' '[:lower:]');
import_dir="import_${pseries}${pnumber}";
mediafiles="$e15/runtime_data/res.rt/all_media_files/$pseries/$pnumber";
cd $e15;
if [ -d $mediafiles ]; then
rm -vfr $mediafiles;
fi
if [ -d $e15/src/$import_dir ]; then
rm -vfr $e15/src/$import_dir;
fi
mkdir -p src/$import_dir;
cp -rv $do/$1/django/{Cover.jpg,Django.xml,images,publication.cfg} src/$import_dir;
docker-compose exec webserver bash -c "python manage.py publicationimport ${import_dir}";
cd $current_dir;
}
# update example publications in EOASkripts directory
function eoa_sample_update(){
current_dir=$(pwd);
cd $eskr ;
rm -rf ./dependencies/eoa-publication-model;
git_deps_py;
rm -rf $di/example;
cp -rv ./dependencies/eoa-publication-model/examples $di/example;
cd $current_dir;
}
# Local variables:
# mode: sh
# End: