CBuild
C++ build system with scripts written in c++
Loading...
Searching...
No Matches
net_dep_helper.hpp
Go to the documentation of this file.
1
22// C++ libraries
23#include "string"
24// Project includes
25#include "../CBuild_defs.hpp"
26#include "../filesystem++.hpp"
27#include "../print.hpp"
28#include "../system.hpp"
29#include "dependency.hpp"
30// Code
31#ifndef __NET_DEP_HELPER_HPP__
32#define __NET_DEP_HELPER_HPP__
33namespace CBuild {
35 protected:
36 void git_fetch(std::string server, std::string repo) {
37 std::string repo_path;
38 while (repo_path.find("/") != std::string::npos) {
39 repo_path.replace(repo_path.find("/"), std::string("/").size(), "_");
40 }
41 CBuild::fs::remove(CBUILD_CACHE_DIR + "/" + repo_path, true);
43 CBuild::system("cd " + CBUILD_CACHE_DIR + "/" + repo_path + " && git clone --recursive " +
44 server + "/" + repo);
45 }
46 void file_fetch(std::string url, std::string file, std::string args = "") {
47 CBuild::system("curl " + args + " -o " + file + " " + url);
48 }
49};
50} // namespace CBuild
51#endif // __NET_DEP_HELPER_HPP__
#define CBUILD_CACHE_DIR
Cache directory of CBuild.
void git_fetch(std::string server, std::string repo)
void file_fetch(std::string url, std::string file, std::string args="")
Some external dependency. Base class.
filesystem++ api
bool create(std::vector< std::string > paths, CBuild::fs::type what)
Create element.
bool remove(std::string path, bool force=false)
Delete files or directories.
@ DIR
Alias for DIRECTORY.
Filebuffer for CBuild ecosystem.
Definition Build.hpp:34
int system(std::string cmd)
Call stdlib system() and print cmd to shell.
Definition system.cpp:47
Custom print that support color codes.
Custom system() wraper.