-
-
Notifications
You must be signed in to change notification settings - Fork 34
/
launch.dnys
71 lines (53 loc) · 1.79 KB
/
launch.dnys
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
# HortusFox launcher script
#
# This script launches a local web environment and opens the default browser with the URL of the web app.
#
# Requires AquaShell, Windows and PHP with Apache & MariaDB (e.g. XAMPP installation)
# On first start you'll need to specify your paths to httpd and mysqld.
#
require "auto";
require "fileio";
require "datetime";
require "input";
const SERVER_PORT int <= 8000;
global project_path string;
getscriptpath project_path;
global server_url string;
set server_url <= "http://localhost";
if (%SERVER_PORT, -nt, 80) {
set server_url <= "%server_url:%SERVER_PORT";
};
global flag bool;
function create_path_file void()
{
local apache_path string;
local mysql_path string;
local timestamp string;
local hfile int;
input apache_path "Please enter path to your httpd.exe: ";
input mysql_path "Please enter path to your mysqld.exe: ";
fmtdatetime "%F %T" timestamp;
fopen "%project_path\paths.dnys" false hfile;
if (%hfile, -nt, %FIO_INVALID_HANDLE) {
fwriteline %hfile "# Auto-generated at %timestamp";
fwriteline %hfile "";
fwriteline %hfile { const APACHE_PATH string <= "%apache_path"; };
fwriteline %hfile { const MYSQL_PATH string <= "%mysql_path"; };
fclose %hfile;
};
};
fexists "%project_path\paths.dnys" flag;
if (%flag, -eq, false) {
call create_path_file() => void;
};
exec "%project_path\paths.dnys";
aut_run "%APACHE_PATH\httpd.exe" "" "%APACHE_PATH" void;
aut_run "%MYSQL_PATH\mysqld" "--defaults-file=%MYSQL_PATH\my.ini --standalone" "%MYSQL_PATH" void;
aut_run "php" "asatru serve %SERVER_PORT" "%project_path" void;
aut_run "%server_url" "" "" void;
print "HortusFox is now running...";
print "Press any key to shutdown this service";
pause;
sys { taskkill /F /IM php.exe };
sys { taskkill /F /IM mysqld.exe };
sys { taskkill /F /IM httpd.exe };