forked from Martin-Gleiss/smartvisu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.php
92 lines (74 loc) · 2 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
/**
* -----------------------------------------------------------------------------
* @package smartVISU
* @author Martin Gleiß
* @copyright 2012 - 2015
* @license GPL [http://www.gnu.de]
* -----------------------------------------------------------------------------
*/
// get config-variables
require_once 'lib/includes.php';
require_once const_path_system.'functions.php';
require_once 'vendor/google.closure/smart_closure.php';
echo "<pre>\n";
echo str_repeat(" ", 69)."smart[VISU]\n";
echo str_repeat(" ", 68).date('H:i, d.m')."\n";
echo str_repeat("-", 80)."\n\n";
compile("lib/base/base.js");
echo "\n";
compile("lib/base/jquery.mobile.slider.js");
echo "\n";
echo "\n";
compile("widgets/widget.js");
echo "\n";
compile("widgets/animation.js");
echo "\n";
echo "\n";
compile("designs/cube.js");
echo "\n";
compile("designs/greenhornet.js");
echo "\n";
compile("designs/ice.js");
echo "\n";
compile("designs/night.js");
echo "\n";
compile("designs/sand.js");
echo "\n";
echo "\n";
compile("driver/io_domotiga.js");
echo "\n";
compile("driver/io_eibd.js");
echo "\n";
compile("driver/io_json.js");
echo "\n";
compile("driver/io_linknx.js");
echo "\n";
compile("driver/io_offline.js");
echo "\n";
compile("driver/io_smarthome.py.js");
echo "\n";
echo "\n";
echo str_repeat("-", 80)."\n\n";
echo "\n</pre>";
function compile($file)
{
echo "<b>".$file."</b>\n";
if (is_file($file))
{
// compile it
$c = new smartClosure();
$result = $c->add($file)->simpleMode()->_compile();
// write it
$compiled = substr($result, strpos($result, '*/') + 3);
$compiled = "/* smartVISU, Martin Gleiß, 2012 - 2015, GPL [http://www.gnu.de] */\n".$compiled;
filewrite(substr($file, 0, -3).".min.js", $compiled);
// status
$pos = strpos($result, '\'') + 1;
echo str_replace(" Size", "", str_replace("\\n", ", ", substr($result, $pos + 50, strpos($result, ');') - $pos - 1 - 104)));
echo "\n";
}
else
echo "...not found!\n";
}
?>