diff --git a/isidore.sh b/isidore.sh index 249cd7e..125817f 100755 --- a/isidore.sh +++ b/isidore.sh @@ -16,6 +16,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +ISIDORE_VERSION="0.1.0" ISIDORE_CONFIG_DIR="" ISIDORE_CONFIG_DIR_OPTIONS=( "$XDG_CONFIG_HOME/isidore" @@ -75,6 +76,18 @@ function print_usage() echo "USAGE: $1 [options]" } +## +# Check to see if at the root of an Isidore project. +## +function check_in_project() +{ + if ! [ -f "./config.php" ] || ! [ -f "./.isidore-version" ] + then + echo "ERROR: You are not currently in the root of an Isidore project." + exit 1 + fi +} + ## # Create a new project. # @@ -94,6 +107,7 @@ function new_project() \$site_name = \"$NEW_PROJECT_NAME\"; \$author = \"$ISIDORE_AUTHOR_NAME\"; ?>" >> $NEW_PROJECT_DIR/config.php + echo "$ISIDORE_VERSION" > $NEW_PROJECT_DIR/.isidore-version } ## @@ -101,8 +115,11 @@ function new_project() ## function clean_project() { - # TODO: Ensure that this is within an Isidore project. - rm -r output/ + check_in_project + if [ -d "./output/" ] + then + rm -r ./output/ + fi echo "Project cleaned." }