From d71ae0195088314cc97acf9269626f3a6a368623 Mon Sep 17 00:00:00 2001
From: Sergi Hernandez Juan <shernand@iri.upc.edu>
Date: Wed, 21 Feb 2018 12:05:29 +0100
Subject: [PATCH] Changed the structure of the project. Removed the trubk, tags
 and branches folders. Removed some arguments of the scripts no longer used.

---
 new_project.sh | 88 +++++++++++++++-----------------------------------
 1 file changed, 26 insertions(+), 62 deletions(-)

diff --git a/new_project.sh b/new_project.sh
index baa267a..906152d 100755
--- a/new_project.sh
+++ b/new_project.sh
@@ -4,10 +4,8 @@ DEP=
 TYPE=
 PROJECT_NAME=
 NAME=
-SVN=0
-IRI_DOC=0
 
-while getopts “t:p:n:d:si” OPTION
+while getopts “t:p:n:d” OPTION
 do
   case $OPTION in
     t)
@@ -22,12 +20,6 @@ do
     d)
        DEP=$OPTARG
        ;;
-    s)
-       SVN=1
-       ;;
-    i) 
-       IRI_DOC=1
-       ;;
     ?)
        echo invalid argument $OPTION
        exit
@@ -38,7 +30,7 @@ done
 case $TYPE in
   application) echo Generating an application project ...
                ;;
-  driver) echo Generating a driver project ...
+  library) echo Generating a library project ...
           ;;
   *) echo Unknown project type "$TYPE"
      exit
@@ -62,36 +54,8 @@ else
   exit
 fi
 
-#create the branches directory
-BRANCHES_DIR="./branches"
-if [ -e "$BRANCHES_DIR" ]
-then
-  echo "$BRANCHES_DIR directory already exists, skipping ..."
-else
-  echo "Creating $BRANCHES_DIR directory"
-  mkdir $BRANCHES_DIR
-fi  
-#create the tags directory
-TAGS_DIR="./tags"
-if [ -e "$TAGS_DIR" ]
-then
-  echo "$TAGS_DIR directory already exists, skipping ..."
-else
-  echo "Creating $TAGS_DIR directory"
-  mkdir $TAGS_DIR
-fi  
-#create the tags directory
-TRUNK_DIR="./trunk"
-if [ -e "$TRUNK_DIR" ]
-then
-  echo "$TRUNK_DIR directory already exists, skipping ..."
-else
-  echo "Creating $TRUNK_DIR directory"
-  mkdir $TRUNK_DIR
-fi  
-
 #create the bin directory
-BIN_DIR="./trunk/bin"
+BIN_DIR="./bin"
 if [ -e "$BIN_DIR" ]
 then
   echo "$BIN_DIR directory already exists, skipping ..."
@@ -100,7 +64,7 @@ else
   mkdir $BIN_DIR
 fi  
 # create the lib directory
-LIB_DIR="./trunk/lib"
+LIB_DIR="./lib"
 if [ -e "$LIB_DIR" ]
 then
   echo "$LIB_DIR directory already exists, skipping ..."
@@ -109,7 +73,7 @@ else
   mkdir $LIB_DIR
 fi  
 # create the src directory
-SRC_DIR="./trunk/src"
+SRC_DIR="./src"
 if [ -e "$SRC_DIR" ]
 then
   echo "$SRC_DIR directory already exists, skipping ..."
@@ -118,9 +82,9 @@ else
   mkdir $SRC_DIR
 fi  
 #create the src/examples directory
-if [ $TYPE = driver ]
+if [ $TYPE = library ]
 then 
-  EXAMPLES_DIR="./trunk/src/examples"
+  EXAMPLES_DIR="./src/examples"
   if [ -e "$EXAMPLES_DIR" ]
   then
     echo "$EXAMPLES_DIR directory already exists, skipping ..."
@@ -131,7 +95,7 @@ then
 fi
 
 # create the build directory
-BUILD_DIR="./trunk/build"
+BUILD_DIR="./build"
 if [ -e "$BUILD_DIR" ]
 then
   echo "$BUILD_DIR directory already exists, skipping ..."
@@ -140,7 +104,7 @@ else
   mkdir $BUILD_DIR
 fi  
 #create the doc directory
-DOC_DIR="./trunk/doc"
+DOC_DIR="./doc"
 if [ -e "$DOC_DIR" ]
 then
   echo "$DOC_DIR directory already exists, skipping ..."
@@ -149,7 +113,7 @@ else
   mkdir $DOC_DIR
 fi  
 #create the doc/images directory
-IMAGES_DIR="./trunk/doc/images"
+IMAGES_DIR="./doc/images"
 if [ -e "$IMAGES_DIR" ]
 then
   echo "$IMAGES_DIR directory already exists, skipping ..."
@@ -158,7 +122,7 @@ else
   mkdir $IMAGES_DIR
 fi  
 # create the doc/files directory
-FILES_DIR="./trunk/doc/files"
+FILES_DIR="./doc/files"
 if [ -e "$FILES_DIR" ]
 then
   echo "$FILES_DIR directory already exists, skipping ..."
@@ -171,24 +135,24 @@ fi
 arr=$(echo $DEP | tr "," "\n")
 
 #Set the author's email on the ReadMe.txt disclaimer file
-sed 's/author_email/'$LOGNAME'/g' <ReadMe_template.txt >tmp1.txt
+sed 's/author_email/labrobotica@iri.upc.edu/g' <ReadMe_template.txt >tmp1.txt
 #set the author's name on the ReadMe.txt disclaimer file
-sed 's/author_name/'$LOGNAME'/g' <tmp1.txt >tmp2.txt
+sed 's/author_name/IRI labrobotics/g' <tmp1.txt >tmp2.txt
 #Set the project name on the ReadMe.txt disclaimer file
-sed 's/project_name/'"$PROJECT_NAME"'/g' <tmp2.txt >./trunk/ReadMe.txt
+sed 's/project_name/'"$PROJECT_NAME"'/g' <tmp2.txt >./ReadMe.txt
 rm tmp1.txt
 rm tmp2.txt
 rm ReadMe_template.txt
 
 #Set the project name on the CMakeLists.txt script file
 NEW_NAME=$(echo $NAME | sed 's/_/-/g')
-sed 's/project_name/'$NEW_NAME'/g' <CMakeLists_template.txt >./trunk/CMakeLists.txt
+sed 's/project_name/'$NEW_NAME'/g' <CMakeLists_template.txt >./CMakeLists.txt
 rm CMakeLists_template.txt
 
 #Set the project name on the doxygen_project_name.dox sript file
-sed 's/project_name/'"$PROJECT_NAME"'/g' <doxygen_project_name_template.conf >./trunk/doc/doxygen_project_name.conf
+sed 's/project_name/'"$PROJECT_NAME"'/g' <doxygen_project_name_template.conf >./doc/doxygen_project_name.conf
 rm doxygen_project_name_template.conf
-mv doxygen_template.conf ./trunk/doc/doxygen.conf
+mv doxygen_template.conf ./doc/doxygen.conf
 
 #create the CMakeLists.txt script file
 if [ $TYPE = application ]
@@ -215,8 +179,8 @@ then
   do
     echo "TARGET_LINK_LIBRARIES(${NAME} "'${'"${x}_LIBRARY"'}'")" >> CMakeLists.tmp
   done
-  mv CMakeLists.tmp ./trunk/src/CMakeLists.txt	
-  mv application_src_template.cpp ./trunk/src/$NAME.cpp
+  mv CMakeLists.tmp ./src/CMakeLists.txt	
+  mv application_src_template.cpp ./src/$NAME.cpp
 else
   echo "# driver source files" >> CMakeLists.tmp
   echo "SET(sources ${NAME}.cpp)" >> CMakeLists.tmp
@@ -247,7 +211,7 @@ else
   echo "INSTALL(FILES "'${'"headers"'}' "DESTINATION include/iridrivers)" >> CMakeLists.tmp
   echo "INSTALL(FILES ../Find$NAME.cmake DESTINATION "'${'"CMAKE_ROOT"'}'"/Modules/)" >> CMakeLists.tmp
   echo "ADD_SUBDIRECTORY(examples)" >> CMakeLists.tmp
-  mv CMakeLists.tmp ./trunk/src/CMakeLists.txt
+  mv CMakeLists.tmp ./src/CMakeLists.txt
   
   echo "# create an example application" >> CMakeLists.tmp
   echo "ADD_EXECUTABLE(${NAME}_test ${NAME}_test.cpp)" >> CMakeLists.tmp
@@ -257,29 +221,29 @@ else
   do
     echo "TARGET_LINK_LIBRARIES(${NAME}_test "'${'"${x}_LIBRARY"'}'")" >> CMakeLists.tmp
   done
-  mv CMakeLists.tmp ./trunk/src/examples/CMakeLists.txt
+  mv CMakeLists.tmp ./src/examples/CMakeLists.txt
 
   sed 's/header_file/'"${NAME}.h"'/g' <Findlib_template.cmake >tmp.cmake
-  sed 's/library_name/'$NAME'/g' <tmp.cmake >./trunk/Find$NAME.cmake
+  sed 's/library_name/'$NAME'/g' <tmp.cmake >./Find$NAME.cmake
   rm tmp.cmake
 
   LIBRARY_NAME=$(echo $NAME | tr '[:lower:]' '[:upper:]')
   Library_name=$(echo $NAME | sed 's/\([a-zA-Z]\)\([a-zA-Z0-9]*\)/\u\1\2/g')
   sed 's/Library_name/'$Library_name'/g' <driver_header_template.h >tmp.h
-  sed 's/LIBRARY_NAME/'$LIBRARY_NAME'/g' <tmp.h >./trunk/src/$NAME.h
+  sed 's/LIBRARY_NAME/'$LIBRARY_NAME'/g' <tmp.h >./src/$NAME.h
   rm tmp.h
   
   sed 's/library_name/'$NAME'/g' <driver_src_template.cpp >tmp.cpp
   sed 's/Library_name/'$Library_name'/g' <tmp.cpp >tmp2.cpp
-  sed 's/Library_name/'$Library_name'/g' <tmp2.cpp >./trunk/src/$NAME.cpp
+  sed 's/Library_name/'$Library_name'/g' <tmp2.cpp >./src/$NAME.cpp
   rm tmp.cpp
   rm tmp2.cpp
 
-  sed 's/library_name/'$NAME'/g' <driver_example_src_template.cpp >./trunk/src/examples/${NAME}_test.cpp
+  sed 's/library_name/'$NAME'/g' <driver_example_src_template.cpp >./src/examples/${NAME}_test.cpp
   rm application_src_template.cpp
 fi
 sed 's/library_name/'$NAME'/g' <main_template.dox >tmp.dox
-sed 's/project_name/'"$PROJECT_NAME"'/g' <tmp.dox >./trunk/doc/main.dox
+sed 's/project_name/'"$PROJECT_NAME"'/g' <tmp.dox >./doc/main.dox
 rm driver_src_template.cpp
 rm driver_header_template.h
 rm driver_example_src_template.cpp
-- 
GitLab