Compare commits
3 commits
b3d33c2db9
...
487040e99b
Author | SHA1 | Date | |
---|---|---|---|
|
487040e99b | ||
|
593edd59f1 | ||
|
f047a88629 |
3 changed files with 70 additions and 8 deletions
16
.template_files/modules/module_name.cpp
Normal file
16
.template_files/modules/module_name.cpp
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* Author: username
|
||||
* Date: todays_date
|
||||
* filename: module_name.cpp
|
||||
* description: module_purpose
|
||||
*/
|
||||
|
||||
#include "module_name.h"
|
||||
|
||||
// dumb test function
|
||||
int add_two(int a)
|
||||
{
|
||||
int b = a;
|
||||
b += 2;
|
||||
return b;
|
||||
}
|
|
@ -12,7 +12,7 @@ extern "C"
|
|||
#include "module_name.h"
|
||||
}
|
||||
|
||||
TEST_GROUP(FirstTestGroup)
|
||||
TEST_GROUP(test_module_name)
|
||||
{
|
||||
void setup()
|
||||
{
|
||||
|
@ -24,12 +24,12 @@ TEST_GROUP(FirstTestGroup)
|
|||
}
|
||||
};
|
||||
|
||||
TEST(FirstTestGroup, FirstTest)
|
||||
TEST(test_module_name, FirstTest)
|
||||
{
|
||||
FAIL("Fail me!");
|
||||
}
|
||||
|
||||
TEST(FirstTestGroup, SecondTest)
|
||||
TEST(test_module_name, SecondTest)
|
||||
{
|
||||
STRCMP_EQUAL("hello", "world");
|
||||
LONGS_EQUAL(1, 2);
|
||||
|
|
54
otto.sh
54
otto.sh
|
@ -117,6 +117,7 @@ git_remove_module () {
|
|||
|
||||
|
||||
add_new_module () {
|
||||
|
||||
read -p "Enter the name of the module:" modname
|
||||
|
||||
result=$(does_module_exist "$modname")
|
||||
|
@ -138,6 +139,34 @@ add_new_module () {
|
|||
#copy the template files.
|
||||
echo "copying & customizing template files..."
|
||||
|
||||
echo "Select an option:"
|
||||
echo "1.) Add a C module"
|
||||
echo "2.) Add a C++ module"
|
||||
|
||||
read -P "choice:" lanuage_selection
|
||||
|
||||
case $lanuage_selection in
|
||||
1)
|
||||
echo "You selected Option 1"
|
||||
add_c_mdoule
|
||||
;;
|
||||
2)
|
||||
echo "You selected Option 2"
|
||||
add_cpp_module
|
||||
;;
|
||||
*)
|
||||
echo "Invalid Choice!\nExiting..."
|
||||
;;
|
||||
esac
|
||||
|
||||
# Now we add the new files to the git tracked files
|
||||
git_add_module "${modname}"
|
||||
|
||||
|
||||
}
|
||||
|
||||
add_c_mdoule () {
|
||||
|
||||
sed "s/module_name/${modname}/" $MODULE_DIR/module_name.c > $modsrc_dir/${modname}.c
|
||||
sed -i'' "3s/todays_date/$(date +%Y)/" $modsrc_dir/${modname}.c
|
||||
|
||||
|
@ -156,12 +185,29 @@ add_new_module () {
|
|||
tree -L 2 $modsrc_dir
|
||||
tree -L 2 $modtest_dir
|
||||
|
||||
# Now we add the new files to the git tracked files
|
||||
git_add_module "${modname}"
|
||||
|
||||
|
||||
}
|
||||
|
||||
add_cpp_module () {
|
||||
|
||||
sed "s/module_name/${modname}/" $MODULE_DIR/module_name.cpp > $modsrc_dir/${modname}.cpp
|
||||
sed -i'' "3s/todays_date/$(date +%Y)/" $modsrc_dir/${modname}.cpp
|
||||
|
||||
sed "s/module_name/${modname_cap}/" $MODULE_DIR/module_name.h > $modsrc_dir/${modname}.h
|
||||
sed -i'' "3s/todays_date/$(date +%Y)/" $modsrc_dir/${modname}.h
|
||||
|
||||
sed "s/module_name/${modname}/" $MODULE_DIR/CMakeLists.txt > $modsrc_dir/CMakeLists.txt
|
||||
|
||||
sed "s/module_name/${modname}/" $MODULE_DIR/test_module_name.cpp > $modtest_dir/test_${modname}.cpp
|
||||
sed "s/module_name/${modname}/" $MODULE_DIR/TestCMakeLists.txt > $modtest_dir/CMakeLists.txt
|
||||
|
||||
# Add the module to the cmake lists files.
|
||||
add_module_to_cmakes "${modname}"
|
||||
|
||||
echo "Resulting files/dirs:"
|
||||
tree -L 2 $modsrc_dir
|
||||
tree -L 2 $modtest_dir
|
||||
|
||||
}
|
||||
|
||||
del_module () {
|
||||
read -p "Enter the name of the module:" modname
|
||||
|
|
Loading…
Add table
Reference in a new issue