-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmake.php
executable file
·72 lines (56 loc) · 1.12 KB
/
make.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
#!/usr/bin/php
<?php
/**
* Make Helper
*/
use OpenTHC\Make;
if ( ! is_file(__DIR__ . '/vendor/autoload.php')) {
$cmd = [];
$cmd[] = 'composer';
$cmd[] = 'install';
$cmd[] = '--classmap-authoritative';
$cmd[] = '2>&1';
echo "Composer:\n";
passthru(implode(' ', $cmd), $ret);
var_dump($ret);
}
require_once(__DIR__ . '/boot.php');
$doc = <<<DOC
OpenTHC Directory Make Helper
Usage:
make [options]
Commands:
install
DOC;
// $cli_args
Make::composer();
Make::npm();
Make::install_bootstrap();
Make::install_fontawesome();
Make::install_jquery();
#
# Tailwind
$cmd = [];
$cmd[] = 'npx tailwindcss';
$cmd[] = '--input sass/base.css';
$cmd[] = '--output webroot/css/main.css';
$cmd[] = '2>&1';
$cmd = implode(' ', $cmd);
echo shell_exec($cmd);
echo "\n";
create_homepage();
/**
*
*/
function create_homepage() {
$cfg = \OpenTHC\Config::get('openthc/vdb/origin');
$url = sprintf('%s/home', $cfg);
$req = _curl_init($url);
$res = curl_exec($req);
$inf = curl_getinfo($req);
if (200 == $inf['http_code']) {
$file = sprintf('%s/webroot/index.html', APP_ROOT);
$data = $res;
file_put_contents($file, $data);
}
}