Skip to content

Version 0.2.1 #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# wsjcpp-arguments

[![Build Status](https://api.travis-ci.com/wsjcpp/wsjcpp-arguments.svg?branch=master)](https://travis-ci.com/wsjcpp/wsjcpp-arguments) [![Github Stars](https://img.shields.io/github/stars/wsjcpp/wsjcpp-arguments.svg?label=github%20%E2%98%85)](https://github.com/wsjcpp/wsjcpp-arguments/stargazers) [![Github Stars](https://img.shields.io/github/contributors/wsjcpp/wsjcpp-arguments.svg)](https://github.com/wsjcpp/wsjcpp-arguments/) [![Github Forks](https://img.shields.io/github/forks/wsjcpp/wsjcpp-arguments.svg?label=github%20forks)](https://github.com/wsjcpp/wsjcpp-arguments/network/members)
[![Build Status](https://api.travis-ci.com/wsjcpp/wsjcpp-arguments.svg?branch=master)](https://travis-ci.com/wsjcpp/wsjcpp-arguments) [![Github Stars](https://img.shields.io/github/stars/wsjcpp/wsjcpp-arguments.svg?label=github%20%E2%98%85)](https://github.com/wsjcpp/wsjcpp-arguments/stargazers) [![Github Stars](https://img.shields.io/github/contributors/wsjcpp/wsjcpp-arguments.svg)](https://github.com/wsjcpp/wsjcpp-arguments/) [![Github Forks](https://img.shields.io/github/forks/wsjcpp/wsjcpp-arguments.svg?label=github%20forks)](https://github.com/wsjcpp/wsjcpp-arguments/network/members) [![Total alerts](https://img.shields.io/lgtm/alerts/g/wsjcpp/wsjcpp-arguments.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/wsjcpp/wsjcpp-arguments/alerts/) [![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/wsjcpp/wsjcpp-arguments.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/wsjcpp/wsjcpp-arguments/context:cpp)

Parsing and handling for application arguments

Expand Down
6 changes: 3 additions & 3 deletions src.wsjcpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Automaticly generated by wsjcpp@v0.1.5
# Automaticly generated by wsjcpp@v0.1.6
cmake_minimum_required(VERSION 3.0)

add_definitions(-DWSJCPP_APP_VERSION="v0.2.0")
add_definitions(-DWSJCPP_APP_VERSION="v0.2.1")
add_definitions(-DWSJCPP_APP_NAME="wsjcpp-arguments")

if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
Expand All @@ -17,7 +17,7 @@ set (WSJCPP_SOURCES "")
find_package(Threads REQUIRED)
list (APPEND WSJCPP_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})

# wsjcpp-core:v0.1.0
# wsjcpp-core:v0.2.1
list (APPEND WSJCPP_INCLUDE_DIRS "./src.wsjcpp/wsjcpp_core/")
list (APPEND WSJCPP_SOURCES "./src.wsjcpp/wsjcpp_core/wsjcpp_core.cpp")
list (APPEND WSJCPP_SOURCES "./src.wsjcpp/wsjcpp_core/wsjcpp_core.h")
Expand Down
81 changes: 81 additions & 0 deletions src.wsjcpp/wsjcpp_core/generate.Class.wsjcpp-script
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/usr/bin/wsjcpp-safe-scripting

# log_info rootdir
# log_info script_filename

make_dir "src"

var user_class_name
set_value user_class_name arg1
normalize_class_name user_class_name
convert_CamelCase_to_snake_case user_class_name user_class_name

var class_name
set_value class_name arg1
normalize_class_name class_name

var base_filename
convert_CamelCase_to_snake_case class_name base_filename
# log_info base_filename

var filename_cpp
concat filename_cpp "./src/" base_filename ".cpp"

var filename_h
concat filename_h "./src/" base_filename ".h"

var ifndef_header
set_value ifndef_header base_filename
concat ifndef_header "_H"

to_upper_case ifndef_header

var content_header
concat content_header "#ifndef " ifndef_header "
#define " ifndef_header "

#include <string>

class " class_name " {
public:
" class_name "();

private:
std::string TAG;
};

#endif // " ifndef_header


var content_source
concat content_source "
#include \"" base_filename ".h\"
#include <wsjcpp_core.h>

// ---------------------------------------------------------------------
// " class_name "

" class_name "::" class_name "() {
TAG = \"" class_name "\";
}

"

var file_source
concat file_source "src/" filename_cpp

write_file filename_h content_header
write_file filename_cpp content_source

log_info "
======
Generated class:
- " class_name "
Generated files:
- " filename_h "
- " filename_cpp "
======
"

cmakelists_txt_append_wsjcpp filename_h
cmakelists_txt_append_wsjcpp filename_cpp
70 changes: 70 additions & 0 deletions src.wsjcpp/wsjcpp_core/generate.WsjcppUnitTest.wsjcpp-script
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/usr/bin/wsjcpp-safe-scripting

# log_info rootdir
# log_info script_filename

make_dir "./unit-tests.wsjcpp"
make_dir "./unit-tests.wsjcpp/src"

var class_name
set_value class_name arg1
normalize_class_name class_name

var filename_cpp
set_value filename_cpp arg2

var content_source
concat content_source "
#include <wsjcpp_core.h>
#include <wsjcpp_unit_tests.h>

// ---------------------------------------------------------------------
// " class_name "

class " class_name " : public WsjcppUnitTestBase {
public:
" class_name "();
virtual bool doBeforeTest() override;
virtual void executeTest() override;
virtual bool doAfterTest() override;
};

REGISTRY_WSJCPP_UNIT_TEST(" class_name ")

" class_name "::" class_name "()
: WsjcppUnitTestBase(\"" class_name "\") {
}

// ---------------------------------------------------------------------

bool " class_name "::doBeforeTest() {
// do something before test
return true;
}

// ---------------------------------------------------------------------

void " class_name "::executeTest() {
compare(\"Not implemented\", true, false);
// TODO unit test source code here
}

// ---------------------------------------------------------------------

bool " class_name "::doAfterTest() {
// do somethig after test
return true;
}

"

write_file filename_cpp content_source

log_info "
======
Generated class:
- " class_name "
Generated files:
- " filename_cpp "
======
"
20 changes: 17 additions & 3 deletions src.wsjcpp/wsjcpp_core/wsjcpp.hold.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_cxx_standard: 11
cmake_minimum_required: 3.0

name: wsjcpp-core
version: v0.1.0
version: v0.2.1
description: Basic Utils for wsjcpp
issues: https://github.com/wsjcpp/wsjcpp-core/issues
repositories:
Expand Down Expand Up @@ -33,13 +33,17 @@ distribution:
- source-file: "src/wsjcpp_unit_tests_main.cpp"
target-file: "wsjcpp_unit_tests_main.cpp"
type: "unit-tests"
- source-file: "scripts.wsjcpp/generate.WsjcppUnitTest.wsjcpp-script"
target-file: "generate.WsjcppUnitTest.wsjcpp-script"
type: "safe-scripting-generate"
- source-file: "scripts.wsjcpp/generate.Class.wsjcpp-script"
target-file: "generate.Class.wsjcpp-script"
type: "safe-scripting-generate"

unit-tests:
cases:
- name: CoreNormalizePath
description: Check function normalizePath
- name: CoreUuid
description: Check test generate uuid function
- name: CoreExtractFilename
description: Check function extract filenane from path
- name: "ToUpper"
Expand Down Expand Up @@ -68,3 +72,13 @@ unit-tests:
description: "Test join function"
- name: "getHumanSizeBytes"
description: "Test function get human size in bytes"
- name: "TestResources"
description: "Test basic resources"
- name: "ListOfDirs"
description: "Check list of directories"
- name: "FilePermissions"
description: ""
- name: "StringPadding"
description: ""
- name: "DateTimeFormat"
description: ""
Loading