Check to be in Isidore project.
This commit is contained in:
		
							
								
								
									
										21
									
								
								isidore.sh
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								isidore.sh
									
									
									
									
									
								
							| @@ -16,6 +16,7 @@ | |||||||
| # You should have received a copy of the GNU Affero General Public License | # You should have received a copy of the GNU Affero General Public License | ||||||
| # along with this program.  If not, see <http://www.gnu.org/licenses/>. | # along with this program.  If not, see <http://www.gnu.org/licenses/>. | ||||||
|  |  | ||||||
|  | ISIDORE_VERSION="0.1.0" | ||||||
| ISIDORE_CONFIG_DIR="" | ISIDORE_CONFIG_DIR="" | ||||||
| ISIDORE_CONFIG_DIR_OPTIONS=( | ISIDORE_CONFIG_DIR_OPTIONS=( | ||||||
| 	"$XDG_CONFIG_HOME/isidore" | 	"$XDG_CONFIG_HOME/isidore" | ||||||
| @@ -75,6 +76,18 @@ function print_usage() | |||||||
| 	echo "USAGE: $1 <command> [options]" | 	echo "USAGE: $1 <command> [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. | # Create a new project. | ||||||
| # | # | ||||||
| @@ -94,6 +107,7 @@ function new_project() | |||||||
| \$site_name = \"$NEW_PROJECT_NAME\"; | \$site_name = \"$NEW_PROJECT_NAME\"; | ||||||
| \$author = \"$ISIDORE_AUTHOR_NAME\"; | \$author = \"$ISIDORE_AUTHOR_NAME\"; | ||||||
| ?>" >> $NEW_PROJECT_DIR/config.php | ?>" >> $NEW_PROJECT_DIR/config.php | ||||||
|  | 	echo "$ISIDORE_VERSION" > $NEW_PROJECT_DIR/.isidore-version | ||||||
| } | } | ||||||
|  |  | ||||||
| ## | ## | ||||||
| @@ -101,8 +115,11 @@ function new_project() | |||||||
| ## | ## | ||||||
| function clean_project() | function clean_project() | ||||||
| { | { | ||||||
| 	# TODO: Ensure that this is within an Isidore project. | 	check_in_project | ||||||
| 	rm -r output/ | 	if [ -d "./output/" ] | ||||||
|  | 	then | ||||||
|  | 		rm -r ./output/ | ||||||
|  | 	fi | ||||||
| 	echo "Project cleaned." | 	echo "Project cleaned." | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user