-
Notifications
You must be signed in to change notification settings - Fork 0
/
Config.php
74 lines (46 loc) · 1.38 KB
/
Config.php
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
namespace Mash;
class Config {
protected $mash;
public $config;
function __construct (\Mash $mash) {
$this->mash = $mash;
}
protected function setLibraries (array $libraries): array {
return $libraries;
}
protected function getConfig (): array {
return [];
}
final function process () {
$this->config = array_extend ($this->getConfig (), [
'libraries_dir' => 'MashLibraries',
'prepare_output' => true,
]);
foreach ($this->setLibraries ([]) as $library)
foreach ($library as $library => $dirs) {
list ($author, $name, $ver) = $dirs;
$path = [__DIR__, '..', $this->config['libraries_dir'], $author, $name, $ver];
foreach ($this->mash->scanCurrentDir ($path) as $file)
require $file;
foreach ($this->getLibrariesDirs ()[$library] as $dir) {
$path2 = $path;
$path2[] = $dir;
$dir = implode (DS, $path2);
foreach ($this->mash->scanCurrentDir ($dir, true) as $file)
require $file;
}
$path2 = $path;
$path2[] = 'autodock';
foreach ($this->mash->scanCurrentDir ($path2, true) as $file)
require $file;
}
}
protected function getLibrariesDirs () {
return [];
}
final function loadDir ($dir) {
foreach ($this->mash->scanDir ([$dir]) as $file)
require $file;
}
}