assignment 1
This commit is contained in:
9
scripts/common.sh
Normal file
9
scripts/common.sh
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/zsh
|
||||
|
||||
export ROOT=$(git rev-parse --show-toplevel)
|
||||
export ASSIGNMENT_DIR="$ROOT/assignments"
|
||||
export PRACTICES_DIR="$ROOT/practices"
|
||||
export SHARED_DIR="$ROOT/shared"
|
||||
export OUT_DIR="$ROOT/.out"
|
||||
export ZIP_DIR="$ROOT/.out/zip"
|
||||
export SCRIPTS_DIR="$ROOT/scripts"
|
||||
17
scripts/link.sh
Normal file
17
scripts/link.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/bin/zsh
|
||||
|
||||
source scripts/common.sh
|
||||
|
||||
assignments=($(ls -d $ASSIGNMENT_DIR/*/))
|
||||
practices=($(ls -d $PRACTICES_DIR/*/))
|
||||
projects=($assignments $practices)
|
||||
|
||||
for project in ${projects[@]}; do
|
||||
cd $project || exit 1
|
||||
|
||||
name=${project%/}
|
||||
name=${name##*/}
|
||||
|
||||
echo "linking shared/common.css to $name"
|
||||
cp $SHARED_DIR/common.css css/common.css
|
||||
done
|
||||
30
scripts/new.sh
Normal file
30
scripts/new.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/bin/zsh
|
||||
|
||||
source scripts/common.sh
|
||||
|
||||
if [ -z "$1" ] || [ -z "$2" ]; then
|
||||
echo "Usage: $0 <assignment/practice> <project_name>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$1" = "assignment" ]; then
|
||||
DIR=$ASSIGNMENT_DIR
|
||||
elif [ "$1" = "practice" ]; then
|
||||
DIR=$PRACTICES_DIR
|
||||
else
|
||||
echo "Usage: $0 <assignment/practice> <project_name>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd $DIR
|
||||
mkdir -p $2
|
||||
cd $2
|
||||
|
||||
touch index.html
|
||||
|
||||
mkdir -p css
|
||||
cd css
|
||||
|
||||
cp $SHARED_DIR/common.css .
|
||||
echo "@import 'common.css';" >shared.css
|
||||
echo "@import 'shared.css';" >index.css
|
||||
21
scripts/zip.sh
Executable file
21
scripts/zip.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/zsh
|
||||
|
||||
source scripts/common.sh
|
||||
|
||||
rm -rf $ZIP_DIR
|
||||
mkdir -p $ZIP_DIR
|
||||
|
||||
projects=($(ls -d $OUT_DIR/assignments/*/))
|
||||
|
||||
for project in ${projects[@]}; do
|
||||
assignment_name=${project%/}
|
||||
assignment_name=${assignment_name##*/}
|
||||
|
||||
cd "$OUT_DIR/assignments/$assignment_name" || exit 1
|
||||
echo "zipping assignment $assignment_name"
|
||||
|
||||
project_name="EamighJ${assignment_name:u}"
|
||||
|
||||
zip -r $ZIP_DIR/$project_name.zip . &>/dev/null
|
||||
echo "zipped $assignment_name to $ZIP_DIR/$project_name.zip"
|
||||
done
|
||||
Reference in New Issue
Block a user