Skip to content

Commit

Permalink
rename templates for .pas to .pasgen
Browse files Browse the repository at this point in the history
  • Loading branch information
isaquepinheiro committed Aug 11, 2023
1 parent 6b87e52 commit 1863248
Show file tree
Hide file tree
Showing 56 changed files with 37 additions and 78 deletions.
3 changes: 1 addition & 2 deletions clibr/clibr.interfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@

namespace clibr
{
ICommand::~ICommand() {};
ICli::~ICli() {};

}
4 changes: 2 additions & 2 deletions clibr/clibr.interfaces.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ namespace clibr
/// <summary>
/// Virtual destructor to ensure proper destruction of derived classes.
/// </summary>
virtual ~ICli() = 0;
virtual ~ICli() = default;
};

/// <summary>
Expand All @@ -95,7 +95,7 @@ namespace clibr
/// <summary>
/// Virtual destructor to ensure proper destruction of derived classes.
/// </summary>
virtual ~ICommand() = 0;
virtual ~ICommand() = default;
};
}

Expand Down
2 changes: 0 additions & 2 deletions clibr/commands/clibr.command.all.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ namespace clibr
return true;
};

CommandAll::~CommandAll() {};

void CommandAll::_createModule(const std::string& dirName,
const std::string& fileName, ICli* cli)
{
Expand Down
2 changes: 1 addition & 1 deletion clibr/commands/clibr.command.all.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace clibr
public:
bool execute(const std::string& dirName, const std::string& fileName,
ICli* cli) override;
~CommandAll() override;
~CommandAll() override = default;
private:
void _createModule(const std::string& dirName, const std::string& fileName, clibr::ICli* cli);
void _createController(const std::string& dirName, const std::string& fileName, clibr::ICli* cli);
Expand Down
4 changes: 1 addition & 3 deletions clibr/commands/clibr.command.c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace clibr
std::filesystem::create_directories(sourcePath);
}

std::string templateFilePath{ cli->pathTemp() + "/controller.pas" };
std::string templateFilePath{ cli->pathTemp() + "/controller.pasgen" };
std::string templateFileName{ sourcePath + "/" + unitName + ".controller.pas" };
std::string templateContent{ Utils::readFromFile(templateFilePath) };
std::string modifiedContent{ Utils::replaceString(templateContent, "{unitName}", unitName) };
Expand All @@ -54,6 +54,4 @@ namespace clibr
}
return isSuccess;
};

CommandController::~CommandController() {};
}
2 changes: 1 addition & 1 deletion clibr/commands/clibr.command.c.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace clibr
public:
bool execute(const std::string& dirName, const std::string& fileName,
ICli* cli) override;
~CommandController() override;
~CommandController() override = default;
};
}

Expand Down
2 changes: 0 additions & 2 deletions clibr/commands/clibr.command.dpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ namespace clibr
return true;
};

CommandGenerateProject::~CommandGenerateProject() {};

void CommandGenerateProject::_createProject(const std::string& dirName,
const std::string& fileName, ICli* cli)
{
Expand Down
2 changes: 1 addition & 1 deletion clibr/commands/clibr.command.dpr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace clibr
public:
bool execute(const std::string& dirName, const std::string& fileName,
ICli* cli) override;
~CommandGenerateProject() override;
~CommandGenerateProject() override = default;
private:
void _createProject(const std::string& dirName, const std::string& fileName, ICli* cli);
void _createAppModule(const std::string& dirName, const std::string& fileName, ICli* cli);
Expand Down
2 changes: 0 additions & 2 deletions clibr/commands/clibr.command.h.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ namespace clibr
return true;
};

CommandHelp::~CommandHelp() {};

void CommandHelp::_executeInternal() {

ListText printText;
Expand Down
2 changes: 1 addition & 1 deletion clibr/commands/clibr.command.h.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace clibr
public:
bool execute(const std::string& dirName, const std::string& fileName,
ICli* cli) override;
~CommandHelp() override;
~CommandHelp() override = default;
private:
void _executeInternal();
void _executeInternalG();
Expand Down
4 changes: 1 addition & 3 deletions clibr/commands/clibr.command.handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace clibr
std::filesystem::create_directories(sourcePath);
}

std::string templateFilePath{ cli->pathTemp() + "/handler.pas" };
std::string templateFilePath{ cli->pathTemp() + "/handler.pasgen" };
std::string templateFileName{ sourcePath + "/" + unitName + ".route.handler.pas" };
std::string templateContent{ Utils::readFromFile(templateFilePath) };
std::string modifiedContent{ Utils::replaceString(templateContent, "{unitName}", unitName) };
Expand All @@ -54,6 +54,4 @@ namespace clibr
}
return isSuccess;
};

CommandRouteHandler::~CommandRouteHandler() {};
}
2 changes: 1 addition & 1 deletion clibr/commands/clibr.command.handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace clibr
public:
bool execute(const std::string& dirName, const std::string& fileName,
ICli* cli) override;
~CommandRouteHandler() override;
~CommandRouteHandler() override = default;
};
}

Expand Down
2 changes: 0 additions & 2 deletions clibr/commands/clibr.command.i.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@ namespace clibr

return true;
};

CommandInfra::~CommandInfra() {};
}
2 changes: 1 addition & 1 deletion clibr/commands/clibr.command.i.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace clibr
public:
bool execute(const std::string& dirName, const std::string& fileName,
ICli* cli) override;
~CommandInfra() override;
~CommandInfra() override = default;
};
}

Expand Down
2 changes: 0 additions & 2 deletions clibr/commands/clibr.command.info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,4 @@ namespace clibr
Print::printHelp(Utils::join(printText, '\n'));
return true;
};

CommandInfo::~CommandInfo() {};
}
2 changes: 1 addition & 1 deletion clibr/commands/clibr.command.info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace clibr
public:
bool execute(const std::string& dirName, const std::string& fileName,
ICli* cli) override;
~CommandInfo() override;
~CommandInfo() override = default;
};
}

Expand Down
10 changes: 4 additions & 6 deletions clibr/commands/clibr.command.m.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ namespace clibr
}

std::string templateFilePath{ "" };
isAppModule ? templateFilePath = cli->pathTemp() + "/module.app.pas" :
templateFilePath = cli->pathTemp() + "/module.pas";
isAppModule ? templateFilePath = cli->pathTemp() + "/module.app.pasgen" :
templateFilePath = cli->pathTemp() + "/module.pasgen";
std::string templateFileName{ sourcePath + "/" + unitName + ".module.pas" };
std::string templateContent{ Utils::readFromFile(templateFilePath) };
std::string modifiedContent{ Utils::replaceString(templateContent, "{moduleName}", className) };
Expand Down Expand Up @@ -68,8 +68,6 @@ namespace clibr
return success;
};

CommandModule::~CommandModule() {};

bool CommandModule::_argGuardExist(const ICli* cli)
{
const MapTags& tags = cli->tags();
Expand All @@ -78,7 +76,7 @@ namespace clibr

std::string CommandModule::_generateGuardBody(const std::string& camelCaseName, const ICli* cli)
{
std::string templateFilePath = cli->pathTemp() + "/" + "body.pas";
std::string templateFilePath = cli->pathTemp() + "/" + "body.pasgen";
std::string templateContent = Utils::readFromFile(templateFilePath);
std::string modifiedContent = Utils::replaceString(templateContent, "{className}", "T" + camelCaseName);

Expand All @@ -87,7 +85,7 @@ namespace clibr

std::string CommandModule::_generateGuardHeader(const std::string& camelCaseName, const ICli* cli)
{
std::string templateFilePath = cli->pathTemp() + "/" + "header.pas";
std::string templateFilePath = cli->pathTemp() + "/" + "header.pasgen";
std::string templateContent = Utils::readFromFile(templateFilePath);
std::string modifiedContent = Utils::replaceString(templateContent, "{className}", "T" + camelCaseName);

Expand Down
2 changes: 1 addition & 1 deletion clibr/commands/clibr.command.m.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace clibr
public:
bool execute(const std::string& dirName, const std::string& fileName,
ICli* cli) override;
~CommandModule() override;
~CommandModule() override = default;
private:
bool _argGuardExist(const ICli* cli);
std::string _generateGuardBody(const std::string& camelCaseName, const ICli* cli);
Expand Down
4 changes: 1 addition & 3 deletions clibr/commands/clibr.command.pipe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace clibr
{
std::filesystem::create_directories(sourcePath);
}
std::string templateFilePath{ cli->pathTemp() + "/pipe.pas" };
std::string templateFilePath{ cli->pathTemp() + "/pipe.pasgen" };
std::string templateFileName{ dirName + "/" + unitName + ".dpr" };
std::string templateContent{ Utils::readFromFile(templateFilePath) };
std::string modifiedContent{ Utils::replaceString(templateContent, "{pipeName}", className) };
Expand All @@ -52,6 +52,4 @@ namespace clibr
}
return isSuccess;
};

CommandTransformPipe::~CommandTransformPipe() {};
}
2 changes: 1 addition & 1 deletion clibr/commands/clibr.command.pipe.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace clibr
public:
bool execute(const std::string& dirName, const std::string& fileName,
ICli* cli) override;
~CommandTransformPipe() override;
~CommandTransformPipe() override = default;
};
}

Expand Down
2 changes: 0 additions & 2 deletions clibr/commands/clibr.command.r.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@ namespace clibr

return true;
};

CommandRepository::~CommandRepository() {};
}
2 changes: 1 addition & 1 deletion clibr/commands/clibr.command.r.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace clibr
public:
bool execute(const std::string& dirName, const std::string& fileName,
ICli* cli) override;
~CommandRepository() override;
~CommandRepository() override = default;
};
}

Expand Down
4 changes: 1 addition & 3 deletions clibr/commands/clibr.command.s.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace clibr
{
std::filesystem::create_directories(sourcePath);
}
std::string templateFilePath{ cli->pathTemp() + "/service.pas" };
std::string templateFilePath{ cli->pathTemp() + "/service.pasgen" };
std::string templateFileName{ sourcePath + "/" + unitName + ".service.pas" };
std::string templateContent{ Utils::readFromFile(templateFilePath) };
std::string modifiedContent{ Utils::replaceString(templateContent, "{unitName}", unitName) };
Expand All @@ -52,6 +52,4 @@ namespace clibr
}
return isSuccess;
};

CommandService::~CommandService() {};
}
2 changes: 1 addition & 1 deletion clibr/commands/clibr.command.s.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace clibr
public:
bool execute(const std::string& dirName, const std::string& fileName,
ICli* cli) override;
~CommandService() override;
~CommandService() override = default;
};
}

Expand Down
2 changes: 0 additions & 2 deletions clibr/commands/clibr.command.templates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,4 @@ namespace clibr
Print::printHelp(Utils::join(printText, '\n'));
return true;
};

CommandTemplates::~CommandTemplates() {};
}
2 changes: 1 addition & 1 deletion clibr/commands/clibr.command.templates.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace clibr
public:
bool execute(const std::string& dirName, const std::string& fileName,
ICli* cli) override;
~CommandTemplates() override;
~CommandTemplates() override = default;
};
}

Expand Down
2 changes: 0 additions & 2 deletions clibr/commands/clibr.command.v.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@ namespace clibr
Print::printVersion(version);
return true;
};

CommandVersion::~CommandVersion() {};
}
2 changes: 1 addition & 1 deletion clibr/commands/clibr.command.v.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace clibr
public:
bool execute(const std::string& dirName, const std::string& fileName,
ICli* cli) override;
~CommandVersion() override;
~CommandVersion() override = default;
};
}

Expand Down
4 changes: 1 addition & 3 deletions clibr/commands/console/clibr.command.dpr.console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace clibr
std::string unitName{ Utils::toLowerCase(fileName) };
std::string camelCaseName{ std::string(1, std::toupper(fileName[0])) + fileName.substr(1) };
std::string programName{ Utils::regexReplaceAll(camelCaseName, "-", "_") };
std::string templateFilePath{ cli->pathTemp() + "/console.project.pas" };
std::string templateFilePath{ cli->pathTemp() + "/console.project.pasgen" };
std::string templateFileName{ dirName + "/" + unitName + ".dpr" };
std::string templateContent{ Utils::readFromFile(templateFilePath) };
std::string modifiedContent{ Utils::replaceString(templateContent, "{programName}", programName) };
Expand All @@ -25,6 +25,4 @@ namespace clibr
}
return isSuccess;
};

CommandGenerateProjectConsole::~CommandGenerateProjectConsole() {};
}
2 changes: 1 addition & 1 deletion clibr/commands/console/clibr.command.dpr.console.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace clibr
public:
bool execute(const std::string& dirName, const std::string& fileName,
ICli* cli) override;
~CommandGenerateProjectConsole() override;
~CommandGenerateProjectConsole() override = default;
};
}

Expand Down
4 changes: 1 addition & 3 deletions clibr/commands/horse/clibr.command.dpr.horse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace clibr
std::string unitName{ Utils::toLowerCase(fileName) };
std::string camelCaseName{ std::string(1, std::toupper(fileName[0])) + fileName.substr(1) };
std::string programName{ Utils::regexReplaceAll(camelCaseName, "-", "_") };
std::string templateFilePath{ cli->pathTemp() + "/horse.project.pas" };
std::string templateFilePath{ cli->pathTemp() + "/horse.project.pasgen" };
std::string templateFileName{ dirName + "/" + unitName + ".dpr" };
std::string templateContent{ Utils::readFromFile(templateFilePath) };
std::string modifiedContent{ Utils::replaceString(templateContent, "{programName}", programName) };
Expand All @@ -25,6 +25,4 @@ namespace clibr
}
return isSuccess;
};

CommandGenerateProjectHorse::~CommandGenerateProjectHorse() {};
}
2 changes: 1 addition & 1 deletion clibr/commands/horse/clibr.command.dpr.horse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace clibr
public:
bool execute(const std::string& dirName, const std::string& fileName,
ICli* cli) override;
~CommandGenerateProjectHorse() override;
~CommandGenerateProjectHorse() override = default;
};
}

Expand Down
4 changes: 1 addition & 3 deletions clibr/commands/horse/clibr.command.handler.horse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace clibr
std::filesystem::create_directories(sourcePath);
}

std::string templateFilePath{ cli->pathTemp() + "/horse.handler.pas" };
std::string templateFilePath{ cli->pathTemp() + "/horse.handler.pasgen" };
std::string templateFileName{ sourcePath + "/" + unitName + ".route.handler.pas" };
std::string templateContent{ Utils::readFromFile(templateFilePath) };
std::string modifiedContent{ Utils::replaceString(templateContent, "{unitName}", unitName) };
Expand All @@ -54,6 +54,4 @@ namespace clibr
}
return isSuccess;
};

CommandRouteHandlerHorse::~CommandRouteHandlerHorse() {};
}
2 changes: 1 addition & 1 deletion clibr/commands/horse/clibr.command.handler.horse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace clibr
public:
bool execute(const std::string& dirName, const std::string& fileName,
ICli* cli) override;
~CommandRouteHandlerHorse() override;
~CommandRouteHandlerHorse() override = default;
};
}

Expand Down
Loading

0 comments on commit 1863248

Please sign in to comment.