aboutsummaryrefslogtreecommitdiff
path: root/src/config.h
blob: 49daf777a2ae7645949f22475ca33da49312b5c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef CONFIG_H
#define CONFIG_H

#include <stddef.h>
#include <time.h>

enum build_status {
    STATUS_UNKNOWN,
    STATUS_INPROGRESS,
    STATUS_SUCCESS,
    STATUS_FAILURE
};
extern const char* build_string[];
extern const char* build_class[];

struct build_t {
    char* name;
    time_t timestamp;
    time_t completion;
    enum build_status status;
    char* log;
};

struct project_t {
    char* name;
    char* script_path;
    char* description;

    struct build_t* builds;
    size_t build_count;
};

struct config_t {
    char* cache_dir;
    char* token;
    struct project_t* projects;
    size_t project_count;
};

extern struct config_t config;
extern struct project_t* current_project;
extern struct build_t* current_build;

void init_config();
void deinit_config();
void parse_config();

char* cache_dir();
char* project_dir(char* project);
char* build_dir(char* project, char* build);
    
#endif