Skip to content

Commit

Permalink
The clean process is updated to remove temperary files, output files,
Browse files Browse the repository at this point in the history
and intermediate files.
The build process is updated to convert SVG to PS insted of PDF file
format.
  • Loading branch information
mostafabarmshory committed Oct 24, 2014
1 parent 947fdab commit 71b33a8
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 9 deletions.
17 changes: 11 additions & 6 deletions bin/script/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ function boostan_build_umbrela() {
return 0;
}

#
# تمام SVG‌ها را به PS تبدیل می‌کند
#
# به صورت مستقیم نمی‌توان این نوع تصاویر را در متن آورد از این رو نیاز است آنها را به
# ساختارهای دیگری تبدیل کنند.
#
function boostan_build_svg () {
find "$BOOSTAN_WRK_DIR/src/image" -type f -regex ".*\.\(svg\)" -print0 | while read -d $'\0' file
do
Expand All @@ -43,8 +49,10 @@ function boostan_build_svg () {
directoryname=$(dirname "$file")
extension="${filename##*.}"
filename="${filename%.*}"
echo FILE: "${directoryname}/${filename}.pdf"
inkscape --export-pdf="${directoryname}/${filename}.pdf" "$file"
echo FILE: "${directoryname}/${filename}.ps"
inkscape \
--export-text-to-path \
--export-ps="${directoryname}/${filename}.ps" "$file"
done
return 0;
}
Expand All @@ -56,8 +64,6 @@ function boostan_build_svg () {
# از دستور زیر یک پرونده را به pdf و یا هر ساختار دیگری تبدیل کرد:
# oodraw --headless --convert-to pdf [document.odg]
#


function boostan_build_odg () {
find "$BOOSTAN_WRK_DIR/src/image" -type f -regex ".*\.\(odg\)" -print0 | while read -d $'\0' file
do
Expand All @@ -76,7 +82,6 @@ function boostan_build_odg () {
return 0;
}


function boostan_build_src() {
# Check the boostan styles
if [ ! -d "$BOOSTAN_WRK_DIR/boostan" ]; then
Expand All @@ -102,9 +107,9 @@ function boostan_build_src() {
}

function boostan_build(){
#boostan_build_umbrela
boostan_log "Trying to build the project SVG files"
boostan_build_svg
#boostan_build_umbrela
boostan_log "Trying to build the project ODG files"
boostan_build_odg
boostan_log "Trying to build the project source"
Expand Down
79 changes: 76 additions & 3 deletions bin/script/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,85 @@
#################################################################################
#configure

# Clean ODG
function boostan_build_odg () {
find "$BOOSTAN_WRK_DIR/src/image" -type f -regex ".*\.\(odg\)" -print0 | while read -d $'\0' file
do
boostan_log "Processing \'%s\' file..." $file
filename=$(basename "$file")
directoryname=$(dirname "$file")
extension="${filename##*.}"
filename="${filename%.*}"
boostan_log "The output of the input odg file is stored in \'%s\'" "${directoryname}/${filename}.pdf"
rm -f "${directoryname}/${filename}.pdf"
done
return 0;
}

#clean svg
function boostan_clean_svg () {
find "$BOOSTAN_WRK_DIR/src/image" -type f -regex ".*\.\(svg\)" -print0 | while read -d $'\0' file
do
filename=$(basename "$file")
directoryname=$(dirname "$file")
extension="${filename##*.}"
filename="${filename%.*}"
boostan_log "Try to delete the file \'%s\'." "${directoryname}/${filename}.ps"
rm -f "${directoryname}/${filename}.ps"
done
return 0;
}

# Clean project
function boostan_clean(){
function boostan_clean_project(){
boostan_log "Trying to clean the output directory (%s)" "$BOOSTAN_OUT_DIR"
rm -f "$BOOSTAN_OUT_DIR/*"
cd "$BOOSTAN_OUT_DIR"
rm -fR ./*

boostan_log "Trying to clean the temp directory (%s)" "$BOOSTAN_TMP_DIR"
rm -f "$BOOSTAN_TMP_DIR/*"
cd "$BOOSTAN_TMP_DIR"
rm -fR ./*

cd "$BOOSTAN_WRK_DIR"
return 0;
}


function boostan_clean_src() {
# Check the boostan styles
if [ ! -d "$BOOSTAN_WRK_DIR/boostan" ]; then
echo "Boostan styles does not exits?!";
boostan_log "Boostan styles does not exits in the path (%s)" "$BOOSTAN_WRK_DIR/boostan"
return 1;
fi

#Make new document
cd "$BOOSTAN_SRC_DIR"
rm -f \
*.acn \
*.aux \
*.bbl \
*.blg \
*.idx \
*.ilg \
*.ind \
*.glg \
*.glo \
*.gls \
*.idx \
*.xdy \
*.log \
*.synctex.gz \
main.pdf

cd "$BOOSTAN_WRK_DIR"
return 0;
}

function boostan_clean(){
boostan_clean_project;
boostan_build_odg;
boostan_clean_svg;
boostan_clean_src;
return 0;
}

0 comments on commit 71b33a8

Please sign in to comment.