source: gs3-extensions/ekit/trunk/build.xml@ 22218

Last change on this file since 22218 was 22218, checked in by sjm84, 14 years ago

This should now also work for Windows

File size: 5.1 KB
RevLine 
[22217]1<project name="ekit" basedir="." default="install">
2 <property environment="env"/>
3 <property name="gsdl3srchome" value="${env.GSDL3SRCHOME}"/>
4
5 <property name="html.path" value="/Configuration/Associations/Entry[@extension='html']"/>
6 <property name="htm.path" value="/Configuration/Associations/Entry[@extension='htm']"/>
7 <property name="html.text.path" value="${html.path}/text()"/>
8 <property name="htm.text.path" value="${htm.path}/text()"/>
9 <property name="ekit.assoc.entry" value="java -jar ${basedir}/ekit.jar -x -s -f%1"/>
10 <property name="orig.html.file" value="${basedir}/htmlConfSettings.orig"/>
11 <property name="orig.htm.file" value="${basedir}/htmConfSettings.orig"/>
12
13 <path id="classpath">
14 <fileset dir="${gsdl3srchome}/lib/java">
15 <include name="**/*.jar"/>
16 </fileset>
17 </path>
18
19 <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" classpathref="classpath"/>
20 <taskdef name="if" classname="ise.antelope.tasks.IfTask" classpathref="classpath"/>
21
22 <target name="main">
23 <if>
24 <bool><equals arg1="${os.name}" arg2="Linux"/></bool>
25 <property name="os" value="linux"/>
26
27 <else>
28
29 <if>
30 <bool><equals arg1="${os.name}" arg2="Mac OS X"/></bool>
31 <property name="os" value="mac"/>
32
33 <else>
34
35 <if>
36 <bool><or>
37 <equals arg1="${os.name}" arg2="Windows 95"/>
38 <equals arg1="${os.name}" arg2="Windows 98"/>
39 <equals arg1="${os.name}" arg2="Windows 2000"/>
40 <equals arg1="${os.name}" arg2="Windows XP"/>
41 <equals arg1="${os.name}" arg2="Windows NT"/>
42 <equals arg1="${os.name}" arg2="Windows ME"/>
43 <equals arg1="${os.name}" arg2="Windows Vista"/>
44 <equals arg1="${os.name}" arg2="Windows 7"/>
45 </or></bool>
46 <property name="os" value="windows"/>
47 </if>
48
49 </else>
50 </if>
51 </else>
52 </if>
53
54 <if>
55 <bool>
56 <equals arg1="${os}" arg2="Windows"/>
57 </bool>
58
[22218]59 <property name="config.file" value="${user.home}/Application Data/Greenstone/GLI/config.xml"/>
[22217]60
61 <else>
62 <property name="config.file" value="${user.home}/.gli/config.xml"/>
63 </else>
64 </if>
65 </target>
66
67 <target name="install" depends="main">
68 <if>
69 <bool>
70 <not><available file="${config.file}"/></not>
71 </bool>
72 <fail>Error associating EKIT with GLI, if you have not yet run GLI for the first time then do so and then try this again.</fail>
73 </if>
74
75 <xmltask source="${config.file}">
76 <copy path="${html.text.path}" property="html.entry"/>
77 <copy path="${htm.text.path}" property="htm.entry"/>
78 </xmltask>
79
80 <if>
81 <bool>
82 <not><equals arg1="${html.entry}" arg2="${ekit.assoc.entry}"/></not>
83 </bool>
84
85 <if>
86 <bool>
87 <isset property="html.entry"/>
88 </bool>
89
90 <touch file="${orig.html.file}"/>
91 <echo file="${orig.html.file}">${html.entry}</echo>
92
93 <else>
94 <delete file="${orig.html.file}"/>
95 </else>
96 </if>
97
98 <xmltask source="${config.file}" dest="${config.file}">
99 <remove path="${html.text.path}"/>
100 <insert path="${html.path}">${ekit.assoc.entry}</insert>
101 </xmltask>
102
103 <echo>EKIT has been associated with html files in GLI</echo>
104
105 <else>
106 <echo>EKIT is already associated with the html files in GLI</echo>
107 </else>
108 </if>
109
110 <if>
111 <bool>
112 <not><equals arg1="${htm.entry}" arg2="${ekit.assoc.entry}"/></not>
113 </bool>
114
115 <if>
116 <bool>
117 <isset property="htm.entry"/>
118 </bool>
119
120 <touch file="${orig.htm.file}"/>
121 <echo file="${orig.htm.file}">${htm.entry}</echo>
122
123 <else>
124 <delete file="${orig.htm.file}"/>
125 </else>
126 </if>
127
128 <xmltask source="${config.file}" dest="${config.file}">
129 <remove path="${htm.text.path}"/>
130 <insert path="${htm.path}">${ekit.assoc.entry}</insert>
131 </xmltask>
132
133 <echo>EKIT has been associated with htm files in GLI</echo>
134
135 <else>
136 <echo>EKIT is already associated with the htm files in GLI</echo>
137 </else>
138 </if>
139 </target>
140
141 <target name="clean" depends="main">
142 <xmltask source="${config.file}">
143 <copy path="${html.text.path}" property="html.entry"/>
144 <copy path="${htm.text.path}" property="htm.entry"/>
145 </xmltask>
146
147 <if>
148 <bool>
149 <equals arg1="${html.entry}" arg2="${ekit.assoc.entry}"/>
150 </bool>
151
152 <if>
153 <bool>
154 <available file="${orig.html.file}"/>
155 </bool>
156
157 <xmltask source="${config.file}" dest="${config.file}">
158 <remove path="${html.text.path}"/>
159 <insert path="${html.path}" file="${orig.html.file}"/>
160 </xmltask>
161
162 <delete file="${orig.html.file}"/>
163
164 <else>
165 <xmltask source="${config.file}" dest="${config.file}">
166 <remove path="${html.text.path}"/>
167 </xmltask>
168 </else>
169 </if>
170 </if>
171
172 <if>
173 <bool>
174 <equals arg1="${htm.entry}" arg2="${ekit.assoc.entry}"/>
175 </bool>
176
177 <if>
178 <bool>
179 <available file="${orig.htm.file}"/>
180 </bool>
181
182 <xmltask source="${config.file}" dest="${config.file}">
183 <remove path="${htm.text.path}"/>
184 <insert path="${htm.path}" file="${orig.htm.file}"/>
185 </xmltask>
186
187 <delete file="${orig.htm.file}"/>
188
189 <else>
190 <xmltask source="${config.file}" dest="${config.file}">
191 <remove path="${htm.text.path}"/>
192 </xmltask>
193 </else>
194 </if>
195 </if>
196
197 </target>
198</project>
Note: See TracBrowser for help on using the repository browser.