You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
2.0 KiB
78 lines
2.0 KiB
#!/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"
|
|
addProjectConfig "$customer" "$project" "$shortname"
|
|
|
|
#if [ ! -f "$path/etc/config" ]
|
|
#then
|
|
# quoted="$(sedEscape "$project_manager_dir")"
|
|
# cat "$project_manager_dir/etc/.config_template" | \
|
|
# sed "s/app_customer=''/app_customer='$customer'/" | \
|
|
# sed "s/app_project=''/app_project='$project'/" | \
|
|
# sed "s/app_project_manager_dir=''/app_project_manager_dir='$quoted'/" \
|
|
# > "$path/etc/config"
|
|
#fi
|
|
|
|
postScript "$project_manager_dir/bin/postscripts/commands/create-project"
|
|
|
|
echo
|
|
echoSuccess "Project has been created, please configure $project_dir/etc"
|
|
echo
|