libraries directory
This commit is contained in:
parent
2b913d1d42
commit
0fa8ba6918
7 changed files with 268 additions and 75 deletions
|
@ -19,6 +19,7 @@ class Collection;
|
|||
class Component : protected Loggable {
|
||||
public:
|
||||
class WrongState;
|
||||
class WrongType;
|
||||
enum State {
|
||||
initial,
|
||||
reading,
|
||||
|
@ -29,10 +30,10 @@ public:
|
|||
};
|
||||
|
||||
enum Type {
|
||||
unknown,
|
||||
file,
|
||||
directory,
|
||||
mason
|
||||
mason,
|
||||
unknown
|
||||
};
|
||||
|
||||
Component(
|
||||
|
@ -43,6 +44,9 @@ public:
|
|||
|
||||
Type getType() const;
|
||||
State getState() const;
|
||||
std::filesystem::path getLocation() const;
|
||||
std::string getLibrariesPath() const;
|
||||
bool successfullyRead() const;
|
||||
|
||||
void read();
|
||||
void build(const std::filesystem::path& destination, const std::string& target);
|
||||
|
@ -52,15 +56,26 @@ private:
|
|||
bool readAsMason();
|
||||
bool errorScenario(const std::string& message);
|
||||
|
||||
void buildAsFile(const std::filesystem::path& destination);
|
||||
void buildAsDiractory(const std::filesystem::path& destination);
|
||||
void buildAsMason(const std::filesystem::path& destination, const std::string& target);
|
||||
|
||||
bool readMasonDependencies(const nlohmann::json& deps, const std::string& manifestPath);
|
||||
|
||||
private:
|
||||
State state;
|
||||
Type type;
|
||||
std::weak_ptr<Collection> collection;
|
||||
std::filesystem::path location;
|
||||
std::optional<nlohmann::json> scenario;
|
||||
std::optional<nlohmann::json> manifest;
|
||||
};
|
||||
|
||||
class Component::WrongState : public std::runtime_error {
|
||||
public:
|
||||
explicit WrongState(State state, const std::string& action);
|
||||
};
|
||||
|
||||
class Component::WrongType : public std::runtime_error {
|
||||
public:
|
||||
explicit WrongType(Type type, const std::string& action);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue