From 73bf330393c064a2030adadf475a2d4595479b18 Mon Sep 17 00:00:00 2001 From: "lucas.sproule" Date: Fri, 3 Nov 2023 16:27:53 -0400 Subject: [PATCH] remove toml shit --- src/Command/Command.hpp | 50 +++++++- src/Command/CommandAdd.cpp | 2 +- src/Command/CommandFTP.cpp | 2 +- src/Command/CommandGeneral.cpp | 63 ++++----- src/Command/CommandInit.cpp | 12 +- src/Command/CommandRemove.cpp | 2 +- src/Command/CommandServer.cpp | 97 ++++++++++++++ src/Command/Interface.cpp | 2 +- src/Generators/ConfigTomlGenerator.cpp | 70 ++-------- src/Generators/Generators.hpp | 40 +++--- src/Generators/Validators/BuildDir.cpp | 2 +- src/Generators/Validators/CMakeVersion.cpp | 16 +-- src/Generators/Validators/Compiler.cpp | 22 ++-- src/Generators/Validators/IncludeDir.cpp | 16 +-- src/Generators/Validators/Language.cpp | 14 +- src/Generators/Validators/LanguageVersion.cpp | 16 +-- src/Generators/Validators/ProjectName.cpp | 16 +-- src/Generators/Validators/ProjectVersion.cpp | 2 +- src/Generators/Validators/SourceDir.cpp | 20 +-- src/Test/TestGenerators.cpp | 120 +++++++++--------- 20 files changed, 339 insertions(+), 245 deletions(-) create mode 100644 src/Command/CommandServer.cpp diff --git a/src/Command/Command.hpp b/src/Command/Command.hpp index 6023fdf..246b754 100644 --- a/src/Command/Command.hpp +++ b/src/Command/Command.hpp @@ -1,5 +1,4 @@ #pragma once -#include "nlohmann/json_fwd.hpp" #include #include #include @@ -77,8 +76,21 @@ namespace Command { } dependency; + typedef struct BuildServer { + std::string name; + std::string ip; + std::string username; + std::string authMethod; + std::optional password; + std::optional key; + std::optional path; + int port; + } BuildServer; + typedef struct Context { std::string project_name; + std::string project_type; + std::string project_description; std::filesystem::path project_path; std::string git{"null"}; std::string lang{"cpp"}; @@ -89,11 +101,42 @@ namespace Command { std::string src_dir{"src"}; std::string include_dir{"include"}; std::vector dependencies; + std::vector build_servers; std::string build_dir{"build"}; dependency testing_lib; std::string project_version{"0.0.1"}; std::vector flags; std::shared_ptr args; + nlohmann::json toJson(){ + using nlohmann::json; + std::vector deps; + for (auto &dep : dependencies) { + json dep_json; + dep_json["name"] = dep.name; + dep_json["url"] = dep.url; + dep_json["version"] = dep.version; + dep_json["target_link"] = dep.target_link; + deps.push_back(dep_json); + } + json j; + j["project_name"] = project_name; + j["cmake_version"] = cmake_version; + j["project_version"] = project_version; + j["lang"] = lang; + j["lang_version"] = lang_version; + j["compiler"] = compiler; + j["src_dir"] = src_dir; + j["build_dir"] = build_dir; + j["include_dir"] = include_dir; + j["dependencies"] = deps; + j["flags"] = flags; + j["authors"] = authors; + j["project_path"] = project_path; + j["project_type"] = project_type; + j["project_description"] = project_description; + return j; + + }; } Context; class Interface{ private: @@ -106,6 +149,8 @@ namespace Command { bool run(); bool help(); bool addFlag(); + bool server(); + bool addAuthors(); bool addDependency(); bool ftp(); @@ -122,12 +167,13 @@ namespace Command { ~Interface(); bool InitHeader(); bool CreateCMakelists(); - bool LoadPackageToml(); + bool LoadPackageJson(); }; namespace OptionsInit{ bool Init(Interface*); bool Add(Interface*); bool Remove(Interface*); + bool Server(Interface*); bool Update(Interface*); bool Main(Interface*); bool Watch(Interface*); diff --git a/src/Command/CommandAdd.cpp b/src/Command/CommandAdd.cpp index 4f9e68c..c386988 100644 --- a/src/Command/CommandAdd.cpp +++ b/src/Command/CommandAdd.cpp @@ -129,7 +129,7 @@ namespace Command { }); std::cout << "Writing config.toml" << std::endl; - Generators::ConfigToml::writeConfig(ctx); + Generators::ConfigJson::writeConfig(ctx); Generators::CMakeList::create(ctx); return true; diff --git a/src/Command/CommandFTP.cpp b/src/Command/CommandFTP.cpp index 7d68e3c..d5b6c26 100644 --- a/src/Command/CommandFTP.cpp +++ b/src/Command/CommandFTP.cpp @@ -3,7 +3,7 @@ namespace Command{ bool Interface::ftp() { - bool test = this->LoadPackageToml(); + bool test = this->LoadPackageJson(); if(!test) { std::cout << "Error: Could not load config.toml" << std::endl; return false; diff --git a/src/Command/CommandGeneral.cpp b/src/Command/CommandGeneral.cpp index f517a93..ed9e407 100644 --- a/src/Command/CommandGeneral.cpp +++ b/src/Command/CommandGeneral.cpp @@ -5,46 +5,39 @@ #include namespace Command { - bool Interface::LoadPackageToml() { + bool Interface::LoadPackageJson() { + using nlohmann::json; try { - std::string file_name = "config.toml"; - - - - auto data = toml::parse_file((ctx->project_path / file_name).string()); - ctx->project_name = data["project"]["project_name"].value_or(""); - for (auto &author : *data["project"]["authors"].as_array()) { - ctx->authors.push_back(author.value_or("")); + std::string file_name = "config.json"; + std::fstream file; + file.open((ctx->project_path / file_name).string()); + json data = json::parse(file); + ctx->project_name = data["project_name"].template get(); + ctx->authors = data["authors"].template get>(); + ctx->src_dir = data["src_dir"].template get(); + ctx->build_dir = data["build_dir"].template get(); + ctx->compiler = data["compiler"].template get(); + ctx->cmake_version = data["cmake_version"].template get(); + ctx->git = data["git"].template get(); + ctx->lang = data["lang"].template get(); + ctx->include_dir = data["include_dir"].template get(); + ctx->lang_version = data["lang_version"].template get(); + ctx->project_version = data["project_version"].template get(); + for (json &dep: data["dependencies"]) { + Command::dependency _dep; + _dep.name = dep["name"].template get(); + _dep.url = dep["url"].template get(); + _dep.version = dep["version"].template get(); + _dep.target_link = dep["target_link"].template get(); + ctx->dependencies.push_back(_dep); } - ctx->src_dir = data["project"]["src_dir"].value_or(""); - ctx->build_dir = data["project"]["build_dir"].value_or(""); - ctx->compiler = data["project"]["compiler"].value_or(""); - ctx->cmake_version = data["project"]["cmake_version"].value_or(""); - ctx->git = data["project"]["git"].value_or(""); - ctx->lang = data["project"]["lang"].value_or(""); - ctx->include_dir = - data["project"]["include_dir"].value_or(""); - ctx->lang_version = - data["project"]["lang_version"].value_or(""); - ctx->project_version = data["project"]["project_version"].value_or(""); - if (data.at_path("dependencies").is_table()) { - for (auto &dep : *data["dependencies"].as_table()) { + - Command::dependency _dep; - _dep.name = dep.first; - _dep.url = - data["dependencies"][dep.first].as_array()->at(0).value_or(""); - _dep.version = - data["dependencies"][dep.first].as_array()->at(1).value_or(""); - _dep.target_link = data["dependencies"][dep.first].as_array()->at(2).value_or(""); - ctx->dependencies.push_back(_dep); - - } - } + - } catch (const toml::parse_error &err) { - std::cout << "Error: Could not load config.toml" << std::endl; + } catch (json::exception &e) { + std::cout << "Error: Could not load config.json" << std::endl; return false; } diff --git a/src/Command/CommandInit.cpp b/src/Command/CommandInit.cpp index 7ee2dc9..bae5d19 100644 --- a/src/Command/CommandInit.cpp +++ b/src/Command/CommandInit.cpp @@ -15,9 +15,9 @@ namespace Command { bool createToml(std::shared_ptr ctx) { //Lucas did it again - std::shared_ptrconfig_toml = std::make_shared(); - Generators::ConfigToml::readUserInput(ctx, config_toml); - Generators::ConfigToml::writeConfig(ctx); + std::shared_ptrconfig_json = std::make_shared(); + Generators::ConfigJson::readUserInput(ctx, config_json); + Generators::ConfigJson::writeConfig(ctx); return false; } @@ -57,7 +57,7 @@ bool createHelloWorldC(std::shared_ptr ctx) { bool createProject(Interface *inter){ createToml(inter->ctx); - inter->LoadPackageToml(); + inter->LoadPackageJson(); Generators::CMakeList::create(inter->ctx); if(inter->ctx->lang == "cpp"){ createHelloWorldCpp(inter->ctx); @@ -105,7 +105,7 @@ bool defaultTomlCpp(std::shared_ptr ctx) { bool Interface::init() { - std::string file_name = "config.toml"; + std::string file_name = "config.json"; std::string new_project_name = ""; #ifdef DEBUG new_project_name = "DEBUG"; @@ -140,7 +140,7 @@ bool Interface::init() { exit(-1); } - this->LoadPackageToml(); + this->LoadPackageJson(); Generators::CMakeList::create(ctx); } else { createProject(this); diff --git a/src/Command/CommandRemove.cpp b/src/Command/CommandRemove.cpp index abb83cf..5f16d0c 100644 --- a/src/Command/CommandRemove.cpp +++ b/src/Command/CommandRemove.cpp @@ -44,7 +44,7 @@ Usage remove dep: return false; }); - Generators::ConfigToml::writeConfig(ctx); + Generators::ConfigJson::writeConfig(ctx); Generators::CMakeList::create(ctx); return true; } diff --git a/src/Command/CommandServer.cpp b/src/Command/CommandServer.cpp new file mode 100644 index 0000000..c34165d --- /dev/null +++ b/src/Command/CommandServer.cpp @@ -0,0 +1,97 @@ +#include "Command.hpp" +#include "../Utils/General.hpp" +namespace Command{ + bool getServerName(std::string& name){ + std::cout << "Enter the name of the server: "; + std::getline(std::cin, name); + return true; + } + bool getServerAddress(std::string& address){ + std::cout << "Enter the address of the server: "; + std::getline(std::cin, address); + return true; + } + bool getServerPort(std::string& port){ + std::cout << "Enter the port of the server: "; + std::getline(std::cin, port); + return true; + } + bool getServerUsername(std::string& username){ + std::cout << "Enter the username of the server: "; + std::getline(std::cin, username); + return true; + } + bool getServerAuthMethod(std::string& authMethod){ + std::cout << "Enter the authentication method of the server: "; + std::getline(std::cin, authMethod); + return true; + } + bool getServerPassword(std::string& password){ + std::cout << "Enter the password of the server: "; + std::getline(std::cin, password); + return true; + } + bool getServerKey(std::string& key){ + std::cout << "Enter path the ssh key for the server: "; + std::getline(std::cin, key); + return true; + } + + bool serverHelp(){ + + std::cout << R"EOF( +Usage server: + add: adds a build server + remove: removes a build server + list: lists all build servers + set: sets the current build server + get: gets the current build server + )EOF" << std::endl; + return true; + } + bool serverAdd(Interface* inter){ + std::string name, address, port, username, authMethod, password, key; + getServerName(name); + getServerAddress(address); + getServerPort(port); + getServerUsername(username); + getServerAuthMethod(authMethod); + if (authMethod == "password") { + getServerPassword(password); + } + else if (authMethod == "key") { + getServerKey(key); + } + else{ + std::cout << "Invalid authentication method" << std::endl; + return false; + } + inter->ctx->build_servers.push_back(BuildServer(name, address, port, username, authMethod, password, key)); + return true; + } + bool Interface::server(){ + + if (this->args->count("subcommand") == 0) { + serverHelp(); + + return false; + } + if (this->args->operator[]("subcommand").as() == "add") { + serverAdd(this); + } + else if (this->args->operator[]("subcommand").as() == "remove") { + } + else if (this->args->operator[]("subcommand").as() == "list") { + } + else if (this->args->operator[]("subcommand").as() == "set") { + } + else if (this->args->operator[]("subcommand").as() == "get") { + } + else{ + serverHelp(); + + return false; + } + return true; + } +} diff --git a/src/Command/Interface.cpp b/src/Command/Interface.cpp index b39bbb8..1183a18 100644 --- a/src/Command/Interface.cpp +++ b/src/Command/Interface.cpp @@ -49,7 +49,7 @@ namespace Command { std::cout << "DEBUG MODE ENABLED\n"; #endif if(command != "init"){ - this->LoadPackageToml(); + this->LoadPackageJson(); } diff --git a/src/Generators/ConfigTomlGenerator.cpp b/src/Generators/ConfigTomlGenerator.cpp index 0db6b1a..4e550b4 100644 --- a/src/Generators/ConfigTomlGenerator.cpp +++ b/src/Generators/ConfigTomlGenerator.cpp @@ -5,112 +5,70 @@ #include #include -namespace Generators::ConfigToml { +namespace Generators::ConfigJson{ - bool readUserInput(std::shared_ptr ctx, std::shared_ptr config_toml) { + bool readUserInput(std::shared_ptr ctx, std::shared_ptr config_json) { validateLang: - if(!validateLang("📚Language->" + ctx->lang + " : ", ctx, config_toml)) { + if(!validateLang("📚Language->" + ctx->lang + " : ", ctx, config_json)) { std::cout << termcolor::red << "Invalid language - retry" << termcolor::reset << std::endl; goto validateLang; } validateProjectName: - if (!validateProjectName("📖Project name->" + ctx->project_name + " : ", ctx, config_toml)) { + if (!validateProjectName("📖Project name->" + ctx->project_name + " : ", ctx, config_json)) { std::cout << termcolor::red << "Invalid project name - retry" << termcolor::reset << std::endl; goto validateProjectName; } validateCmakeVersion: - if (!validateCmakeVersion("🔨Cmake version->" + ctx->cmake_version + " : ", ctx, config_toml)) { + if (!validateCmakeVersion("🔨Cmake version->" + ctx->cmake_version + " : ", ctx, config_json)) { std::cout << termcolor::red << "Invalid cmake version - retry" << termcolor::reset << std::endl; goto validateCmakeVersion; } validateProjectVersion: - if (!validateProjectVersion("🗃️Version->" + ctx->project_version + " : ", ctx, config_toml)) { + if (!validateProjectVersion("🗃️Version->" + ctx->project_version + " : ", ctx, config_json)) { std::cout << termcolor::red << "Invalid project version - retry" << termcolor::reset << std::endl; goto validateProjectVersion; } validateLanguageVersion: - if (!validateLanguageVersion("📰Language Standard->" + ctx->lang_version + " : ", ctx, config_toml)) { + if (!validateLanguageVersion("📰Language Standard->" + ctx->lang_version + " : ", ctx, config_json)) { std::cout << termcolor::red << "Invalid language version - retry" << termcolor::reset << std::endl; goto validateLanguageVersion; } validateCompiler: - if (!validateCompiler("💽Compiler->", ctx, config_toml)) { + if (!validateCompiler("💽Compiler->", ctx, config_json)) { std::cout << termcolor::red << "Invalid compiler - retry" << termcolor::reset << std::endl; goto validateCompiler; } validateSourceDir: - if (!validateSourceDir("⛲Source Dir->" + ctx->src_dir + " : ", ctx, config_toml)) { + if (!validateSourceDir("⛲Source Dir->" + ctx->src_dir + " : ", ctx, config_json)) { std::cout << termcolor::red << "Invalid source directory - retry" << termcolor::reset << std::endl; goto validateSourceDir; } validateBuildDir: - if (!validateBuildDir("🛠️Build Dir->" + ctx->build_dir + " : ", ctx, config_toml)) { + if (!validateBuildDir("🛠️Build Dir->" + ctx->build_dir + " : ", ctx, config_json)) { std::cout << termcolor::red << "Invalid build directory - retry" << termcolor::reset << std::endl; goto validateBuildDir; } validateIncludeDir: - if (!validateIncludeDir("🫃Include Dir->" + ctx->include_dir + " : ", ctx, config_toml)) { + if (!validateIncludeDir("🫃Include Dir->" + ctx->include_dir + " : ", ctx, config_json)) { std::cout << termcolor::red << "Invalid include directory - retry" << termcolor::reset << std::endl; goto validateIncludeDir; } return true; } - bool writeConfig(std::shared_ptr &ctx) { - toml::array authors = toml::array{}; - toml::array flags = toml::array{}; - for (auto &flag : ctx->flags) { - flags.push_back(flag); - } - for (const auto &author : ctx->authors) { - authors.push_back(author); - } - toml::table table = toml::table{ - {"project", - toml::table{ - {"cmake_version", ctx->cmake_version}, - {"include_dir", ctx->include_dir}, - {"project_version", ctx->project_version}, - {"compiler", ctx->compiler}, - {"project_name", ctx->project_name}, - {"authors", authors}, - {"src_dir", ctx->src_dir}, - {"build_dir", ctx->build_dir}, - {"lang", ctx->lang}, - {"lang_version", ctx->lang_version}, - {"cflags", flags}, - }}, - }; - - toml::table deps_table = toml::table{{"dependencies", toml::table{}}}; - - for (Command::dependency dep : ctx->dependencies) { - - toml::array deps_values = toml::array{}; - deps_values.push_back(dep.url); - deps_values.push_back(dep.version); - deps_values.push_back(dep.target_link); - std::cout << deps_values << std::endl; - deps_table["dependencies"].as_table()->insert(dep.name, deps_values); - } - - - std::ofstream file; - std::string file_name = "config.toml"; + std::string file_name = "config.json"; file.open(ctx->project_path / file_name); - file << table; - file << '\n'; - file << deps_table; + file << ctx->toJson(); file << '\n'; file.close(); return true; } - } // namespace Generators::ConfigToml +} // namespace Generators::ConfigToml diff --git a/src/Generators/Generators.hpp b/src/Generators/Generators.hpp index 12dd702..018728e 100644 --- a/src/Generators/Generators.hpp +++ b/src/Generators/Generators.hpp @@ -38,7 +38,7 @@ namespace Generators{ bool create(std::shared_ptr ctx); } - namespace ConfigToml{ + namespace ConfigJson{ typedef struct Config_s{ std::string cmake_version; @@ -54,89 +54,89 @@ namespace Generators{ std::string authors_str; } Config; - bool readUserInput(std::shared_ptr ctx, std::shared_ptr config_toml); + bool readUserInput(std::shared_ptr ctx, std::shared_ptr config_json); bool writeConfig(std::shared_ptr& ctx); /* * Validate cmakeVersion * @param prefix: the prefix of the message * @param ctx: the context of the command - * @param config_toml: the config toml context + * @param config_json: the config toml context * @return: true if the cmake version is valid */ - bool validateCmakeVersion(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_toml); + bool validateCmakeVersion(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_json); /* * Validates the project name * @param prefix: the prefix of the message * @param ctx: the context of the command - * @param config_toml: the config toml context + * @param config_json: the config toml context * @return: true if the project name is valid */ - bool validateProjectName(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_toml); + bool validateProjectName(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_json); /* * Validates the project version * @param prefix: the prefix of the message * @param ctx: the context of the command - * @param config_toml: the config toml context + * @param config_json: the config toml context * @return: true if the project version is valid */ - bool validateProjectVersion(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_toml); + bool validateProjectVersion(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_json); /* * Validates the language version * @param prefix: the prefix of the message * @param ctx: the context of the command - * @param config_toml: the config toml context + * @param config_json: the config toml context * @return: true if the language version is valid */ - bool validateLanguageVersion(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_toml); + bool validateLanguageVersion(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_json); /* * Validates the compiler * @param prefix: the prefix of the message * @param ctx: the context of the command - * @param config_toml: the config toml context + * @param config_json: the config toml context * @return: true if the language is valid */ - bool validateCompiler(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_toml); + bool validateCompiler(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_json); /* * Validates the source directory * @param prefix: the prefix of the message * @param ctx: the context of the command - * @param config_toml: the config toml context + * @param config_json: the config toml context * @return: true if the source directory is valid */ - bool validateSourceDir(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_toml); + bool validateSourceDir(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_json); /* * Validates the build directory * @param prefix: the prefix of the message * @param ctx: the context of the command - * @param config_toml: the config toml context + * @param config_json: the config toml context * @return: true if the build directory is valid */ - bool validateBuildDir(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_toml); + bool validateBuildDir(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_json); /* * Reads the data from the user * @param ctx: the context of the command - * @param config_toml: the config toml context + * @param config_json: the config toml context * @return: true if the data is valid */ - bool validateIncludeDir(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_toml); + bool validateIncludeDir(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_json); /* * Validates the language * @param prefix: the prefix of the message * @param ctx: the context of the command - * @param config_toml: the config toml context + * @param config_json: the config toml context * @return: true if the language is valid */ - bool validateLang(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_toml); + bool validateLang(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_json); } } diff --git a/src/Generators/Validators/BuildDir.cpp b/src/Generators/Validators/BuildDir.cpp index 26d2263..6844419 100644 --- a/src/Generators/Validators/BuildDir.cpp +++ b/src/Generators/Validators/BuildDir.cpp @@ -6,7 +6,7 @@ #include "../Generators.hpp" -namespace Generators::ConfigToml{ +namespace Generators::ConfigJson{ /* * Validates the build directory * @param prefix: the prefix of the message diff --git a/src/Generators/Validators/CMakeVersion.cpp b/src/Generators/Validators/CMakeVersion.cpp index ede8b3f..2bc1eb5 100644 --- a/src/Generators/Validators/CMakeVersion.cpp +++ b/src/Generators/Validators/CMakeVersion.cpp @@ -6,34 +6,34 @@ #include "../Generators.hpp" -namespace Generators::ConfigToml{ +namespace Generators::ConfigJson{ /* * Validates the cmake version * @param prefix: the prefix of the message @param ctx: the context of the * command - * @param config_toml: the config toml context + * @param config_json: the config toml context * @return: true if the version is valid */ - bool validateCmakeVersion(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_toml) { + bool validateCmakeVersion(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_json) { std::cout << prefix; #ifndef TEST - std::getline(std::cin, config_toml->cmake_version); + std::getline(std::cin, config_json->cmake_version); #endif //If the version is empty we're gonna set it - if(config_toml->cmake_version == "") { + if(config_json->cmake_version == "") { goto end; } //Checking if the version is x.x.x - if(std::regex_match(config_toml->cmake_version, std::regex("^[0-4]+\\.[0-9]+\\.[0-9]+$"))) { + if(std::regex_match(config_json->cmake_version, std::regex("^[0-4]+\\.[0-9]+\\.[0-9]+$"))) { goto end; } //Checking if the version is x.x - if(std::regex_match(config_toml->cmake_version, std::regex("^[0-4]+\\.[0-9]+$"))) { + if(std::regex_match(config_json->cmake_version, std::regex("^[0-4]+\\.[0-9]+$"))) { goto end; } return false; end: - ctx->cmake_version = config_toml->cmake_version == "" ? ctx->cmake_version : config_toml->cmake_version; + ctx->cmake_version = config_json->cmake_version == "" ? ctx->cmake_version : config_json->cmake_version; return true; } diff --git a/src/Generators/Validators/Compiler.cpp b/src/Generators/Validators/Compiler.cpp index a2c3912..6cdcc32 100644 --- a/src/Generators/Validators/Compiler.cpp +++ b/src/Generators/Validators/Compiler.cpp @@ -7,15 +7,15 @@ #include "../Generators.hpp" -namespace Generators::ConfigToml{ +namespace Generators::ConfigJson{ /* * Validates the compiler * @param prefix: the prefix of the message * @param ctx: the context of the command - * @param config_toml: the config toml context + * @param config_json: the config toml context * @return: true if the language is valid */ - bool validateCompiler(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_toml) { + bool validateCompiler(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_json) { std::vector supportedCppCompilers = {"g++", "clang++"}; std::vector supportedCCompilers = {"gcc", "clang", "msvc", "icc", "tcc", "emcc"}; std::cout << prefix << ENDL; @@ -31,7 +31,7 @@ namespace Generators::ConfigToml{ } } } - if(config_toml->lang == "c"){ + if(config_json->lang == "c"){ ctx->compiler = supportedCCompilers[0]; std::cout << " Supported Compilers: "; for(std::string comp : supportedCCompilers){ @@ -45,21 +45,21 @@ namespace Generators::ConfigToml{ } std::cout << "): "; #ifndef TEST - std::getline(std::cin, config_toml->compiler); + std::getline(std::cin, config_json->compiler); #endif //If the compiler is empty we're gonna set it - if(config_toml->compiler == "") { + if(config_json->compiler == "") { goto end; } - if(config_toml->lang == "cpp" || config_toml->lang == "c++"){ + if(config_json->lang == "cpp" || config_json->lang == "c++"){ for(std::string compiler : supportedCppCompilers){ - if(config_toml->compiler == compiler){ + if(config_json->compiler == compiler){ goto end; } } - }else if(config_toml->lang == "c"){ + }else if(config_json->lang == "c"){ for(std::string compiler : supportedCCompilers){ - if(config_toml->compiler == compiler){ + if(config_json->compiler == compiler){ goto end; } } @@ -67,7 +67,7 @@ namespace Generators::ConfigToml{ return false; end: - ctx->compiler = config_toml->compiler == "" ? ctx->compiler : config_toml->compiler; + ctx->compiler = config_json->compiler == "" ? ctx->compiler : config_json->compiler; return true; } diff --git a/src/Generators/Validators/IncludeDir.cpp b/src/Generators/Validators/IncludeDir.cpp index 09e39ee..a8213d4 100644 --- a/src/Generators/Validators/IncludeDir.cpp +++ b/src/Generators/Validators/IncludeDir.cpp @@ -7,34 +7,34 @@ #include "../Generators.hpp" -namespace Generators::ConfigToml{ +namespace Generators::ConfigJson{ /* * Reads the data from the user * @param ctx: the context of the command - * @param config_toml: the config toml context + * @param config_json: the config toml context * @return: true if the data is valid */ - bool validateIncludeDir(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_toml) { + bool validateIncludeDir(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_json) { std::cout << prefix; #ifndef TEST - std::getline(std::cin, config_toml->include_dir); + std::getline(std::cin, config_json->include_dir); #endif //If the include directory is empty we're gonna set it - if(config_toml->include_dir == "") { + if(config_json->include_dir == "") { goto end; } - if (config_toml->include_dir.size() > 255) { + if (config_json->include_dir.size() > 255) { return false; } //check if the include directory is valid - if (std::regex_match(config_toml->include_dir, std::regex("^[a-zA-Z0-9_-]+$"))) { + if (std::regex_match(config_json->include_dir, std::regex("^[a-zA-Z0-9_-]+$"))) { goto end; } return false; end: - ctx->include_dir = config_toml->include_dir == "" ? ctx->include_dir : config_toml->include_dir; + ctx->include_dir = config_json->include_dir == "" ? ctx->include_dir : config_json->include_dir; return true; } diff --git a/src/Generators/Validators/Language.cpp b/src/Generators/Validators/Language.cpp index 59f3924..6847864 100644 --- a/src/Generators/Validators/Language.cpp +++ b/src/Generators/Validators/Language.cpp @@ -6,15 +6,15 @@ #include "../Generators.hpp" -namespace Generators::ConfigToml { +namespace Generators::ConfigJson{ /* * Validates the language * @param prefix: the prefix of the message * @param ctx: the context of the command - * @param config_toml: the config toml context + * @param config_json: the config toml context * @return: true if the language is valid */ - bool validateLang(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_toml) { + bool validateLang(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_json) { std::vector supportedLangs = {"cpp", "c"}; std::cout << prefix << ENDL; std::cout << " Supported languages: ( "; @@ -23,20 +23,20 @@ namespace Generators::ConfigToml { } std::cout << "): "; #ifndef TEST - std::getline(std::cin, config_toml->lang); + std::getline(std::cin, config_json->lang); #endif - if(config_toml->lang == "") { + if(config_json->lang == "") { goto end; } for(std::string lang : supportedLangs){ - if(config_toml->lang == lang){ + if(config_json->lang == lang){ goto end; } } return false; end: - ctx->lang = config_toml->lang == "" ? ctx->lang : config_toml->lang; + ctx->lang = config_json->lang == "" ? ctx->lang : config_json->lang; return true; } } diff --git a/src/Generators/Validators/LanguageVersion.cpp b/src/Generators/Validators/LanguageVersion.cpp index faaca2b..5e6ce12 100644 --- a/src/Generators/Validators/LanguageVersion.cpp +++ b/src/Generators/Validators/LanguageVersion.cpp @@ -6,41 +6,41 @@ #include "../Generators.hpp" -namespace Generators::ConfigToml{ +namespace Generators::ConfigJson{ /* * Validates the language version * @param prefix: the prefix of the message * @param ctx: the context of the command - * @param config_toml: the config toml context + * @param config_json: the config toml context * @return: true if the language version is valid */ - bool validateLanguageVersion(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_toml) { + bool validateLanguageVersion(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_json) { std::cout << prefix; #ifndef TEST - std::getline(std::cin, config_toml->lang_version); + std::getline(std::cin, config_json->lang_version); #endif std::vector valid_c_versions = {"89", "90", "94", "99", "11", "18"}; std::vector valid_cpp_versions = {"98", "03", "11", "14", "17", "20","23"}; //If the version is empty we're gonna set it - if(config_toml->lang_version == "") { + if(config_json->lang_version == "") { goto end; } for(std::string version : valid_c_versions) { - if(config_toml->lang_version == version) { + if(config_json->lang_version == version) { goto end; break; } } for(std::string version : valid_cpp_versions) { - if(config_toml->lang_version == version) { + if(config_json->lang_version == version) { goto end; break; } } return false; end: - ctx->lang_version = config_toml->lang_version == "" ? ctx->lang_version : config_toml->lang_version; + ctx->lang_version = config_json->lang_version == "" ? ctx->lang_version : config_json->lang_version; return true; } diff --git a/src/Generators/Validators/ProjectName.cpp b/src/Generators/Validators/ProjectName.cpp index 4c9bd43..53b1324 100644 --- a/src/Generators/Validators/ProjectName.cpp +++ b/src/Generators/Validators/ProjectName.cpp @@ -6,34 +6,34 @@ #include "../Generators.hpp" -namespace Generators::ConfigToml { +namespace Generators::ConfigJson{ /* * Validates the project name * @param prefix: the prefix of the message * @param ctx: the context of the command - * @param config_toml: the config toml context + * @param config_json: the config toml context * @return: true if the project name is valid */ - bool validateProjectName(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_toml) { + bool validateProjectName(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_json) { std::cout << prefix; #ifndef TEST - std::getline(std::cin, config_toml->project_name); + std::getline(std::cin, config_json->project_name); #endif //If the name is empty we're gonna set it - if(config_toml->project_name == "") { + if(config_json->project_name == "") { goto end; } //Checking if the name is valid - if ((config_toml->project_name.size() > 255)) { + if ((config_json->project_name.size() > 255)) { return false; } - if(std::regex_match(config_toml->project_name, std::regex("^[a-zA-Z0-9_-]+$"))) { + if(std::regex_match(config_json->project_name, std::regex("^[a-zA-Z0-9_-]+$"))) { goto end; } return false; end: - ctx->project_name = config_toml->project_name == "" ? ctx->project_name : config_toml->project_name; + ctx->project_name = config_json->project_name == "" ? ctx->project_name : config_json->project_name; return true; } diff --git a/src/Generators/Validators/ProjectVersion.cpp b/src/Generators/Validators/ProjectVersion.cpp index b8ba034..c3fffb8 100644 --- a/src/Generators/Validators/ProjectVersion.cpp +++ b/src/Generators/Validators/ProjectVersion.cpp @@ -7,7 +7,7 @@ #include "../Generators.hpp" -namespace Generators::ConfigToml { +namespace Generators::ConfigJson{ /* * Validates the project version * @param prefix: the prefix of the message diff --git a/src/Generators/Validators/SourceDir.cpp b/src/Generators/Validators/SourceDir.cpp index ff96468..0ce9381 100644 --- a/src/Generators/Validators/SourceDir.cpp +++ b/src/Generators/Validators/SourceDir.cpp @@ -7,39 +7,39 @@ #include "../Generators.hpp" -namespace Generators::ConfigToml{ +namespace Generators::ConfigJson{ /* * Validates the source directory * @param prefix: the prefix of the message * @param ctx: the context of the command - * @param config_toml: the config toml context + * @param config_json: the config toml context * @return: true if the source directory is valid */ - bool validateSourceDir(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_toml) { + bool validateSourceDir(std::string prefix, std::shared_ptr ctx, std::shared_ptr config_json) { std::cout << prefix; #ifndef TEST - std::getline(std::cin, config_toml->src_dir); + std::getline(std::cin, config_json->src_dir); #endif //If the source directory is empty we're gonna set it - if(config_toml->src_dir == "") { + if(config_json->src_dir == "") { goto end; } - if (config_toml->src_dir.size() > 255) { + if (config_json->src_dir.size() > 255) { return false; } //check if the source directory is valid - if (std::regex_match(config_toml->src_dir, std::regex("^[a-zA-Z0-9_-]+$"))) { + if (std::regex_match(config_json->src_dir, std::regex("^[a-zA-Z0-9_-]+$"))) { goto end; } - if (config_toml->src_dir == "src") { + if (config_json->src_dir == "src") { goto end; } - if (sizeof(config_toml->src_dir) > 255) { + if (sizeof(config_json->src_dir) > 255) { goto end; } return false; end: - ctx->src_dir = config_toml->src_dir == "" ? ctx->src_dir : config_toml->src_dir; + ctx->src_dir = config_json->src_dir == "" ? ctx->src_dir : config_json->src_dir; return true; } diff --git a/src/Test/TestGenerators.cpp b/src/Test/TestGenerators.cpp index a82d14d..5344b73 100644 --- a/src/Test/TestGenerators.cpp +++ b/src/Test/TestGenerators.cpp @@ -19,20 +19,20 @@ namespace Test::Generators { for(std::string version : versions){ std::shared_ptr ctx = std::make_shared(); - std::shared_ptr<::Generators::ConfigToml::Config> cmake_context = - std::make_shared<::Generators::ConfigToml::Config>(); + std::shared_ptr<::Generators::ConfigJson::Config> cmake_context = + std::make_shared<::Generators::ConfigJson::Config>(); cmake_context->cmake_version = version; - if(!::Generators::ConfigToml::validateCmakeVersion("Testing version " + version + "\n",ctx, cmake_context)){ + if(!::Generators::ConfigJson::validateCmakeVersion("Testing version " + version + "\n",ctx, cmake_context)){ return false; } } for(std::string version : failing_versions){ std::shared_ptr ctx = std::make_shared(); - std::shared_ptr<::Generators::ConfigToml::Config> cmake_context = - std::make_shared<::Generators::ConfigToml::Config>(); + std::shared_ptr<::Generators::ConfigJson::Config> cmake_context = + std::make_shared<::Generators::ConfigJson::Config>(); cmake_context->cmake_version = version; - if(::Generators::ConfigToml::validateCmakeVersion("Testing failing version " + version + "\n",ctx, cmake_context)){ + if(::Generators::ConfigJson::validateCmakeVersion("Testing failing version " + version + "\n",ctx, cmake_context)){ return false; } } @@ -64,20 +64,20 @@ namespace Test::Generators { for(std::string name : mock_names){ std::shared_ptr ctx = std::make_shared(); - std::shared_ptr<::Generators::ConfigToml::Config> cmake_context = - std::make_shared<::Generators::ConfigToml::Config>(); + std::shared_ptr<::Generators::ConfigJson::Config> cmake_context = + std::make_shared<::Generators::ConfigJson::Config>(); cmake_context->project_name = name; - if(!::Generators::ConfigToml::validateProjectName("Test " + name + " \n",ctx, cmake_context)){ + if(!::Generators::ConfigJson::validateProjectName("Test " + name + " \n",ctx, cmake_context)){ return false; } } for(std::string name : failing_names){ std::shared_ptr ctx = std::make_shared(); - std::shared_ptr<::Generators::ConfigToml::Config> cmake_context = - std::make_shared<::Generators::ConfigToml::Config>(); + std::shared_ptr<::Generators::ConfigJson::Config> cmake_context = + std::make_shared<::Generators::ConfigJson::Config>(); cmake_context->project_name = name; - if(::Generators::ConfigToml::validateProjectName("Test failing name " + name + " \n",ctx, cmake_context)){ + if(::Generators::ConfigJson::validateProjectName("Test failing name " + name + " \n",ctx, cmake_context)){ return false; } } @@ -89,19 +89,19 @@ namespace Test::Generators { for(std::string version : passing_project_versions){ std::shared_ptr ctx = std::make_shared(); - std::shared_ptr<::Generators::ConfigToml::Config> cmake_context = - std::make_shared<::Generators::ConfigToml::Config>(); + std::shared_ptr<::Generators::ConfigJson::Config> cmake_context = + std::make_shared<::Generators::ConfigJson::Config>(); cmake_context->project_version = version; - if(!::Generators::ConfigToml::validateProjectVersion("Testing version " + version + "\n",ctx, cmake_context)){ + if(!::Generators::ConfigJson::validateProjectVersion("Testing version " + version + "\n",ctx, cmake_context)){ return false; } } for(std::string version : failing_project_versions){ std::shared_ptr ctx = std::make_shared(); - std::shared_ptr<::Generators::ConfigToml::Config> cmake_context = - std::make_shared<::Generators::ConfigToml::Config>(); + std::shared_ptr<::Generators::ConfigJson::Config> cmake_context = + std::make_shared<::Generators::ConfigJson::Config>(); cmake_context->project_version = version; - if(::Generators::ConfigToml::validateProjectVersion("Testing failing version " + version + "\n",ctx, cmake_context)){ + if(::Generators::ConfigJson::validateProjectVersion("Testing failing version " + version + "\n",ctx, cmake_context)){ return false; } } @@ -117,41 +117,41 @@ namespace Test::Generators { for(std::string version : passing_cpp_language_versions){ std::shared_ptr ctx = std::make_shared(); - std::shared_ptr<::Generators::ConfigToml::Config> cmake_context = - std::make_shared<::Generators::ConfigToml::Config>(); + std::shared_ptr<::Generators::ConfigJson::Config> cmake_context = + std::make_shared<::Generators::ConfigJson::Config>(); cmake_context->lang_version = version; cmake_context->lang = "cpp"; - if(!::Generators::ConfigToml::validateLanguageVersion("Testing cpp language version " + version + "\n",ctx, cmake_context)){ + if(!::Generators::ConfigJson::validateLanguageVersion("Testing cpp language version " + version + "\n",ctx, cmake_context)){ return false; } } for(std::string version : failing_cpp_language_versions){ std::shared_ptr ctx = std::make_shared(); - std::shared_ptr<::Generators::ConfigToml::Config> cmake_context = - std::make_shared<::Generators::ConfigToml::Config>(); + std::shared_ptr<::Generators::ConfigJson::Config> cmake_context = + std::make_shared<::Generators::ConfigJson::Config>(); cmake_context->lang_version = version; cmake_context->lang = "cpp"; - if(::Generators::ConfigToml::validateLanguageVersion("Testing failing cpp language version " + version + "\n",ctx, cmake_context)){ + if(::Generators::ConfigJson::validateLanguageVersion("Testing failing cpp language version " + version + "\n",ctx, cmake_context)){ return false; } } for(std::string version : passing_c_language_versions){ std::shared_ptr ctx = std::make_shared(); - std::shared_ptr<::Generators::ConfigToml::Config> cmake_context = - std::make_shared<::Generators::ConfigToml::Config>(); + std::shared_ptr<::Generators::ConfigJson::Config> cmake_context = + std::make_shared<::Generators::ConfigJson::Config>(); cmake_context->lang_version = version; cmake_context->lang = "c"; - if(!::Generators::ConfigToml::validateLanguageVersion("Testing c language version " + version + "\n",ctx, cmake_context)){ + if(!::Generators::ConfigJson::validateLanguageVersion("Testing c language version " + version + "\n",ctx, cmake_context)){ return false; } } for(std::string version : failing_c_language_versions){ std::shared_ptr ctx = std::make_shared(); - std::shared_ptr<::Generators::ConfigToml::Config> cmake_context = - std::make_shared<::Generators::ConfigToml::Config>(); + std::shared_ptr<::Generators::ConfigJson::Config> cmake_context = + std::make_shared<::Generators::ConfigJson::Config>(); cmake_context->lang_version = version; cmake_context->lang = "c"; - if(::Generators::ConfigToml::validateLanguageVersion("Testing failing c language version " + version + "\n",ctx, cmake_context)){ + if(::Generators::ConfigJson::validateLanguageVersion("Testing failing c language version " + version + "\n",ctx, cmake_context)){ return false; } } @@ -167,41 +167,41 @@ namespace Test::Generators { for(std::string compiler : passing_c_compilers){ std::shared_ptr ctx = std::make_shared(); - std::shared_ptr<::Generators::ConfigToml::Config> cmake_context = - std::make_shared<::Generators::ConfigToml::Config>(); + std::shared_ptr<::Generators::ConfigJson::Config> cmake_context = + std::make_shared<::Generators::ConfigJson::Config>(); cmake_context->compiler = compiler; cmake_context->lang = "c"; - if(!::Generators::ConfigToml::validateCompiler("Testing c compiler " + compiler + "\n",ctx, cmake_context)){ + if(!::Generators::ConfigJson::validateCompiler("Testing c compiler " + compiler + "\n",ctx, cmake_context)){ return false; } } for(std::string compiler : failing_c_compilers){ std::shared_ptr ctx = std::make_shared(); - std::shared_ptr<::Generators::ConfigToml::Config> cmake_context = - std::make_shared<::Generators::ConfigToml::Config>(); + std::shared_ptr<::Generators::ConfigJson::Config> cmake_context = + std::make_shared<::Generators::ConfigJson::Config>(); cmake_context->compiler = compiler; cmake_context->lang = "c"; - if(::Generators::ConfigToml::validateCompiler("Testing failing c compiler " + compiler + "\n",ctx, cmake_context)){ + if(::Generators::ConfigJson::validateCompiler("Testing failing c compiler " + compiler + "\n",ctx, cmake_context)){ return false; } } for(std::string compiler : passing_cpp_compilers){ std::shared_ptr ctx = std::make_shared(); - std::shared_ptr<::Generators::ConfigToml::Config> cmake_context = - std::make_shared<::Generators::ConfigToml::Config>(); + std::shared_ptr<::Generators::ConfigJson::Config> cmake_context = + std::make_shared<::Generators::ConfigJson::Config>(); cmake_context->compiler = compiler; cmake_context->lang = "cpp"; - if(!::Generators::ConfigToml::validateCompiler("Testing cpp compiler " + compiler + "\n",ctx, cmake_context)){ + if(!::Generators::ConfigJson::validateCompiler("Testing cpp compiler " + compiler + "\n",ctx, cmake_context)){ return false; } } for(std::string compiler : failing_cpp_compilers){ std::shared_ptr ctx = std::make_shared(); - std::shared_ptr<::Generators::ConfigToml::Config> cmake_context = - std::make_shared<::Generators::ConfigToml::Config>(); + std::shared_ptr<::Generators::ConfigJson::Config> cmake_context = + std::make_shared<::Generators::ConfigJson::Config>(); cmake_context->compiler = compiler; cmake_context->lang = "cpp"; - if(::Generators::ConfigToml::validateCompiler("Testing failing cpp compiler " + compiler + "\n",ctx, cmake_context)){ + if(::Generators::ConfigJson::validateCompiler("Testing failing cpp compiler " + compiler + "\n",ctx, cmake_context)){ return false; } } @@ -215,21 +215,21 @@ namespace Test::Generators { for(std::string source_dir : passing_source_dirs){ std::shared_ptr ctx = std::make_shared(); - std::shared_ptr<::Generators::ConfigToml::Config> cmake_context = - std::make_shared<::Generators::ConfigToml::Config>(); + std::shared_ptr<::Generators::ConfigJson::Config> cmake_context = + std::make_shared<::Generators::ConfigJson::Config>(); cmake_context->src_dir = source_dir; - if(!::Generators::ConfigToml::validateSourceDir("Testing source dir " + source_dir + "\n",ctx, cmake_context)){ + if(!::Generators::ConfigJson::validateSourceDir("Testing source dir " + source_dir + "\n",ctx, cmake_context)){ return false; } } for(std::string source_dir : failing_source_dirs){ std::shared_ptr ctx = std::make_shared(); - std::shared_ptr<::Generators::ConfigToml::Config> cmake_context = - std::make_shared<::Generators::ConfigToml::Config>(); + std::shared_ptr<::Generators::ConfigJson::Config> cmake_context = + std::make_shared<::Generators::ConfigJson::Config>(); cmake_context->src_dir = source_dir; - if(::Generators::ConfigToml::validateSourceDir("Testing failing source dir " + source_dir + "\n",ctx, cmake_context)){ + if(::Generators::ConfigJson::validateSourceDir("Testing failing source dir " + source_dir + "\n",ctx, cmake_context)){ return false; } } @@ -241,21 +241,21 @@ namespace Test::Generators { for(std::string build_dir : passing_build_dirs){ std::shared_ptr ctx = std::make_shared(); - std::shared_ptr<::Generators::ConfigToml::Config> cmake_context = - std::make_shared<::Generators::ConfigToml::Config>(); + std::shared_ptr<::Generators::ConfigJson::Config> cmake_context = + std::make_shared<::Generators::ConfigJson::Config>(); cmake_context->build_dir = build_dir; - if(!::Generators::ConfigToml::validateBuildDir("Testing build dir " + build_dir + "\n",ctx, cmake_context)){ + if(!::Generators::ConfigJson::validateBuildDir("Testing build dir " + build_dir + "\n",ctx, cmake_context)){ return false; } } for(std::string build_dir : failing_build_dirs){ std::shared_ptr ctx = std::make_shared(); - std::shared_ptr<::Generators::ConfigToml::Config> cmake_context = - std::make_shared<::Generators::ConfigToml::Config>(); + std::shared_ptr<::Generators::ConfigJson::Config> cmake_context = + std::make_shared<::Generators::ConfigJson::Config>(); cmake_context->build_dir = build_dir; - if(::Generators::ConfigToml::validateBuildDir("Testing failing build dir " + build_dir + "\n",ctx, cmake_context)){ + if(::Generators::ConfigJson::validateBuildDir("Testing failing build dir " + build_dir + "\n",ctx, cmake_context)){ return false; } } @@ -267,21 +267,21 @@ namespace Test::Generators { for(std::string include_dir : passing_include_dirs){ std::shared_ptr ctx = std::make_shared(); - std::shared_ptr<::Generators::ConfigToml::Config> cmake_context = - std::make_shared<::Generators::ConfigToml::Config>(); + std::shared_ptr<::Generators::ConfigJson::Config> cmake_context = + std::make_shared<::Generators::ConfigJson::Config>(); cmake_context->include_dir = include_dir; - if(!::Generators::ConfigToml::validateIncludeDir("Testing include dir " + include_dir + "\n",ctx, cmake_context)){ + if(!::Generators::ConfigJson::validateIncludeDir("Testing include dir " + include_dir + "\n",ctx, cmake_context)){ return false; } } for(std::string include_dir : failing_include_dirs){ std::shared_ptr ctx = std::make_shared(); - std::shared_ptr<::Generators::ConfigToml::Config> cmake_context = - std::make_shared<::Generators::ConfigToml::Config>(); + std::shared_ptr<::Generators::ConfigJson::Config> cmake_context = + std::make_shared<::Generators::ConfigJson::Config>(); cmake_context->include_dir = include_dir; - if(::Generators::ConfigToml::validateIncludeDir("Testing failing include dir " + include_dir + "\n",ctx, cmake_context)){ + if(::Generators::ConfigJson::validateIncludeDir("Testing failing include dir " + include_dir + "\n",ctx, cmake_context)){ return false; } }