-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.xml
97 lines (74 loc) · 2.98 KB
/
build.xml
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
93
94
95
96
97
<project name="Node installation">
<property file="build.properties" />
<target name="build" depends="npmuser">
</target>
<condition property="isWindows">
<os family="windows" />
</condition>
<target name="OS-WIN" if="isWindows">
<property name="npmcmd" value="npm.cmd"/>
<property name="pm2cmd" value="pm2.cmd"/>
</target>
<target name="OS-MAC-UNIX" unless="isWindows">
<echo message="In mac or unix .."/>
<property name="npmcmd" value="npm"/>
<property name="pm2cmd" value="pm2"/>
</target>
<target name="check-usercreation">
<echo message=" In check user creation ..."/>
<available file="./usercreation" property="user.created"/>
</target>
<target name="check-npminit">
<echo message=" In check npm init ..."/>
<available file="./npminitialization" property="npm.initialized"/>
</target>
<target name="check-npminstall">
<echo message=" In check npm install ..."/>
<available file="./npminstall" property="npm.installation"/>
</target>
<target name="nodeins" depends="OS-MAC-UNIX,OS-WIN,check-npminstall" unless="npm.installation">
<exec dir="." executable="${npmcmd}" output="./npminstall">
<arg line="install"/>
</exec>
</target>
<target name="npminit" depends="nodeins,check-npminit" unless="npm.initialized">
<exec dir="." executable="${npmcmd}" output="./npminitialization">
<arg line="run init_new ${env} ${portal_server_host} ${portal_server_port} ${portal_db_host} ${portal_db_name} ${db_user} ${db_pass} ${db_server} ${formPostUrl} ${apiUrl} ${opioid} ${opioid_oxycodone} ${opioid_hydromorphone}"/>
</exec>
</target>
<target name="createUserSchema" depends="npminit,check-usercreation" unless="user.created">
<exec dir="." executable="${npmcmd}">
<arg line="run preuser"/>
</exec>
</target>
<target name="npmuser" depends="createUserSchema" unless="user.created">
<exec dir="." executable="${npmcmd}" output="./usercreation">
<arg line="run user_new ${user} ${role} ${password}"/>
</exec>
</target>
<target name="startportal" depends="npmuser">
<exec dir="." executable="${npmcmd}">
<arg line="run start"/>
</exec>
</target>
<target name="checkPortalStatus">
<exec executable="sh" outputproperty="portalstatus">
<arg value="-c" />
<arg value="${pm2cmd} ls | wc -l " />
</exec>
<condition property="portalSatrus-check-property">
<contains string="${portalstatus}" substring="4"/>
</condition>
</target>
<target name="alreadyStop" depends="checkPortalStatus" if="portalSatrus-check-property">
<echo message="The Portal is already stopped." />
</target>
<target name="stoppingPortal" depends="OS-MAC-UNIX,OS-WIN,checkPortalStatus" unless="portalSatrus-check-property">
<exec dir="." executable="${npmcmd}">
<arg line="run stop"/>
</exec>
<echo message=" Portal is stopped." />
</target>
<target name="stopportal" depends="OS-MAC-UNIX,OS-WIN,alreadyStop, stoppingPortal">
</target>
</project>