Skip to content

Commit

Permalink
Removing libgit2, and just download list
Browse files Browse the repository at this point in the history
  • Loading branch information
wess committed Jan 4, 2018
1 parent 03ee57e commit 40ed118
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 139 deletions.
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ add_subdirectory(libs)

FIND_PACKAGE(LibArchive REQUIRED)
FIND_PACKAGE(CURL REQUIRED)
FIND_PACKAGE(Libgit2 REQUIRED)
FIND_PACKAGE(YamlCpp REQUIRED)
FIND_PACKAGE(Threads REQUIRED)

Expand All @@ -83,7 +82,6 @@ include_directories(
${CURL_INCLUDE_DIRS}
${LibArchive_INCLUDE_DIRS}
${YAMLCPP_INCLUDE_DIR}
${LIBGIT2_INCLUDE_DIR}
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/libs/yaml-cpp
${CMAKE_SOURCE_DIR}/libs/yaml-cpp/include
Expand All @@ -96,7 +94,7 @@ include_directories(
)

add_executable(skafos ${SOURCES})
target_link_libraries(skafos docopt json11 sse yaml-cpp ${CMAKE_THREAD_LIBS_INIT} ${CURL_LIBRARIES} ${LIBGIT2_LIBRARIES} ${LibArchive_LIBRARIES} ${YAMLCPP_LIBRARY})
target_link_libraries(skafos docopt json11 sse yaml-cpp ${CMAKE_THREAD_LIBS_INIT} ${CURL_LIBRARIES} ${LibArchive_LIBRARIES} ${YAMLCPP_LIBRARY})

install(TARGETS skafos RUNTIME DESTINATION bin)

Expand Down
3 changes: 1 addition & 2 deletions src/env/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "common.h"
#include "file/file.h"
#include "request/request.h"
#include "git/git.h"
#include "auth/auth.h"
#include "templates/templates.h"

Expand All @@ -14,7 +13,7 @@
const std::string METIS_API_TOKEN = "METIS_API_TOKEN";
const std::string METIS_AUTH_TOKEN = "METIS_OAUTH";
const std::string METIS_CREDENTIALS = "credentials.json";
const std::string METIS_TEMPLATE_REPO = "https://github.com/MetisMachine/templates.list";
const std::string METIS_TEMPLATE_REPO = "https://github.com/MetisMachine/templates.list/archive/master.zip";
const std::string METIS_TEMPLATE_DIR = "templates";
const std::string METIS_CACHE_DIR = ".cache";

Expand Down
6 changes: 0 additions & 6 deletions src/git/git.h

This file was deleted.

75 changes: 0 additions & 75 deletions src/git/repo/repo.cpp

This file was deleted.

37 changes: 0 additions & 37 deletions src/git/repo/repo.h

This file was deleted.

34 changes: 18 additions & 16 deletions src/templates/templates.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "templates.h"
#include "yaml-cpp/yaml.h"
#include "env/env.h"
#include "git/git.h"
#include "file/file.h"
#include <iomanip>

Expand All @@ -11,16 +10,29 @@ const string TEMPLATE_HEAD = "head";

void Template::update() {
VERIFY_AUTH();
// START_LOADING("Updating project templates..");

START_LOADING("Updating project templates..");
console::info("Updating templates...");

if(FileManager::dir_exists(ENV_PATHS.templates)) {
pull();
} else {
clone();
FileManager::delete_dir(ENV_PATHS.templates);
}

END_LOADING();
FileManager::create_path(0755, ENV_PATHS.templates);

string tpl_path = ENV_PATHS.env + "/template_list.zip";

console::info(
"Download from: " +
METIS_TEMPLATE_REPO +
" to: " +
tpl_path
);

Request::download(METIS_TEMPLATE_REPO, tpl_path);


// END_LOADING();
}

void Template::search(string name) {
Expand Down Expand Up @@ -92,16 +104,6 @@ list<TemplateDetails> Template::all() {
return tpl_list;
}

int Template::clone() {
return Git::Repo::clone(METIS_TEMPLATE_REPO, ENV_PATHS.templates);
}

int Template::pull() {
FileManager::delete_dir(ENV_PATHS.templates);

return clone();
}

TemplateDetails Template::parse_template(std::string path) {
TemplateDetails details;

Expand Down

0 comments on commit 40ed118

Please sign in to comment.