Just need to write some functions...
This commit is contained in:
parent
080e384560
commit
95185d3149
@ -6,7 +6,6 @@
|
||||
#include "utils/directories.hpp"
|
||||
#include "templates.hpp"
|
||||
#include "utils/utils.hpp"
|
||||
#include "utils/readmes.hpp"
|
||||
#include "autocomplete.hpp"
|
||||
#include "utils/hash.hpp"
|
||||
|
||||
@ -107,7 +106,7 @@ int main(int argc, char* argv[]) {
|
||||
HAPPYEXIT("hash", hash_demo_raw(safearg(argc,argv,2)))
|
||||
HAPPYEXIT("makesafecmd", std::cout<<makesafecmd(safearg(argc,argv,2))<<std::endl)
|
||||
HAPPYEXIT("version", printversion())
|
||||
BOOLEXIT("test-template", test_template(safearg(argc,argv,2)))
|
||||
BOOLEXIT("test-template", gTemplateManager().test_template(safearg(argc,argv,2)))
|
||||
ASSERT_MSG(safearg(argc,argv,1) != "assert", "Hello! Here is an assert.");
|
||||
|
||||
try {
|
||||
@ -179,13 +178,13 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
|
||||
if (cmd == "templates") {
|
||||
list_templates();
|
||||
gTemplateManager().list_templates();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cmd == "create-template") {
|
||||
if (argc < 3) return die("Error: create-template requires a template name");
|
||||
create_template(argv[2]);
|
||||
gTemplateManager().create_template(argv[2]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,70 +0,0 @@
|
||||
#include "service_runner.hpp"
|
||||
#include "utils/hash.hpp"
|
||||
#include "utils/directories.hpp"
|
||||
#include "utils/utils.hpp"
|
||||
#include "templates.hpp"
|
||||
|
||||
#include <fstream>
|
||||
#include <filesystem>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
namespace dropshell {
|
||||
|
||||
service_versions::service_versions(const std::string & server_name, const std::string & service_name)
|
||||
: m_server_name(server_name), m_service_name(service_name)
|
||||
{
|
||||
}
|
||||
|
||||
uint64_t service_versions::calculate_version_local_service_template()
|
||||
{
|
||||
template_info tinfo;
|
||||
if (!get_template_info(m_service_name, tinfo)) {
|
||||
return 0;
|
||||
}
|
||||
return hash_directory_recursive(tinfo.local_template_path);
|
||||
}
|
||||
|
||||
uint64_t service_versions::calculate_version_local_config()
|
||||
{
|
||||
std::string config_path = localpath::service(m_server_name, m_service_name);
|
||||
if (config_path.empty() || !fs::exists(config_path)) {
|
||||
return 0;
|
||||
}
|
||||
return hash_directory_recursive(config_path);
|
||||
}
|
||||
|
||||
void service_versions::update_stored_remote_versions()
|
||||
{
|
||||
uint64_t template_hash = calculate_version_remote_service_template();
|
||||
uint64_t config_hash = calculate_version_remote_config();
|
||||
|
||||
// TODO - actually update things!
|
||||
}
|
||||
|
||||
uint64_t service_versions::get_version_remote_config()
|
||||
{
|
||||
// TODO - actually get the version!
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t service_versions::get_version_remote_service_template()
|
||||
{
|
||||
// TODO - actually get the version!
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t service_versions::calculate_version_remote_service_template()
|
||||
{
|
||||
// TODO - actually get the version!
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t service_versions::calculate_version_remote_config()
|
||||
{
|
||||
// TODO - actually get the version!
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace dropshell
|
@ -65,8 +65,6 @@
|
||||
|
||||
std::cout << "Available templates:" << std::endl;
|
||||
|
||||
// sort templates alphabetically.
|
||||
std::sort(templates.begin(), templates.end());
|
||||
// print templates.
|
||||
std::cout << std::string(60, '-') << std::endl;
|
||||
bool first = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user