Skip to content

Commit

Permalink
Fixed project wizard sort of
Browse files Browse the repository at this point in the history
  • Loading branch information
DeaSTL committed Feb 8, 2024
1 parent d6e8d78 commit eb0813f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

include(cmake/CPM.cmake)

set(GIT_SHALLOW 1)


CPMAddPackage(
NAME termcolor
Expand Down
4 changes: 3 additions & 1 deletion include/Frate/Template/IndexEntry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ namespace Frate::Project {
std::string &getHead() { return head; }

std::string &getGit() { return git; }

/*
* Returns the head hash of the branch
*/
std::string &getBranchHash(const std::string &branch) {
return branches[branch];
}
Expand Down
5 changes: 5 additions & 0 deletions include/Frate/Template/Manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ namespace Frate::Project {
* @return true if the template is installed
*/
bool is_installed(const std::string &name, std::string &hash);
/*
* Works similar to the other is_installed but will assume the branch of the TEMPLATE_BRANCH
* @param template instance
* @return true if the template is installed
*/
bool is_installed(TemplateIndexEntry &entry);
/*
* Moves downloaded template to the installpath specified
Expand Down
8 changes: 5 additions & 3 deletions src/Template/Manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,14 @@ namespace Frate::Project {
Constants::INSTALLED_TEMPLATE_PATH / name / hash;

if (!installed.contains(name)) {
Utils::verbose << "Template not installed in config" << std::endl;
Utils::verbose << "Template not installed in config, could not find key: " << name << std::endl;
return false;
}

Utils::verbose << nlohmann::json(installed[name]).dump(2) << std::endl;

if (!installed[name].contains(hash)) {
Utils::verbose << "Template not installed in config" << std::endl;
Utils::verbose << "Template not installed in config, could not find key " << name << "->" << hash << std::endl;
return false;
}

Expand All @@ -109,7 +111,7 @@ namespace Frate::Project {
return true;
}
bool TemplateManager::is_installed(TemplateIndexEntry &entry){
return is_installed(entry.getName(), branch);
return is_installed(entry.getName(), entry.getBranchHash(Constants::TEMPLATE_BRANCH));
}

Project::TemplateRenderer &TemplateManager::find_template(const std::string &name,
Expand Down

0 comments on commit eb0813f

Please sign in to comment.