#!/bin/bash ### DO NOT EDIT THIS FILE source "$(cd "$(dirname "${BASH_SOURCE[0]}")/.." &> /dev/null && pwd)/includes/bash_header" function usage { echo echoMainTitle "Creates a new project" echo echoSubTitle "Usage:" echo echo "create-project [customer] [project] [shortname]" echo echo "The given customer and project will result in the file directory as you have setted" echo "it in project_manager/etc/projects configuration file:" echo " - workspace_dir/customer/project" echo " - data_dir/customer/project" echo "It will set a configuration file for your project to:" echo " - data_dir/customer/project/etc/config" echo echo "--help Prints this message" echo " " } customer="$(getArgument "$1" "$(usage)")" project="$(getArgument "$2" "$(usage)")" shortname="$(getArgument "$3" "$(usage)")" has_project="$(hasProject "$project")" has_shortname="$(hasShortname "$shortname")" if [ "$has_project" == true ] then echoError "Project already exists" echo exit fi if [ "$has_shortname" == true ] then echoError "Shortname already exists" echo exit fi echo echoMainTitle "Create project" project_dir="$project_manager_dir/data/$customer/$project" workspace_dir="$project_manager_workspaces_dir/$customer/$project" echo echoSubTitle "Please verify data" echo echo "Project path: $workspace_dir" echo "Project data path: $project_dir" echo confirm makeProjectManagerDirectories "$shortname" makeWorkspaceDirectories "$shortname" configSet "project_manager.projects.$shortname.customer" "$customer" configSet "project_manager.projects.$shortname.project" "$project" runPostscripts "$shortname" "commands/create-project" echo echoSuccess "Project has been created, please configure $project_dir/etc" echo