Remove need for tmp directory.
This commit is contained in:
parent
281a31f5f7
commit
a799374399
18
isidore.sh
18
isidore.sh
@ -27,9 +27,9 @@ PROG_NAME=$0
|
||||
PROJECT_NAME="Isidore"
|
||||
|
||||
SOURCE_DIR="site/"
|
||||
TMP_DIR="/tmp/isidore-workdesk/"
|
||||
OUTPUT_DIR="output/"
|
||||
TEMPLATE_DIR="templates/"
|
||||
PROJECT_CONFIG_FILE="config.php"
|
||||
|
||||
##
|
||||
# Create the configuration file. This function is called if it does not already
|
||||
@ -110,7 +110,7 @@ function print_help()
|
||||
##
|
||||
function check_in_project()
|
||||
{
|
||||
if ! [ -f "./config.php" ] || ! [ -f "./.isidore-version" ]
|
||||
if ! [ -f "$PROJECT_CONFIG_FILE" ] || ! [ -f "./.isidore-version" ]
|
||||
then
|
||||
echo "ERROR: You are not currently in the root of an Isidore project."
|
||||
exit 1
|
||||
@ -146,12 +146,12 @@ function new_project()
|
||||
\$site_name = \"$NEW_PROJECT_NAME\";
|
||||
\$site_author = \"$ISIDORE_AUTHOR_NAME\";
|
||||
\$site_url = \"$NEW_PROJECT_URL\";
|
||||
?>" >> $NEW_PROJECT_DIR/config.php
|
||||
?>" >> $NEW_PROJECT_DIR/$PROJECT_CONFIG_FILE
|
||||
echo "$ISIDORE_VERSION" > $NEW_PROJECT_DIR/.isidore-version
|
||||
|
||||
echo "New project created."
|
||||
[ $2 == 0 ] &&
|
||||
echo "Consider taking a look at the $NEW_PROJECT_DIR/config.php file."
|
||||
echo "Consider taking a look at the $NEW_PROJECT_DIR/$PROJECT_CONFIG_FILE file."
|
||||
}
|
||||
|
||||
##
|
||||
@ -177,28 +177,22 @@ function build_project()
|
||||
{
|
||||
check_in_project
|
||||
|
||||
local CFG_HEADER_FILE="$TMP_DIR/config-header.php"
|
||||
|
||||
mkdir -p $OUTPUT_DIR
|
||||
mkdir -p $TMP_DIR
|
||||
echo "<?php include(getcwd() . '/config.php'); ?>" > $CFG_HEADER_FILE
|
||||
|
||||
for i in $(find $SOURCE_DIR -type d)
|
||||
do
|
||||
mkdir -p $OUTPUT_DIR/${i:${#SOURCE_DIR}}
|
||||
mkdir -p $TMP_DIR/$i
|
||||
done
|
||||
|
||||
for i in $(find $SOURCE_DIR -name '*.php' -not -name '*.cfg.php')
|
||||
do
|
||||
cat $CFG_HEADER_FILE $i > $TMP_DIR/$i
|
||||
: ${i:${#SOURCE_DIR}}
|
||||
local OUT_FILE="$OUTPUT_DIR/${_: :-4}"
|
||||
if [ $1 == 1 ]
|
||||
then
|
||||
echo "Building $OUT_FILE ..."
|
||||
fi
|
||||
php $TMP_DIR/$i > $OUT_FILE
|
||||
cat $PROJECT_CONFIG_FILE $i | php > $OUT_FILE
|
||||
done
|
||||
|
||||
for i in $(find $SOURCE_DIR -type f -not -name '*.php')
|
||||
@ -210,8 +204,6 @@ function build_project()
|
||||
fi
|
||||
cp $i $OUT_FILE
|
||||
done
|
||||
|
||||
rm -r $TMP_DIR
|
||||
}
|
||||
|
||||
set_config_vars
|
||||
|
Loading…
Reference in New Issue
Block a user