#!/bin/bash

# Renaming project folder
if [ -d author/project ]; then
	mv author/project author/works
fi

# Renaming project author folder
if [ -d author ]; then
	mv author svoboda
fi

# Initializing the javascript modules folder
if [ ! -d svoboda/works/system/public/js/modules ]; then
	mkdir -p ./svoboda/works/system/public/js/modules
fi

# Updating repositories
cd damper.mjs && git pull
cd ../hotline.mjs && git pull
cd ../graph.mjs && git pull
cd ../

# Installing "damper.min.mjs"
if [ ! -h svoboda/works/system/public/js/modules/damper.min.mjs ]; then
	ln -s ../../../../../../damper.mjs/damper.min.mjs svoboda/works/system/public/js/modules/damper.min.mjs
fi

# installing "hotline.min.mjs"
if [ ! -h svoboda/works/system/public/js/modules/hotline.min.mjs ]; then
	ln -s ../../../../../../hotline.mjs/hotline.min.mjs svoboda/works/system/public/js/modules/hotline.min.mjs
fi

# Installing "graph.min.mjs"
if [ ! -h svoboda/works/system/public/js/modules/graph.min.mjs ]; then
	ln -s ../../../../../../graph.mjs/graph.min.mjs svoboda/works/system/public/js/modules/graph.min.mjs
fi
