Antwrap 0.5.0-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,34 @@
1
+ # antwrap
2
+ #
3
+ # Copyright Caleb Powell 2007
4
+ #
5
+ # Licensed under the LGPL, see the file COPYING in the distribution
6
+ #
7
+ require 'test/unit'
8
+ require 'fileutils'
9
+ require 'java'
10
+ require '../lib/convert.rb'
11
+
12
+ class TestConvert < Test::Unit::TestCase
13
+
14
+ def test_create_symbol
15
+ assert_equal(':upload_jar_OHQ', create_symbol('upload-jar-OHQ'))
16
+ assert_equal(':upload_jar_OHQ', create_symbol('upload.jar.OHQ'))
17
+ assert_equal(':upload_jar_OHQ, :aprop_bar', create_symbol('upload.jar.OHQ, aprop-bar'))
18
+ end
19
+
20
+
21
+ def test_replace_properties
22
+ result = replace_properties("${aprop}", {'aprop' => 'bar'})
23
+ assert_equal('bar', result)
24
+ result = replace_properties("${aprop}/adir", {'aprop' => 'bar'})
25
+ assert_equal('bar/adir', result)
26
+ result = replace_properties("${aprop}/${aprop}", {'aprop' => 'bar'})
27
+ assert_equal('bar/bar', result)
28
+ result = replace_properties("${unrelated}", {'aprop' => 'bar'})
29
+ assert_equal('${unrelated}', result)
30
+ result = replace_properties("${common.dir}/classes", {'common.dir' => 'bar'})
31
+ assert_equal('bar/classes', result)
32
+ end
33
+
34
+ end
@@ -0,0 +1,340 @@
1
+ <project name="kidsspace" default="compile" basedir=".">
2
+
3
+
4
+ <property name="common.dir" value="/Users/caleb/projects/svn/common"/>
5
+ <property name="common.classes" value="${common.dir}/classes"/>
6
+ <property name="common.lib.dir" value="${common.dir}/lib"/>
7
+ <property name="output.dir" value="gen-output"/>
8
+ <property name="outputjar" value="kidsspace.jar"/>
9
+ <property name="distro.dir" value="distro"/>
10
+ <property name="manifest.file" value="MANIFEST.MF"/>
11
+ <property name="file" value=""/>
12
+ <property name="build.compiler" value="javac1.4"/>
13
+
14
+
15
+ <patternset id="common.jars">
16
+ <include name="standard.jar"/>
17
+ <include name="jstl.jar"/>
18
+ <include name="mail.jar"/>
19
+ <include name="ojdbc14.jar"/>
20
+ <include name="ssce.jar"/>
21
+ <include name="ultrasearch_query.jar"/>
22
+ <include name="xercesImpl.jar"/>
23
+ <include name="xml-apis.jar"/>
24
+ <include name="log4j-1.2.13.jar"/>
25
+ </patternset>
26
+
27
+ <target name="init">
28
+ <mkdir dir="classes"/>
29
+ <mkdir dir="lib"/>
30
+ </target>
31
+
32
+ <target name="clean">
33
+ <delete dir="classes" failonerror="false"/>
34
+ <delete dir="${distro.dir}"/>
35
+ <delete file="${outputjar}"/>
36
+ <delete file="${output.dir}"/>
37
+ </target>
38
+
39
+ <path id="common.class.path">
40
+ <fileset dir="${common.dir}/lib">
41
+ <include name="**/*.jar"/>
42
+ </fileset>
43
+ <pathelement location="${common.classes}"/>
44
+ </path>
45
+
46
+ <path id="kidsspace.class.path">
47
+ <pathelement location="classes"/>
48
+ <pathelement location="config"/>
49
+ </path>
50
+
51
+ <path id="testing.class.path">
52
+ <pathelement location="test/testresources"/>
53
+ <pathelement location="${common.dir}/test/testresources"/>
54
+ </path>
55
+
56
+ <target name="compile.common">
57
+ <ant dir="${common.dir}" target="compile"/>
58
+ </target>
59
+
60
+ <target name="compile" depends="clean, init, compile.common">
61
+ <javac verbose="no" srcdir="src" destdir="classes" classpathref="common.class.path"/>
62
+ </target>
63
+
64
+ <target name="compile-tests" depends="compile">
65
+
66
+ <javac srcdir="test" destdir="classes">
67
+ <classpath refid="common.class.path"/>
68
+ <classpath refid="kidsspace.class.path"/>
69
+ </javac>
70
+ <ant dir="${common.dir}" target="compile-tests"/>
71
+ </target>
72
+
73
+ <target name="manifest" unless="manfist.generated">
74
+ <tstamp/>
75
+ <manifest file="${manifest.file}">
76
+ <attribute name="Built-By" value="${user.name}"/>
77
+ <attribute name="Built-On" value="${TODAY}"/>
78
+ </manifest>
79
+ <property name="manfist.generated" value="true"/>
80
+ </target>
81
+
82
+ <target name="make-jar" depends="compile, manifest">
83
+ <jar destfile="${outputjar}">
84
+ <fileset dir="classes" excludes="**/*Test.class"/>
85
+ <fileset dir="${common.classes}"/>
86
+ </jar>
87
+ </target>
88
+
89
+ <target name="distro">
90
+ <mkdir dir="${distro.dir}"/>
91
+ </target>
92
+
93
+ <target name="scientist-distro" depends="clean, distro, make-jar">
94
+ <tstamp/>
95
+ <copy file="scripts/runScientistDBConverter.sh" todir="${distro.dir}" overwrite="true"/>
96
+ <copy file="config/log4j.properties" todir="${distro.dir}" overwrite="true"/>
97
+ <copy file="config/kidsspace/development.db.properties" tofile="${distro.dir}/db.properties" overwrite="true"/>
98
+ <copy todir="${distro.dir}/lib" overwrite="true">
99
+ <fileset dir="${common.lib.dir}">
100
+ <include name="log4j-1.2.13.jar"/>
101
+ <include name="ojdbc14.jar"/>
102
+ </fileset>
103
+ </copy>
104
+ <copy todir="${distro.dir}" overwrite="true">
105
+ <fileset dir="sql">
106
+ <include name="SciInv*.csv"/>
107
+ </fileset>
108
+ </copy>
109
+ <copy file="${outputjar}" todir="${distro.dir}/lib" overwrite="true"/>
110
+ <zip destfile="scientistconverter.zip">
111
+ <zipfileset dir="${distro.dir}" prefix="scientistconverter"/>
112
+ </zip>
113
+ <antcall target="clean"/>
114
+ </target>
115
+
116
+
117
+ <target name="proddistro" depends="webdistro, distro">
118
+ <copy tofile="${distro.dir}/WEB-INF/web.xml" file="config/kidsspace/production.web.xml"/>
119
+ <copy tofile="${distro.dir}/WEB-INF/spellchecker.properties"
120
+ file="config/kidsspace/production.spellchecker.properties"/>
121
+ </target>
122
+
123
+ <target name="devdistro" depends="webdistro, distro">
124
+ <copy tofile="${distro.dir}/WEB-INF/web.xml" file="config/kidsspace/development.web.xml"/>
125
+ <copy tofile="${distro.dir}/WEB-INF/spellchecker.properties"
126
+ file="config/kidsspace/development.spellchecker.properties"/>
127
+ </target>
128
+
129
+ <target name="webdistro" depends="clean, make-jar, distro">
130
+
131
+ <mkdir dir="${distro.dir}/WEB-INF/lib"/>
132
+ <copy overwrite="true" todir="${distro.dir}/WEB-INF/lib">
133
+ <fileset dir="${common.lib.dir}">
134
+ <patternset refid="common.jars"/>
135
+ </fileset>
136
+ <fileset file="${outputjar}"/>
137
+ </copy>
138
+
139
+ <mkdir dir="${distro.dir}/WEB-INF/lex"/>
140
+ <copy overwrite="true" todir="${distro.dir}/WEB-INF/lex">
141
+ <fileset dir="config/kidsspace/lex/">
142
+ <include name="*.tlx"/>
143
+ <include name="*.clx"/>
144
+ </fileset>
145
+ </copy>
146
+
147
+ </target>
148
+
149
+ <target name="scientist-conversion-development"
150
+ description="Inserts data from the specified csv files into the development database">
151
+ <property name="database.properties" value="config/kidsspace/development.db.properties"/>
152
+ <antcall target="scientist-conversion"/>
153
+ </target>
154
+
155
+ <target name="scientist-conversion-production"
156
+ description="Inserts data from the specified csv files into the production database">
157
+ <property name="database.properties" value="config/kidsspace/production.db.properties"/>
158
+ <antcall target="scientist-conversion"/>
159
+ </target>
160
+
161
+ <target name="scientist-conversion" depends="compile" if="database.properties"
162
+ description="Inserts data from the specified csv files into the database. Cannot be run in isolation. The 'database.properties' property must be set.">
163
+ <java classname="com.zincroe.kidsspace.util.ScientistInventorDBConverter" fork="true">
164
+ <classpath refid="common.class.path"/>
165
+ <classpath refid="kidsspace.class.path"/>
166
+ <jvmarg value="-Dlog4j.configuration=log4j.properties"/>
167
+ <arg value="books=sql/SciInvBooks.csv"/>
168
+ <arg value="bios=sql/SciInvAuthors.csv"/>
169
+ <arg value="fields=sql/SciInvFields.csv"/>
170
+ <arg value="dbprops=${database.properties}"/>
171
+ <arg value="audience=Children"/>
172
+ </java>
173
+ </target>
174
+
175
+ <target name="alltests" depends="compile-tests">
176
+ <junit printsummary="yes" haltonfailure="no">
177
+ <classpath refid="common.class.path"/>
178
+ <classpath refid="kidsspace.class.path"/>
179
+ <classpath refid="testing.class.path"/>
180
+
181
+
182
+ <batchtest fork="yes">
183
+ <fileset dir="test">
184
+ <include name="**/*Test*.java"/>
185
+ </fileset>
186
+ <fileset dir="${common.dir}/test">
187
+ <include name="**/*Test*.java"/>
188
+ </fileset>
189
+ </batchtest>
190
+ </junit>
191
+ </target>
192
+
193
+ <target name="upload-dev-server" depends="devdistro">
194
+ <ftp server="tpltst01.tpl.toronto.on.ca" userid="root" password=";vwebinfra;"
195
+ remotedir="/opt/bea3/user_projects/zincroe/ksDomain/applications/kidsEAR/kidsWEB"
196
+ verbose="no" action="send" passive="yes">
197
+ <fileset dir="${distro.dir}"/>
198
+ </ftp>
199
+ </target>
200
+
201
+ <target name="upload-prod-server" depends="proddistro">
202
+ <!-- Production webapp runs in a cluster so we need to upload to 2 machines -->
203
+ <ftp server="tplapp01.tpl.toronto.on.ca" userid="weblogic" password="password"
204
+ remotedir="/u01/bea/applications/tpldomain/kidsspace/kidsWEB"
205
+ verbose="no" action="send" passive="yes">
206
+ <fileset dir="${distro.dir}"/>
207
+ </ftp>
208
+ <ftp server="tplapp02.tpl.toronto.on.ca" userid="weblogic" password="password"
209
+ remotedir="/u01/bea/applications/tpldomain/kidsspace/kidsWEB"
210
+ verbose="yes" action="send" passive="yes">
211
+ <fileset dir="${distro.dir}"/>
212
+ </ftp>
213
+ </target>
214
+
215
+ <target name="gen-dev-pf" depends="clean, compile">
216
+ <mkdir dir="${output.dir}"/>
217
+ <java classname="com.zincroe.kidsspace.data.KidsSpaceCategoryFetcher"
218
+ fork="true" failonerror="true">
219
+ <classpath refid="common.class.path"/>
220
+ <classpath refid="kidsspace.class.path"/>
221
+ <jvmarg value="-Xdebug" />
222
+ <jvmarg value="-Xnoagent"/>
223
+ <jvmarg value="-Djava.compiler=NONE"/>
224
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"/>
225
+ <jvmarg value="-DlogLevel=#{$debuglevel}"/>
226
+ <jvmarg value="-Dtemplate.scheme=master"/>
227
+ <jvmarg value="-Ddisplay.hidden=true"/>
228
+ <!--<jvmarg value="-Dinteractive"/>-->
229
+ <jvmarg value="-Drun.mode=development"/>
230
+ <jvmarg value="-Dvelocity.props=config/kidsspace/velocity.properties"/>
231
+ <jvmarg value="-Xms512m"/>
232
+ <jvmarg value="-Xmx1024m"/>
233
+ <jvmarg value="-Dlog4j.configuration=log4j.properties" />
234
+ <arg value="${output.dir}"/>
235
+ <arg value="${basedir}/images"/>
236
+ <arg value="${basedir}/config/kidsspace/development.db.properties"/>
237
+ </java>
238
+ </target>
239
+ <target name="gen-prod-pf" depends="clean, compile">
240
+ <mkdir dir="${output.dir}"/>
241
+ <java classname="com.zincroe.kidsspace.data.KidsSpaceCategoryFetcher"
242
+ fork="true" failonerror="true">
243
+ <classpath refid="common.class.path"/>
244
+ <classpath refid="kidsspace.class.path"/>
245
+ <jvmarg value="-Xdebug" />
246
+ <jvmarg value="-Xnoagent" />
247
+ <jvmarg value="-Djava.compiler=NONE" />
248
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005" />
249
+ <jvmarg value="-DlogLevel=debug" />
250
+ <jvmarg value="-Ddisplay.hidden=true" />
251
+ <jvmarg value="-Dtemplate.scheme=master"/>
252
+ <jvmarg value="-Dinteractive" />
253
+ <jvmarg value="-Dvelocity.props=config/kidsspace/velocity.properties" />
254
+ <jvmarg value="-Xms512m" />
255
+ <jvmarg value="-Xmx1024m" />
256
+ <jvmarg value="-Dlog4j.configuration=log4j.properties" />
257
+
258
+ <arg value="${output.dir}"/>
259
+ <arg value="${basedir}/images"/>
260
+ <arg value="${basedir}/config/kidsspace/production.db.properties"/>
261
+ </java>
262
+ </target>
263
+
264
+ <target name="upload-dev-jar" depends="make-jar">
265
+ <upload-jar-OHQ/>
266
+ <telnet.and.copy.jar destination="/u01/bea/collagebin/kidslib/development"/>
267
+ </target>
268
+
269
+ <target name="upload-prod-jar" depends="make-jar">
270
+ <upload-jar-OHQ/>
271
+ <telnet.and.copy.jar destination="/u01/bea/collagebin/kidslib/production"/>
272
+ </target>
273
+
274
+ <target name="upload">
275
+ <upload-jar-OHQ jarfile="${file}" />
276
+ </target>
277
+
278
+ <macrodef name="upload-jar-OHQ">
279
+ <attribute name="jarfile" default="${outputjar}"/>
280
+ <attribute name="remotedir" default="/u01/OHQ"/>
281
+ <attribute name="server" default="tpltst01.tpl.toronto.on.ca"/>
282
+ <attribute name="userid" default="zincroe"/>
283
+ <attribute name="password" default="z1ncr0e"/>
284
+
285
+ <sequential>
286
+ <ftp server="@{server}" userid="@{userid}" password="@{password}"
287
+ remotedir="@{remotedir}"
288
+ verbose="yes" action="send" passive="yes">
289
+ <fileset file="@{jarfile}"/>
290
+ </ftp>
291
+ </sequential>
292
+ </macrodef>
293
+
294
+ <macrodef name="telnet.and.copy.jar">
295
+ <attribute name="jarfile" default="${outputjar}"/>
296
+ <attribute name="destination"/>
297
+ <attribute name="server" default="tplapp10.tpl.toronto.on.ca"/>
298
+ <attribute name="userid" default="root"/>
299
+ <attribute name="password" default=";vwebinfra;"/>
300
+ <sequential>
301
+ <telnet server="@{server}" userid="@{userid}" password="@{password}">
302
+ <read>#</read>
303
+ <write>cp /u01/OHQ/@{jarfile} @{destination}</write>
304
+ <read>#</read>
305
+ <write>exit</write>
306
+ </telnet>
307
+ </sequential>
308
+ </macrodef>
309
+
310
+ <taskdef resource="net/sf/antcontrib/antlib.xml"/>
311
+ <target name="ant-contrib">
312
+ <if>
313
+ <equals arg1="bar" arg2="bar" />
314
+ <then>
315
+ <echo message="if 1 is equal" />
316
+ </then>
317
+ <else>
318
+ <echo message="if 1 is not equal" />
319
+ </else>
320
+ </if>
321
+ <if>
322
+ <equals arg1="${foo}" arg2="bar" />
323
+ <then>
324
+ <echo message="if 2 is equal" />
325
+ </then>
326
+
327
+ <elseif>
328
+ <equals arg1="foo" arg2="foo" />
329
+ <then>
330
+ <echo message="if 2.1 is equal" />
331
+ </then>
332
+ </elseif>
333
+ <else>
334
+ <echo message="The value of property foo is not 'foo' or 'bar'" />
335
+ </else>
336
+ </if>
337
+
338
+ </target>
339
+
340
+ </project>
File without changes
Binary file
@@ -0,0 +1,19 @@
1
+ /**
2
+ * antwrap
3
+ *
4
+ * Copyright Caleb Powell 2007
5
+ *
6
+ * Licensed under the LGPL, see the file COPYING in the distribution
7
+ */
8
+
9
+ package parent;
10
+
11
+ /**
12
+ * Created by IntelliJ IDEA.
13
+ * User: caleb
14
+ * Date: Dec 30, 2006
15
+ * Time: 3:08:17 PM
16
+ * To change this template use File | Settings | File Templates.
17
+ */
18
+ public class FooBarParent {
19
+ }
Binary file
@@ -0,0 +1,26 @@
1
+ /**
2
+ * antwrap
3
+ *
4
+ * Copyright Caleb Powell 2007
5
+ *
6
+ * Licensed under the LGPL, see the file COPYING in the distribution
7
+ */
8
+ package foo.bar;
9
+
10
+ import parent.FooBarParent;
11
+
12
+ public class FooBar extends FooBarParent {
13
+
14
+ public FooBar(){
15
+ }
16
+
17
+ public static void main(String[] args){
18
+ System.out.println("foo.FooBar.main");
19
+ System.out.println("The FooBar class has been run with the following arguments:");
20
+ for (int i = 0; i < args.length; i++) {
21
+ System.out.println("arg = " + args[i]);
22
+ }
23
+ System.out.println("Antwrap JVM Arg: " + System.getProperty("antwrap"));
24
+ System.exit(0);
25
+ }
26
+ }
@@ -0,0 +1,7 @@
1
+ package foo.bar.baz;
2
+
3
+ public class FooBarBaz{
4
+
5
+ public FooBarBaz(){
6
+ }
7
+ }
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.8.10
3
+ specification_version: 1
4
+ name: Antwrap
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.5.0
7
+ date: 2007-03-15
8
+ summary: "A Ruby module that wraps the Apache Ant build tool, enabling Ant Tasks to be
9
+ invoked from a Ruby/JRuby scripts."
10
+ require_paths:
11
+ - lib
12
+ email: caleb.powell@gmail.com
13
+ homepage: http://rubyforge.org/projects/antwrap/
14
+ rubyforge_project:
15
+ description:
16
+ autorequire: antwrap
17
+ default_executable:
18
+ bindir: bin
19
+ has_rdoc: true
20
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
21
+ requirements:
22
+ -
23
+ - ">"
24
+ - !ruby/object:Gem::Version
25
+ version: 0.0.0
26
+ version:
27
+ platform: java
28
+ authors:
29
+ - Caleb Powell
30
+ files:
31
+ - lib/antwrap.rb
32
+ - lib/jruby_modules.rb
33
+ - lib/rjb_modules.rb
34
+ - test/output
35
+ - test/tc_antwrap.rb
36
+ - test/tc_convert.rb
37
+ - test/test-resources
38
+ - test/output/META-INF
39
+ - test/output/parent
40
+ - test/output/META-INF/MANIFEST.MF
41
+ - test/output/parent/FooBarParent.class
42
+ - test/test-resources/build.xml
43
+ - test/test-resources/foo.txt
44
+ - test/test-resources/foo.zip
45
+ - test/test-resources/parent-src
46
+ - test/test-resources/parent.jar
47
+ - test/test-resources/src
48
+ - test/test-resources/parent-src/parent
49
+ - test/test-resources/parent-src/parent/FooBarParent.java
50
+ - test/test-resources/src/foo
51
+ - test/test-resources/src/foo/bar
52
+ - test/test-resources/src/foo/bar/baz
53
+ - test/test-resources/src/foo/bar/FooBar.java
54
+ - test/test-resources/src/foo/bar/baz/FooBarBaz.java
55
+ - docs/index.html
56
+ - README
57
+ - COPYING
58
+ test_files:
59
+ - test/tc_antwrap.rb
60
+ rdoc_options: []
61
+ extra_rdoc_files:
62
+ - README
63
+ - COPYING
64
+ executables: []
65
+ extensions: []
66
+ requirements: []
67
+ dependencies: []