buildr-gemjar 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.braids +8 -0
- data/.gitignore +5 -0
- data/.rvmrc +1 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +4 -0
- data/LICENSE +20 -0
- data/README.md +98 -0
- data/Rakefile +8 -0
- data/buildr-gemjar.gemspec +42 -0
- data/lib/buildr-gemjar.rb +162 -0
- data/lib/buildr-gemjar/version.rb +3 -0
- data/meta.rakefile +30 -0
- data/spec/buildr-gemjar/version_spec.rb +11 -0
- data/spec/buildr-gemjar_spec.rb +179 -0
- data/spec/repo_builder.rb +59 -0
- data/spec/spec_helper.rb +44 -0
- data/vendor/buildr/.gitignore +17 -0
- data/vendor/buildr/CHANGELOG +1283 -0
- data/vendor/buildr/Gemfile +4 -0
- data/vendor/buildr/LICENSE +176 -0
- data/vendor/buildr/NOTICE +26 -0
- data/vendor/buildr/README.rdoc +134 -0
- data/vendor/buildr/Rakefile +44 -0
- data/vendor/buildr/_buildr +35 -0
- data/vendor/buildr/_jbuildr +35 -0
- data/vendor/buildr/addon/buildr/antlr.rb +65 -0
- data/vendor/buildr/addon/buildr/bnd.rb +147 -0
- data/vendor/buildr/addon/buildr/cobertura.rb +22 -0
- data/vendor/buildr/addon/buildr/drb.rb +281 -0
- data/vendor/buildr/addon/buildr/emma.rb +22 -0
- data/vendor/buildr/addon/buildr/hibernate.rb +149 -0
- data/vendor/buildr/addon/buildr/javacc.rb +85 -0
- data/vendor/buildr/addon/buildr/jaxb_xjc.rb +72 -0
- data/vendor/buildr/addon/buildr/jdepend.rb +60 -0
- data/vendor/buildr/addon/buildr/jetty.rb +248 -0
- data/vendor/buildr/addon/buildr/jibx.rb +86 -0
- data/vendor/buildr/addon/buildr/nailgun.rb +221 -0
- data/vendor/buildr/addon/buildr/openjpa.rb +88 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/BuildrNail.java +41 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
- data/vendor/buildr/addon/buildr/protobuf.rb +88 -0
- data/vendor/buildr/addon/buildr/xmlbeans.rb +93 -0
- data/vendor/buildr/all-in-one/_buildr +19 -0
- data/vendor/buildr/all-in-one/buildr +368 -0
- data/vendor/buildr/all-in-one/buildr.cmd +1 -0
- data/vendor/buildr/bin/buildr +19 -0
- data/vendor/buildr/buildr.buildfile +58 -0
- data/vendor/buildr/buildr.gemspec +74 -0
- data/vendor/buildr/doc/_config.yml +1 -0
- data/vendor/buildr/doc/_layouts/default.html +90 -0
- data/vendor/buildr/doc/_layouts/preface.html +22 -0
- data/vendor/buildr/doc/artifacts.textile +217 -0
- data/vendor/buildr/doc/building.textile +276 -0
- data/vendor/buildr/doc/contributing.textile +268 -0
- data/vendor/buildr/doc/css/default.css +236 -0
- data/vendor/buildr/doc/css/print.css +101 -0
- data/vendor/buildr/doc/css/syntax.css +23 -0
- data/vendor/buildr/doc/download.textile +138 -0
- data/vendor/buildr/doc/extending.textile +212 -0
- data/vendor/buildr/doc/images/1442160941-frontcover.jpg +0 -0
- data/vendor/buildr/doc/images/asf-logo.gif +0 -0
- data/vendor/buildr/doc/images/asf-logo.png +0 -0
- data/vendor/buildr/doc/images/buildr-hires.png +0 -0
- data/vendor/buildr/doc/images/buildr.png +0 -0
- data/vendor/buildr/doc/images/favicon.png +0 -0
- data/vendor/buildr/doc/images/growl-icon.tiff +0 -0
- data/vendor/buildr/doc/images/note.png +0 -0
- data/vendor/buildr/doc/images/project-structure.png +0 -0
- data/vendor/buildr/doc/images/tip.png +0 -0
- data/vendor/buildr/doc/images/zbuildr.png +0 -0
- data/vendor/buildr/doc/images/zbuildr.tif +0 -0
- data/vendor/buildr/doc/index.textile +69 -0
- data/vendor/buildr/doc/installing.textile +284 -0
- data/vendor/buildr/doc/languages.textile +599 -0
- data/vendor/buildr/doc/mailing_lists.textile +29 -0
- data/vendor/buildr/doc/more_stuff.textile +845 -0
- data/vendor/buildr/doc/packaging.textile +618 -0
- data/vendor/buildr/doc/preface.textile +54 -0
- data/vendor/buildr/doc/projects.textile +276 -0
- data/vendor/buildr/doc/quick_start.textile +210 -0
- data/vendor/buildr/doc/releasing.textile +117 -0
- data/vendor/buildr/doc/scripts/buildr-git.rb +512 -0
- data/vendor/buildr/doc/scripts/gitflow.rb +296 -0
- data/vendor/buildr/doc/scripts/install-jruby.sh +44 -0
- data/vendor/buildr/doc/scripts/install-linux.sh +73 -0
- data/vendor/buildr/doc/scripts/install-osx.sh +52 -0
- data/vendor/buildr/doc/settings_profiles.textile +287 -0
- data/vendor/buildr/doc/testing.textile +247 -0
- data/vendor/buildr/etc/KEYS +189 -0
- data/vendor/buildr/lib/buildr.rb +44 -0
- data/vendor/buildr/lib/buildr/clojure.rb +34 -0
- data/vendor/buildr/lib/buildr/clojure/shell.rb +52 -0
- data/vendor/buildr/lib/buildr/core.rb +34 -0
- data/vendor/buildr/lib/buildr/core/application.rb +700 -0
- data/vendor/buildr/lib/buildr/core/build.rb +516 -0
- data/vendor/buildr/lib/buildr/core/cc.rb +166 -0
- data/vendor/buildr/lib/buildr/core/checks.rb +253 -0
- data/vendor/buildr/lib/buildr/core/common.rb +151 -0
- data/vendor/buildr/lib/buildr/core/compile.rb +622 -0
- data/vendor/buildr/lib/buildr/core/doc.rb +276 -0
- data/vendor/buildr/lib/buildr/core/environment.rb +129 -0
- data/vendor/buildr/lib/buildr/core/filter.rb +404 -0
- data/vendor/buildr/lib/buildr/core/generate.rb +197 -0
- data/vendor/buildr/lib/buildr/core/help.rb +119 -0
- data/vendor/buildr/lib/buildr/core/jrebel.rb +42 -0
- data/vendor/buildr/lib/buildr/core/linux.rb +30 -0
- data/vendor/buildr/lib/buildr/core/osx.rb +46 -0
- data/vendor/buildr/lib/buildr/core/progressbar.rb +161 -0
- data/vendor/buildr/lib/buildr/core/project.rb +975 -0
- data/vendor/buildr/lib/buildr/core/run.rb +43 -0
- data/vendor/buildr/lib/buildr/core/shell.rb +137 -0
- data/vendor/buildr/lib/buildr/core/test.rb +843 -0
- data/vendor/buildr/lib/buildr/core/transports.rb +565 -0
- data/vendor/buildr/lib/buildr/core/util.rb +537 -0
- data/vendor/buildr/lib/buildr/groovy.rb +20 -0
- data/vendor/buildr/lib/buildr/groovy/bdd.rb +106 -0
- data/vendor/buildr/lib/buildr/groovy/compiler.rb +153 -0
- data/vendor/buildr/lib/buildr/groovy/doc.rb +76 -0
- data/vendor/buildr/lib/buildr/groovy/shell.rb +57 -0
- data/vendor/buildr/lib/buildr/ide.rb +19 -0
- data/vendor/buildr/lib/buildr/ide/eclipse.rb +427 -0
- data/vendor/buildr/lib/buildr/ide/eclipse/java.rb +53 -0
- data/vendor/buildr/lib/buildr/ide/eclipse/plugin.rb +71 -0
- data/vendor/buildr/lib/buildr/ide/eclipse/scala.rb +68 -0
- data/vendor/buildr/lib/buildr/ide/idea.rb +576 -0
- data/vendor/buildr/lib/buildr/java.rb +25 -0
- data/vendor/buildr/lib/buildr/java/ant.rb +94 -0
- data/vendor/buildr/lib/buildr/java/bdd.rb +460 -0
- data/vendor/buildr/lib/buildr/java/cobertura.rb +297 -0
- data/vendor/buildr/lib/buildr/java/commands.rb +223 -0
- data/vendor/buildr/lib/buildr/java/compiler.rb +135 -0
- data/vendor/buildr/lib/buildr/java/deprecated.rb +141 -0
- data/vendor/buildr/lib/buildr/java/doc.rb +86 -0
- data/vendor/buildr/lib/buildr/java/ecj.rb +69 -0
- data/vendor/buildr/lib/buildr/java/emma.rb +244 -0
- data/vendor/buildr/lib/buildr/java/external.rb +73 -0
- data/vendor/buildr/lib/buildr/java/jruby.rb +122 -0
- data/vendor/buildr/lib/buildr/java/jtestr_result.rb +295 -0
- data/vendor/buildr/lib/buildr/java/jtestr_runner.rb.erb +116 -0
- data/vendor/buildr/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/vendor/buildr/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +142 -0
- data/vendor/buildr/lib/buildr/java/packaging.rb +734 -0
- data/vendor/buildr/lib/buildr/java/pom.rb +178 -0
- data/vendor/buildr/lib/buildr/java/rjb.rb +154 -0
- data/vendor/buildr/lib/buildr/java/test_result.rb +101 -0
- data/vendor/buildr/lib/buildr/java/tests.rb +362 -0
- data/vendor/buildr/lib/buildr/java/version_requirement.rb +172 -0
- data/vendor/buildr/lib/buildr/packaging.rb +25 -0
- data/vendor/buildr/lib/buildr/packaging/archive.rb +535 -0
- data/vendor/buildr/lib/buildr/packaging/artifact.rb +903 -0
- data/vendor/buildr/lib/buildr/packaging/artifact_namespace.rb +984 -0
- data/vendor/buildr/lib/buildr/packaging/artifact_search.rb +140 -0
- data/vendor/buildr/lib/buildr/packaging/gems.rb +105 -0
- data/vendor/buildr/lib/buildr/packaging/package.rb +249 -0
- data/vendor/buildr/lib/buildr/packaging/tar.rb +189 -0
- data/vendor/buildr/lib/buildr/packaging/version_requirement.rb +192 -0
- data/vendor/buildr/lib/buildr/packaging/zip.rb +178 -0
- data/vendor/buildr/lib/buildr/packaging/ziptask.rb +356 -0
- data/vendor/buildr/lib/buildr/resources/buildr.icns +0 -0
- data/vendor/buildr/lib/buildr/resources/completed.png +0 -0
- data/vendor/buildr/lib/buildr/resources/failed.png +0 -0
- data/vendor/buildr/lib/buildr/resources/icons-license.txt +17 -0
- data/vendor/buildr/lib/buildr/run.rb +195 -0
- data/vendor/buildr/lib/buildr/scala.rb +26 -0
- data/vendor/buildr/lib/buildr/scala/bdd.rb +118 -0
- data/vendor/buildr/lib/buildr/scala/compiler.rb +242 -0
- data/vendor/buildr/lib/buildr/scala/doc.rb +142 -0
- data/vendor/buildr/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
- data/vendor/buildr/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
- data/vendor/buildr/lib/buildr/scala/shell.rb +52 -0
- data/vendor/buildr/lib/buildr/scala/tests.rb +171 -0
- data/vendor/buildr/lib/buildr/shell.rb +185 -0
- data/vendor/buildr/lib/buildr/version.rb +18 -0
- data/vendor/buildr/rakelib/all-in-one.rake +113 -0
- data/vendor/buildr/rakelib/checks.rake +57 -0
- data/vendor/buildr/rakelib/doc.rake +137 -0
- data/vendor/buildr/rakelib/metrics.rake +39 -0
- data/vendor/buildr/rakelib/package.rake +73 -0
- data/vendor/buildr/rakelib/release.rake +161 -0
- data/vendor/buildr/rakelib/rspec.rake +101 -0
- data/vendor/buildr/rakelib/setup.rake +66 -0
- data/vendor/buildr/rakelib/stage.rake +220 -0
- data/vendor/buildr/spec/addon/bnd_spec.rb +330 -0
- data/vendor/buildr/spec/addon/drb_spec.rb +328 -0
- data/vendor/buildr/spec/addon/jaxb_xjc_spec.rb +125 -0
- data/vendor/buildr/spec/core/application_spec.rb +631 -0
- data/vendor/buildr/spec/core/build_spec.rb +837 -0
- data/vendor/buildr/spec/core/cc_spec.rb +224 -0
- data/vendor/buildr/spec/core/checks_spec.rb +519 -0
- data/vendor/buildr/spec/core/common_spec.rb +725 -0
- data/vendor/buildr/spec/core/compile_spec.rb +658 -0
- data/vendor/buildr/spec/core/doc_spec.rb +195 -0
- data/vendor/buildr/spec/core/extension_spec.rb +201 -0
- data/vendor/buildr/spec/core/generate_spec.rb +33 -0
- data/vendor/buildr/spec/core/project_spec.rb +772 -0
- data/vendor/buildr/spec/core/run_spec.rb +93 -0
- data/vendor/buildr/spec/core/shell_spec.rb +146 -0
- data/vendor/buildr/spec/core/test_spec.rb +1320 -0
- data/vendor/buildr/spec/core/transport_spec.rb +544 -0
- data/vendor/buildr/spec/core/util_spec.rb +141 -0
- data/vendor/buildr/spec/groovy/bdd_spec.rb +80 -0
- data/vendor/buildr/spec/groovy/compiler_spec.rb +251 -0
- data/vendor/buildr/spec/groovy/doc_spec.rb +65 -0
- data/vendor/buildr/spec/ide/eclipse_spec.rb +739 -0
- data/vendor/buildr/spec/ide/idea_spec.rb +1144 -0
- data/vendor/buildr/spec/java/ant_spec.rb +37 -0
- data/vendor/buildr/spec/java/bdd_spec.rb +374 -0
- data/vendor/buildr/spec/java/cobertura_spec.rb +112 -0
- data/vendor/buildr/spec/java/commands_spec.rb +93 -0
- data/vendor/buildr/spec/java/compiler_spec.rb +252 -0
- data/vendor/buildr/spec/java/doc_spec.rb +56 -0
- data/vendor/buildr/spec/java/ecj_spec.rb +115 -0
- data/vendor/buildr/spec/java/emma_spec.rb +121 -0
- data/vendor/buildr/spec/java/external_spec.rb +56 -0
- data/vendor/buildr/spec/java/java_spec.rb +132 -0
- data/vendor/buildr/spec/java/packaging_spec.rb +1270 -0
- data/vendor/buildr/spec/java/run_spec.rb +78 -0
- data/vendor/buildr/spec/java/test_coverage_helper.rb +257 -0
- data/vendor/buildr/spec/java/tests_spec.rb +497 -0
- data/vendor/buildr/spec/packaging/archive_spec.rb +775 -0
- data/vendor/buildr/spec/packaging/artifact_namespace_spec.rb +743 -0
- data/vendor/buildr/spec/packaging/artifact_spec.rb +1066 -0
- data/vendor/buildr/spec/packaging/packaging_helper.rb +63 -0
- data/vendor/buildr/spec/packaging/packaging_spec.rb +719 -0
- data/vendor/buildr/spec/sandbox.rb +165 -0
- data/vendor/buildr/spec/scala/bdd_spec.rb +124 -0
- data/vendor/buildr/spec/scala/compiler_spec.rb +289 -0
- data/vendor/buildr/spec/scala/doc_spec.rb +88 -0
- data/vendor/buildr/spec/scala/scala.rb +38 -0
- data/vendor/buildr/spec/scala/tests_spec.rb +283 -0
- data/vendor/buildr/spec/spec_helpers.rb +369 -0
- data/vendor/buildr/spec/version_requirement_spec.rb +143 -0
- data/vendor/buildr/spec/xpath_matchers.rb +121 -0
- data/vendor/buildr/tests/BUILDR-320/Buildfile +29 -0
- data/vendor/buildr/tests/JavaSystemProperty/Buildfile +18 -0
- data/vendor/buildr/tests/JavaSystemProperty/src/test/java/FooTest.java +24 -0
- data/vendor/buildr/tests/compile_with_parent/Buildfile +18 -0
- data/vendor/buildr/tests/compile_with_parent/child/src/main/java/Foo.java +23 -0
- data/vendor/buildr/tests/helloWorld/Buildfile +20 -0
- data/vendor/buildr/tests/helloWorld/src/main/java/HelloWorld.java +23 -0
- data/vendor/buildr/tests/integration_testing.rb +56 -0
- data/vendor/buildr/tests/junit3/Buildfile +9 -0
- data/vendor/buildr/tests/junit3/src/main/java/Foo.java +23 -0
- data/vendor/buildr/tests/junit3/src/test/java/FooTest.java +28 -0
- data/vendor/buildr/tests/package_war_as_jar/Buildfile +15 -0
- data/vendor/buildr/tests/package_war_as_jar/src/main/java/Foo.java +19 -0
- metadata +524 -0
Binary file
|
@@ -0,0 +1,144 @@
|
|
1
|
+
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
* contributor license agreements. See the NOTICE file distributed with this
|
3
|
+
* work for additional information regarding copyright ownership. The ASF
|
4
|
+
* licenses this file to you under the Apache License, Version 2.0 (the
|
5
|
+
* "License"); you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
12
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
+
* License for the specific language governing permissions and limitations
|
14
|
+
* under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
|
18
|
+
package org.apache.buildr;
|
19
|
+
|
20
|
+
import org.mortbay.jetty.Server;
|
21
|
+
import org.mortbay.jetty.Request;
|
22
|
+
import org.mortbay.jetty.Handler;
|
23
|
+
import org.mortbay.jetty.handler.AbstractHandler;
|
24
|
+
import org.mortbay.jetty.handler.ContextHandler;
|
25
|
+
import org.mortbay.jetty.handler.ContextHandlerCollection;
|
26
|
+
import org.mortbay.jetty.webapp.WebAppContext;
|
27
|
+
import org.mortbay.jetty.webapp.WebAppClassLoader;
|
28
|
+
|
29
|
+
import javax.servlet.http.HttpServletRequest;
|
30
|
+
import javax.servlet.http.HttpServletResponse;
|
31
|
+
import javax.servlet.ServletException;
|
32
|
+
import java.io.IOException;
|
33
|
+
import java.util.HashMap;
|
34
|
+
|
35
|
+
/**
|
36
|
+
* @author Matthieu Riou <mriou at apache dot org>
|
37
|
+
*/
|
38
|
+
public class JettyWrapper {
|
39
|
+
|
40
|
+
private Server _server;
|
41
|
+
private ContextHandlerCollection _handlerColl;
|
42
|
+
|
43
|
+
public JettyWrapper(int port) throws Exception {
|
44
|
+
_server = new Server(port);
|
45
|
+
// Adding the buildr handler to control our server lifecycle
|
46
|
+
ContextHandler context = new ContextHandler();
|
47
|
+
context.setContextPath("/buildr");
|
48
|
+
Handler handler = new BuildrHandler();
|
49
|
+
context.setHandler(handler);
|
50
|
+
|
51
|
+
_handlerColl = new ContextHandlerCollection();
|
52
|
+
_handlerColl.setHandlers(new Handler[] {context});
|
53
|
+
|
54
|
+
_server.addHandler(_handlerColl);
|
55
|
+
_server.start();
|
56
|
+
}
|
57
|
+
|
58
|
+
/*
|
59
|
+
public void join() {
|
60
|
+
try {
|
61
|
+
_server.join();
|
62
|
+
} catch (Exception e) {
|
63
|
+
e.printStackTrace();
|
64
|
+
}
|
65
|
+
}
|
66
|
+
*/
|
67
|
+
|
68
|
+
private class BuildrHandler extends AbstractHandler {
|
69
|
+
|
70
|
+
private HashMap _apps = new HashMap();
|
71
|
+
|
72
|
+
public void handle(String string, HttpServletRequest request,
|
73
|
+
HttpServletResponse response, int i) throws IOException, ServletException {
|
74
|
+
response.setContentType("text/html");
|
75
|
+
if (request.getPathInfo().equals("/")) {
|
76
|
+
response.getWriter().println("Alive");
|
77
|
+
((Request)request).setHandled(true);
|
78
|
+
return;
|
79
|
+
} else if (request.getPathInfo().equals("/deploy")) {
|
80
|
+
try {
|
81
|
+
String webapp = request.getParameter("webapp");
|
82
|
+
String path = request.getParameter("path");
|
83
|
+
System.out.println("Deploying " + webapp + " in " + path);
|
84
|
+
WebAppContext context;
|
85
|
+
|
86
|
+
context = (WebAppContext) _apps.get(path);
|
87
|
+
if (context != null) {
|
88
|
+
context.stop();
|
89
|
+
_handlerColl.removeHandler(context);
|
90
|
+
_apps.remove(path);
|
91
|
+
}
|
92
|
+
|
93
|
+
context = new WebAppContext(webapp, path);
|
94
|
+
context.setConfigurationClasses(new String[] {
|
95
|
+
"org.mortbay.jetty.webapp.WebInfConfiguration",
|
96
|
+
"org.mortbay.jetty.webapp.WebXmlConfiguration"});
|
97
|
+
context.setClassLoader(new WebAppClassLoader(context));
|
98
|
+
|
99
|
+
_handlerColl.addHandler(context);
|
100
|
+
context.start();
|
101
|
+
_apps.put(path, context);
|
102
|
+
response.getWriter().println("Deployed");
|
103
|
+
response.getWriter().println(context.getTempDirectory());
|
104
|
+
((Request)request).setHandled(true);
|
105
|
+
} catch (Throwable e) {
|
106
|
+
e.printStackTrace();
|
107
|
+
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
108
|
+
((Request)request).setHandled(true);
|
109
|
+
return;
|
110
|
+
}
|
111
|
+
} else if (request.getPathInfo().equals("/undeploy")) {
|
112
|
+
try {
|
113
|
+
String path = request.getParameter("path");
|
114
|
+
WebAppContext context = (WebAppContext) _apps.get(path);
|
115
|
+
if (context != null) {
|
116
|
+
System.out.println("Undeploying app at " + path);
|
117
|
+
context.stop();
|
118
|
+
_handlerColl.removeHandler(context);
|
119
|
+
_apps.remove(path);
|
120
|
+
}
|
121
|
+
response.getWriter().println("Undeployed");
|
122
|
+
((Request)request).setHandled(true);
|
123
|
+
} catch (Throwable e) {
|
124
|
+
e.printStackTrace();
|
125
|
+
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
126
|
+
((Request)request).setHandled(true);
|
127
|
+
return;
|
128
|
+
}
|
129
|
+
} else if (request.getPathInfo().equals("/stop")) {
|
130
|
+
try {
|
131
|
+
_server.stop();
|
132
|
+
_server.destroy();
|
133
|
+
// Brute force
|
134
|
+
System.exit(0);
|
135
|
+
} catch (Exception e) {
|
136
|
+
e.printStackTrace();
|
137
|
+
}
|
138
|
+
}
|
139
|
+
response.getWriter().println("OK " + request.getPathInfo());
|
140
|
+
((Request)request).setHandled(true);
|
141
|
+
}
|
142
|
+
|
143
|
+
}
|
144
|
+
}
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with this
|
3
|
+
# work for additional information regarding copyright ownership. The ASF
|
4
|
+
# licenses this file to you under the Apache License, Version 2.0 (the
|
5
|
+
# "License"); you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
12
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
+
# License for the specific language governing permissions and limitations under
|
14
|
+
# the License.
|
15
|
+
|
16
|
+
|
17
|
+
module Buildr
|
18
|
+
|
19
|
+
# Provides Protocol buffer code generation tasks.
|
20
|
+
#
|
21
|
+
# Require explicitly using <code>require "buildr/protobuf"</code>.
|
22
|
+
#
|
23
|
+
# Usage in your project:
|
24
|
+
#
|
25
|
+
# protoc _("path/to/proto/files")
|
26
|
+
#
|
27
|
+
# and also supports two options,
|
28
|
+
#
|
29
|
+
# :output => "target/generated/protoc" # this is the default
|
30
|
+
# :lang => "java" # defaults to compile.language
|
31
|
+
#
|
32
|
+
module Protobuf
|
33
|
+
class << self
|
34
|
+
def protoc(*args)
|
35
|
+
options = Hash === args.last ? args.pop : {}
|
36
|
+
rake_check_options options, :output, :lang, :include
|
37
|
+
|
38
|
+
options[:lang] ||= :java
|
39
|
+
options[:output] ||= File.expand_path "target/generated/protoc"
|
40
|
+
options[:include] ||= []
|
41
|
+
|
42
|
+
command_line = []
|
43
|
+
|
44
|
+
command_line << "--#{options[:lang]}_out=#{options[:output]}" if options[:output]
|
45
|
+
|
46
|
+
(paths_from_sources(*args) + options[:include]).each { |i| command_line << "-I#{i}" }
|
47
|
+
|
48
|
+
command_line += files_from_sources(*args)
|
49
|
+
|
50
|
+
mkdir_p( options[:output] )
|
51
|
+
|
52
|
+
system protoc_path, *command_line
|
53
|
+
end
|
54
|
+
|
55
|
+
def protoc_path
|
56
|
+
ENV['PROTOC'] || "protoc"
|
57
|
+
end
|
58
|
+
|
59
|
+
def files_from_sources(*args)
|
60
|
+
args.flatten.map(&:to_s).collect { |f| File.directory?(f) ? FileList[f + "/**/*.proto"] : f }.flatten
|
61
|
+
end
|
62
|
+
|
63
|
+
def paths_from_sources(*args)
|
64
|
+
args.flatten.map(&:to_s).collect { |f| File.directory?(f) ? f : File.dirname(f) }
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def protoc(*args)
|
69
|
+
if Hash === args.last
|
70
|
+
options = args.pop
|
71
|
+
else
|
72
|
+
options = {}
|
73
|
+
end
|
74
|
+
|
75
|
+
options[:output] ||= path_to(:target, :generated, :protoc)
|
76
|
+
options[:lang] ||= compile.language if compile.language
|
77
|
+
|
78
|
+
file(options[:output]=>Protobuf.files_from_sources(*args)) do |task|
|
79
|
+
Protobuf.protoc task.prerequisites, options
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
class Project
|
86
|
+
include Protobuf
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with this
|
3
|
+
# work for additional information regarding copyright ownership. The ASF
|
4
|
+
# licenses this file to you under the Apache License, Version 2.0 (the
|
5
|
+
# "License"); you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
12
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
+
# License for the specific language governing permissions and limitations under
|
14
|
+
# the License.
|
15
|
+
|
16
|
+
|
17
|
+
require 'buildr/java'
|
18
|
+
require 'buildr/java/ant'
|
19
|
+
|
20
|
+
|
21
|
+
module Buildr
|
22
|
+
|
23
|
+
# Provides XMLBeans schema compiler. Require explicitly using <code>require "buildr/xmlbeans"</code>.
|
24
|
+
#
|
25
|
+
# require 'buildr/xmlbeans'
|
26
|
+
# define 'some_proj' do
|
27
|
+
# compile_xml_beans _(:source, :main, :xsd) # the directory with *.xsd
|
28
|
+
# end
|
29
|
+
module XMLBeans
|
30
|
+
|
31
|
+
# You can use ArtifactNamespace to customize the versions of
|
32
|
+
# <code>:xmlbeans</code> or <code>:stax</code> used by this module:
|
33
|
+
#
|
34
|
+
# require 'buildr/xmlbeans'
|
35
|
+
# Buildr::XMLBeans::REQUIRES.xmlbeans = '2.2.0'
|
36
|
+
REQUIRES = ArtifactNamespace.for(self) do |ns|
|
37
|
+
ns.xmlbeans! 'org.apache.xmlbeans:xmlbeans:jar:2.3.0', '>2'
|
38
|
+
ns.stax_api! 'stax:stax-api:jar:>=1.0.1'
|
39
|
+
end
|
40
|
+
|
41
|
+
class << self
|
42
|
+
|
43
|
+
def compile(*args)
|
44
|
+
options = Hash === args.last ? args.pop : {}
|
45
|
+
options[:verbose] ||= trace?(:xmlbeans)
|
46
|
+
rake_check_options options, :verbose, :noop, :javasource, :jar, :compile, :output, :xsb
|
47
|
+
puts "Running XMLBeans schema compiler" if verbose
|
48
|
+
Buildr.ant "xmlbeans" do |ant|
|
49
|
+
ant.taskdef :name=>"xmlbeans", :classname=>"org.apache.xmlbeans.impl.tool.XMLBean",
|
50
|
+
:classpath=>requires.join(File::PATH_SEPARATOR)
|
51
|
+
ant.xmlbeans :srconly=>"true", :srcgendir=>options[:output].to_s, :classgendir=>options[:output].to_s,
|
52
|
+
:javasource=>options[:javasource] do
|
53
|
+
args.flatten.each { |file| ant.fileset File.directory?(file) ? { :dir=>file } : { :file=>file } }
|
54
|
+
end
|
55
|
+
end
|
56
|
+
# Touch paths to let other tasks know there's an update.
|
57
|
+
touch options[:output].to_s, :verbose=>false
|
58
|
+
end
|
59
|
+
|
60
|
+
def requires()
|
61
|
+
@requires ||= REQUIRES.artifacts
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def compile_xml_beans(*args)
|
66
|
+
# Run whenever XSD file changes, but typically we're given an directory of XSD files, or even file patterns
|
67
|
+
# (the last FileList is there to deal with things like *.xsdconfig).
|
68
|
+
files = args.flatten.map { |file| File.directory?(file) ? FileList["#{file}/*.xsd"] : FileList[file] }.flatten
|
69
|
+
# Generate sources and add them to the compile task.
|
70
|
+
generated = file(path_to(:target, :generated, :xmlbeans)=>files) do |task|
|
71
|
+
XMLBeans.compile args.flatten, :output=>task.name,
|
72
|
+
:javasource=>compile.options.source, :xsb=>compile.target
|
73
|
+
end
|
74
|
+
compile.using(:javac).from(generated).with(*XMLBeans.requires)
|
75
|
+
# Once compiled, we need to copy the generated XSB/XSD and one (magical?) class file
|
76
|
+
# into the target directory, or the rest is useless.
|
77
|
+
compile do |task|
|
78
|
+
verbose(false) do
|
79
|
+
base = generated.to_s
|
80
|
+
FileList["#{base}/**/*.{class,xsb,xsd}"].each do |file|
|
81
|
+
target = File.join(compile.target.to_s, Util.relative_path(file, base))
|
82
|
+
mkpath File.dirname(target) ; cp file, target
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
class Project
|
91
|
+
include XMLBeans
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env jruby
|
2
|
+
#
|
3
|
+
# This file was generated by RubyGems.
|
4
|
+
#
|
5
|
+
# The application 'buildr' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'rubygems'
|
10
|
+
|
11
|
+
version = ">= 0"
|
12
|
+
|
13
|
+
if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
|
14
|
+
version = $1
|
15
|
+
ARGV.shift
|
16
|
+
end
|
17
|
+
|
18
|
+
gem 'buildr', version
|
19
|
+
load Gem.bin_path('buildr', 'buildr', version)
|
@@ -0,0 +1,368 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
# -----------------------------------------------------------------------------
|
3
|
+
# jruby.sh - Start Script for the JRuby interpreter
|
4
|
+
#
|
5
|
+
# Environment Variable Prequisites
|
6
|
+
#
|
7
|
+
# JRUBY_OPTS (Optional) Default JRuby command line args
|
8
|
+
# JRUBY_SHELL Where/What is system shell
|
9
|
+
#
|
10
|
+
# JAVA_HOME Must point at your Java Development Kit installation.
|
11
|
+
#
|
12
|
+
# -----------------------------------------------------------------------------
|
13
|
+
|
14
|
+
cygwin=false
|
15
|
+
|
16
|
+
# ----- Identify OS we are running under --------------------------------------
|
17
|
+
case "`uname`" in
|
18
|
+
CYGWIN*) cygwin=true;;
|
19
|
+
Darwin) darwin=true;;
|
20
|
+
esac
|
21
|
+
|
22
|
+
# ----- Verify and Set Required Environment Variables -------------------------
|
23
|
+
|
24
|
+
## resolve links - $0 may be a link to home
|
25
|
+
PRG=$0
|
26
|
+
progname=`basename "$0"`
|
27
|
+
|
28
|
+
while [ -h "$PRG" ] ; do
|
29
|
+
ls=`ls -ld "$PRG"`
|
30
|
+
link=`expr "$ls" : '.*-> \(.*\)$'`
|
31
|
+
if expr "$link" : '.*/.*' > /dev/null; then
|
32
|
+
if expr "$link" : '/' > /dev/null; then
|
33
|
+
PRG="$link"
|
34
|
+
else
|
35
|
+
PRG="`dirname ${PRG}`/${link}"
|
36
|
+
fi
|
37
|
+
else
|
38
|
+
PRG="`dirname $PRG`/$link"
|
39
|
+
fi
|
40
|
+
done
|
41
|
+
|
42
|
+
JRUBY_HOME_1=`dirname "$PRG"` # the ./bin dir
|
43
|
+
if [ "$JRUBY_HOME_1" = '.' ] ; then
|
44
|
+
cwd=`pwd`
|
45
|
+
JRUBY_HOME=`dirname $cwd` # JRUBY-2699
|
46
|
+
else
|
47
|
+
JRUBY_HOME=`dirname "$JRUBY_HOME_1"` # the . dir
|
48
|
+
fi
|
49
|
+
|
50
|
+
if [ -z "$JRUBY_OPTS" ] ; then
|
51
|
+
JRUBY_OPTS=""
|
52
|
+
fi
|
53
|
+
|
54
|
+
JRUBY_OPTS_SPECIAL="--ng" # space-separated list of special flags
|
55
|
+
unset JRUBY_OPTS_TEMP
|
56
|
+
function process_special_opts {
|
57
|
+
case $1 in
|
58
|
+
--ng) nailgun_client=true;;
|
59
|
+
*) break;;
|
60
|
+
esac
|
61
|
+
}
|
62
|
+
for opt in ${JRUBY_OPTS[@]}; do
|
63
|
+
for special in ${JRUBY_OPTS_SPECIAL[@]}; do
|
64
|
+
if [ $opt != $special ]; then
|
65
|
+
JRUBY_OPTS_TEMP="${JRUBY_OPTS_TEMP} $opt"
|
66
|
+
else
|
67
|
+
# make sure flags listed in JRUBY_OPTS_SPECIAL are processed
|
68
|
+
case "$opt" in
|
69
|
+
--ng)
|
70
|
+
process_special_opts $opt;;
|
71
|
+
esac
|
72
|
+
fi
|
73
|
+
done
|
74
|
+
done
|
75
|
+
JRUBY_OPTS=${JRUBY_OPTS_TEMP}
|
76
|
+
|
77
|
+
if [ -z "$JAVA_HOME" ] ; then
|
78
|
+
JAVA_CMD='java'
|
79
|
+
else
|
80
|
+
if $cygwin; then
|
81
|
+
JAVA_HOME=`cygpath -u "$JAVA_HOME"`
|
82
|
+
fi
|
83
|
+
JAVA_CMD="$JAVA_HOME/bin/java"
|
84
|
+
fi
|
85
|
+
|
86
|
+
# If you're seeing odd exceptions, you may have a bad JVM install.
|
87
|
+
# Uncomment this and report the version to the JRuby team along with error.
|
88
|
+
#$JAVA_CMD -version
|
89
|
+
|
90
|
+
JRUBY_SHELL=/bin/sh
|
91
|
+
|
92
|
+
# ----- Set Up The Boot Classpath -------------------------------------------
|
93
|
+
|
94
|
+
CP_DELIMITER=":"
|
95
|
+
|
96
|
+
# add main jruby jar to the bootclasspath
|
97
|
+
for j in "$JRUBY_HOME"/lib/jruby.jar "$JRUBY_HOME"/lib/jruby-complete.jar; do
|
98
|
+
if [ ! -e "$j" ]; then
|
99
|
+
continue
|
100
|
+
fi
|
101
|
+
if [ "$JRUBY_CP" ]; then
|
102
|
+
JRUBY_CP="$JRUBY_CP$CP_DELIMITER$j"
|
103
|
+
else
|
104
|
+
JRUBY_CP="$j"
|
105
|
+
fi
|
106
|
+
if [ $JRUBY_ALREADY_ADDED ]; then
|
107
|
+
echo "WARNING: more than one JRuby JAR found in lib directory"
|
108
|
+
fi
|
109
|
+
JRUBY_ALREADY_ADDED=true
|
110
|
+
done
|
111
|
+
|
112
|
+
if $cygwin; then
|
113
|
+
JRUBY_CP=`cygpath -p -w "$JRUBY_CP"`
|
114
|
+
fi
|
115
|
+
|
116
|
+
# ----- Set Up The System Classpath -------------------------------------------
|
117
|
+
|
118
|
+
if [ "$JRUBY_PARENT_CLASSPATH" != "" ]; then
|
119
|
+
# Use same classpath propagated from parent jruby
|
120
|
+
CP=$JRUBY_PARENT_CLASSPATH
|
121
|
+
else
|
122
|
+
# add other jars in lib to CP for command-line execution
|
123
|
+
for j in "$JRUBY_HOME"/lib/*.jar; do
|
124
|
+
if [ "$j" == "$JRUBY_HOME"/lib/jruby.jar ]; then
|
125
|
+
continue
|
126
|
+
fi
|
127
|
+
if [ "$j" == "$JRUBY_HOME"/lib/jruby-complete.jar ]; then
|
128
|
+
continue
|
129
|
+
fi
|
130
|
+
if [ "$CP" ]; then
|
131
|
+
CP="$CP$CP_DELIMITER$j"
|
132
|
+
else
|
133
|
+
CP="$j"
|
134
|
+
fi
|
135
|
+
done
|
136
|
+
|
137
|
+
if $cygwin; then
|
138
|
+
CP=`cygpath -p -w "$CP"`
|
139
|
+
fi
|
140
|
+
fi
|
141
|
+
|
142
|
+
if $cygwin; then
|
143
|
+
# switch delimiter only after building Unix style classpaths
|
144
|
+
CP_DELIMITER=";"
|
145
|
+
fi
|
146
|
+
|
147
|
+
# ----- Execute The Requested Command -----------------------------------------
|
148
|
+
|
149
|
+
if [ -z "$JAVA_MEM" ] ; then
|
150
|
+
JAVA_MEM=-Xmx500m
|
151
|
+
fi
|
152
|
+
|
153
|
+
if [ -z "$JAVA_STACK" ] ; then
|
154
|
+
JAVA_STACK=-Xss1024k
|
155
|
+
fi
|
156
|
+
|
157
|
+
JAVA_VM=-client
|
158
|
+
JAVA_ENCODING=""
|
159
|
+
|
160
|
+
declare -a java_args
|
161
|
+
declare -a ruby_args
|
162
|
+
|
163
|
+
java_class=org.jruby.Main
|
164
|
+
|
165
|
+
# Split out any -J argument for passing to the JVM.
|
166
|
+
# Scanning for args is aborted by '--'.
|
167
|
+
while [ $# -gt 0 ]
|
168
|
+
do
|
169
|
+
case "$1" in
|
170
|
+
# Stuff after '-J' in this argument goes to JVM
|
171
|
+
-J*)
|
172
|
+
val=${1:2}
|
173
|
+
if [ "${val:0:4}" = "-Xmx" ]; then
|
174
|
+
JAVA_MEM=$val
|
175
|
+
elif [ "${val:0:4}" = "-Xss" ]; then
|
176
|
+
JAVA_STACK=$val
|
177
|
+
elif [ "${val}" = "" ]; then
|
178
|
+
$JAVA_CMD -help
|
179
|
+
echo "(Prepend -J in front of these options when using 'jruby' command)"
|
180
|
+
exit
|
181
|
+
elif [ "${val}" = "-X" ]; then
|
182
|
+
$JAVA_CMD -X
|
183
|
+
echo "(Prepend -J in front of these options when using 'jruby' command)"
|
184
|
+
exit
|
185
|
+
elif [ "${val}" = "-classpath" ]; then
|
186
|
+
CP="$CP$CP_DELIMITER$2"
|
187
|
+
CLASSPATH=""
|
188
|
+
shift
|
189
|
+
elif [ "${val}" = "-cp" ]; then
|
190
|
+
CP="$CP$CP_DELIMITER$2"
|
191
|
+
CLASSPATH=""
|
192
|
+
shift
|
193
|
+
else
|
194
|
+
if [ "${val:0:3}" = "-ea" ]; then
|
195
|
+
VERIFY_JRUBY="yes"
|
196
|
+
elif [ "${val:0:16}" = "-Dfile.encoding=" ]; then
|
197
|
+
JAVA_ENCODING=$val
|
198
|
+
fi
|
199
|
+
java_args=("${java_args[@]}" "${1:2}")
|
200
|
+
fi
|
201
|
+
;;
|
202
|
+
# Match switches that take an argument
|
203
|
+
-C|-e|-I|-S) ruby_args=("${ruby_args[@]}" "$1" "$2"); shift ;;
|
204
|
+
# Match same switches with argument stuck together
|
205
|
+
-e*|-I*|-S*) ruby_args=("${ruby_args[@]}" "$1" ) ;;
|
206
|
+
# Run with the instrumented profiler: http://jiprof.sourceforge.net/
|
207
|
+
--profile)
|
208
|
+
PROFILE_ARGS="-javaagent:$JRUBY_HOME/lib/profile.jar -Dprofile.properties=$JRUBY_HOME/lib/profile-ruby.properties"
|
209
|
+
JRUBY_OPTS=("${JRUBY_OPTS[@]}" "-X+C")
|
210
|
+
VERIFY_JRUBY="yes"
|
211
|
+
;;
|
212
|
+
# Run with the instrumented profiler: http://jiprof.sourceforge.net/
|
213
|
+
--profile-all)
|
214
|
+
PROFILE_ARGS="-javaagent:$JRUBY_HOME/lib/profile.jar -Dprofile.properties=$JRUBY_HOME/lib/profile-all.properties"
|
215
|
+
JRUBY_OPTS=("${JRUBY_OPTS[@]}" "-X+C")
|
216
|
+
VERIFY_JRUBY="yes"
|
217
|
+
;;
|
218
|
+
# Run with JMX management enabled
|
219
|
+
--manage)
|
220
|
+
java_args=("${java_args[@]}" "-Dcom.sun.management.jmxremote")
|
221
|
+
java_args=("${java_args[@]}" "-Djruby.management.enabled=true") ;;
|
222
|
+
# Don't launch a GUI window, no matter what
|
223
|
+
--headless)
|
224
|
+
java_args=("${java_args[@]}" "-Djava.awt.headless=true") ;;
|
225
|
+
# Run under JDB
|
226
|
+
--jdb)
|
227
|
+
if [ -z "$JAVA_HOME" ] ; then
|
228
|
+
JAVA_CMD='jdb'
|
229
|
+
else
|
230
|
+
if $cygwin; then
|
231
|
+
JAVA_HOME=`cygpath -u "$JAVA_HOME"`
|
232
|
+
fi
|
233
|
+
JAVA_CMD="$JAVA_HOME/bin/jdb"
|
234
|
+
fi
|
235
|
+
java_args=("${java_args[@]}" "-sourcepath" "$JRUBY_HOME/lib/ruby/1.8:.")
|
236
|
+
JRUBY_OPTS=("${JRUBY_OPTS[@]}" "-X+C") ;;
|
237
|
+
--client)
|
238
|
+
JAVA_VM=-client ;;
|
239
|
+
--server)
|
240
|
+
JAVA_VM=-server ;;
|
241
|
+
--noclient) # JRUBY-4296
|
242
|
+
unset JAVA_VM ;; # For IBM JVM, neither '-client' nor '-server' is applicable
|
243
|
+
--sample)
|
244
|
+
java_args=("${java_args[@]}" "-Xprof") ;;
|
245
|
+
--ng-server)
|
246
|
+
# Start up as Nailgun server
|
247
|
+
java_class=com.martiansoftware.nailgun.NGServer
|
248
|
+
VERIFY_JRUBY=true ;;
|
249
|
+
--ng)
|
250
|
+
# Use native Nailgun client to toss commands to server
|
251
|
+
process_special_opts "--ng" ;;
|
252
|
+
# Abort processing on the double dash
|
253
|
+
--) break ;;
|
254
|
+
# Other opts go to ruby
|
255
|
+
-*) ruby_args=("${ruby_args[@]}" "$1") ;;
|
256
|
+
# Abort processing on first non-opt arg
|
257
|
+
*) break ;;
|
258
|
+
esac
|
259
|
+
shift
|
260
|
+
done
|
261
|
+
|
262
|
+
# Force file.encoding to UTF-8 when on Mac, since Apple JDK defaults to MacRoman (JRUBY-3576)
|
263
|
+
if [[ $darwin && -z "$JAVA_ENCODING" ]]; then
|
264
|
+
java_args=("${java_args[@]}" "-Dfile.encoding=UTF-8")
|
265
|
+
fi
|
266
|
+
|
267
|
+
# Add a property to report memory max
|
268
|
+
JAVA_OPTS="$JAVA_OPTS $JAVA_VM -Djruby.memory.max=${JAVA_MEM:4} -Djruby.stack.max=${JAVA_STACK:4}"
|
269
|
+
|
270
|
+
# Append the rest of the arguments
|
271
|
+
ruby_args=("${ruby_args[@]}" "$@")
|
272
|
+
|
273
|
+
# Put the ruby_args back into the position arguments $1, $2 etc
|
274
|
+
set -- "${ruby_args[@]}"
|
275
|
+
|
276
|
+
JAVA_OPTS="$JAVA_OPTS $JAVA_MEM $JAVA_STACK"
|
277
|
+
|
278
|
+
JFFI_BOOT=""
|
279
|
+
if [ -d $JRUBY_HOME/lib/native/ ]; then
|
280
|
+
for d in $JRUBY_HOME/lib/native/*`uname -s`; do
|
281
|
+
if [ -z "$JFFI_BOOT" ]; then
|
282
|
+
JFFI_BOOT="$d"
|
283
|
+
else
|
284
|
+
JFFI_BOOT="$JFFI_BOOT:$d"
|
285
|
+
fi
|
286
|
+
done
|
287
|
+
fi
|
288
|
+
JFFI_OPTS="-Djffi.boot.library.path=$JFFI_BOOT"
|
289
|
+
|
290
|
+
if $cygwin; then
|
291
|
+
JRUBY_HOME=`cygpath --mixed "$JRUBY_HOME"`
|
292
|
+
JRUBY_SHELL=`cygpath --mixed "$JRUBY_SHELL"`
|
293
|
+
|
294
|
+
if [[ ( "${1:0:1}" = "/" ) && ( ( -f "$1" ) || ( -d "$1" )) ]]; then
|
295
|
+
win_arg=`cygpath -w "$1"`
|
296
|
+
shift
|
297
|
+
win_args=("$win_arg" "$@")
|
298
|
+
set -- "${win_args[@]}"
|
299
|
+
fi
|
300
|
+
|
301
|
+
# fix JLine to use UnixTerminal
|
302
|
+
stty -icanon min 1 -echo > /dev/null 2>&1
|
303
|
+
if [ $? = 0 ]; then
|
304
|
+
JAVA_OPTS="$JAVA_OPTS -Djline.terminal=jline.UnixTerminal"
|
305
|
+
fi
|
306
|
+
|
307
|
+
fi
|
308
|
+
|
309
|
+
if [ "$nailgun_client" != "" ]; then
|
310
|
+
if [ -f $JRUBY_HOME/tool/nailgun/ng ]; then
|
311
|
+
exec $JRUBY_HOME/tool/nailgun/ng org.jruby.util.NailMain $JRUBY_OPTS "$@"
|
312
|
+
else
|
313
|
+
echo "error: ng executable not found; run 'make' in ${JRUBY_HOME}/tool/nailgun"
|
314
|
+
exit 1
|
315
|
+
fi
|
316
|
+
else
|
317
|
+
if [ "$VERIFY_JRUBY" != "" ]; then
|
318
|
+
if [ "$PROFILE_ARGS" != "" ]; then
|
319
|
+
echo "Running with instrumented profiler"
|
320
|
+
fi
|
321
|
+
|
322
|
+
"$JAVA_CMD" $PROFILE_ARGS $JAVA_OPTS "$JFFI_OPTS" "${java_args[@]}" -classpath "$JRUBY_CP$CP_DELIMITER$CP$CP_DELIMITER$CLASSPATH" \
|
323
|
+
"-Djruby.home=$JRUBY_HOME" \
|
324
|
+
"-Djruby.lib=$JRUBY_HOME/lib" -Djruby.script=jruby \
|
325
|
+
"-Djruby.shell=$JRUBY_SHELL" \
|
326
|
+
$java_class $JRUBY_OPTS -S _buildr "$@"
|
327
|
+
|
328
|
+
# Record the exit status immediately, or it will be overridden.
|
329
|
+
JRUBY_STATUS=$?
|
330
|
+
|
331
|
+
if [ "$PROFILE_ARGS" != "" ]; then
|
332
|
+
echo "Profiling results:"
|
333
|
+
cat profile.txt
|
334
|
+
rm profile.txt
|
335
|
+
fi
|
336
|
+
|
337
|
+
if $cygwin; then
|
338
|
+
stty icanon echo > /dev/null 2>&1
|
339
|
+
fi
|
340
|
+
|
341
|
+
exit $JRUBY_STATUS
|
342
|
+
else
|
343
|
+
if $cygwin; then
|
344
|
+
# exec doed not work correctly with cygwin bash
|
345
|
+
"$JAVA_CMD" $JAVA_OPTS "$JFFI_OPTS" "${java_args[@]}" -Xbootclasspath/a:"$JRUBY_CP" -classpath "$CP$CP_DELIMITER$CLASSPATH" \
|
346
|
+
"-Djruby.home=$JRUBY_HOME" \
|
347
|
+
"-Djruby.lib=$JRUBY_HOME/lib" -Djruby.script=jruby \
|
348
|
+
"-Djruby.shell=$JRUBY_SHELL" \
|
349
|
+
$java_class $JRUBY_OPTS -S _buildr "$@"
|
350
|
+
|
351
|
+
# Record the exit status immediately, or it will be overridden.
|
352
|
+
JRUBY_STATUS=$?
|
353
|
+
|
354
|
+
stty icanon echo > /dev/null 2>&1
|
355
|
+
|
356
|
+
exit $JRUBY_STATUS
|
357
|
+
else
|
358
|
+
exec "$JAVA_CMD" $JAVA_OPTS "$JFFI_OPTS" "${java_args[@]}" -Xbootclasspath/a:"$JRUBY_CP" -classpath "$CP$CP_DELIMITER$CLASSPATH" \
|
359
|
+
"-Djruby.home=$JRUBY_HOME" \
|
360
|
+
"-Djruby.lib=$JRUBY_HOME/lib" -Djruby.script=jruby \
|
361
|
+
"-Djruby.shell=$JRUBY_SHELL" \
|
362
|
+
$java_class $JRUBY_OPTS -S _buildr "$@"
|
363
|
+
fi
|
364
|
+
fi
|
365
|
+
fi
|
366
|
+
|
367
|
+
# Be careful adding code down here, you might override the exit
|
368
|
+
# status of the jruby invocation.
|