jruby-launcher 0.9.9-java → 1.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/argparser.cpp +9 -2
- data/lib/jruby-launcher.rb +1 -1
- data/spec/launcher_spec.rb +17 -0
- data/spec/spec_helper.rb +1 -0
- metadata +3 -4
data/argparser.cpp
CHANGED
@@ -205,7 +205,7 @@ bool ArgParser::parseArgs(int argc, char *argv[]) {
|
|
205
205
|
|
206
206
|
#define CHECK_ARG \
|
207
207
|
it++; \
|
208
|
-
if (it == args.end() || it->at(0) == '-') {
|
208
|
+
if (it == args.end() || it->empty() || it->at(0) == '-') { \
|
209
209
|
logErr(false, true, "Argument is missing for \"%s\" option.", (--it)->c_str()); \
|
210
210
|
return false; \
|
211
211
|
} \
|
@@ -214,6 +214,13 @@ bool ArgParser::parseArgs(int argc, char *argv[]) {
|
|
214
214
|
|
215
215
|
addEnvVarToOptions(javaOptions, "JAVA_OPTS");
|
216
216
|
addEnvVarToOptions(args, "JRUBY_OPTS");
|
217
|
+
|
218
|
+
#ifdef __MACH__
|
219
|
+
if (getenv("JAVA_ENCODING") == NULL) {
|
220
|
+
javaOptions.push_back("-Dfile.encoding=UTF-8");
|
221
|
+
}
|
222
|
+
#endif
|
223
|
+
|
217
224
|
addToArgList(args, argc, argv);
|
218
225
|
|
219
226
|
logMsg("Parsing arguments:");
|
@@ -227,7 +234,7 @@ bool ArgParser::parseArgs(int argc, char *argv[]) {
|
|
227
234
|
for (list<string>::iterator it = args.begin(); it != args.end(); INCR) {
|
228
235
|
if (doneScanning) {
|
229
236
|
progArgs.push_back(*it);
|
230
|
-
} else if (it->compare("--") == 0 || it->at(0) != '-') {
|
237
|
+
} else if (it->compare("--") == 0 || it->empty() || it->at(0) != '-') {
|
231
238
|
progArgs.push_back(*it);
|
232
239
|
doneScanning = true;
|
233
240
|
} else if (it->compare(ARG_NAME_SEPAR_PROC) == 0) {
|
data/lib/jruby-launcher.rb
CHANGED
data/spec/launcher_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require File.expand_path('../spec_helper.rb', __FILE__)
|
2
|
+
require 'rbconfig'
|
2
3
|
|
3
4
|
describe "JRuby native launcher" do
|
4
5
|
it "should run org.jruby.Main" do
|
@@ -131,4 +132,20 @@ describe "JRuby native launcher" do
|
|
131
132
|
it "stops argument processing on first non-option argument" do
|
132
133
|
jruby_launcher_args("foo.rb --profile")[-2..-1].should == ["foo.rb", "--profile"]
|
133
134
|
end
|
135
|
+
|
136
|
+
# JRUBY-4608
|
137
|
+
if Config::CONFIG['target_os'] =~ /darwin/i
|
138
|
+
it "includes file.encoding=UTF-8 on Mac if JAVA_ENCODING is not set" do
|
139
|
+
jruby_launcher_args("-e true").should include("-Dfile.encoding=UTF-8")
|
140
|
+
with_environment "JAVA_ENCODING" => "MacRoman" do
|
141
|
+
jruby_launcher_args("-e true").should_not include("-Dfile.encoding=UTF-8")
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
it "does not crash on empty args" do
|
147
|
+
jruby_launcher_args("-e ''").should include("-e")
|
148
|
+
jruby_launcher("-Xtrace '' 2>&1").should =~ /-Xtrace/
|
149
|
+
jruby_launcher("-Xjdkhome '' 2>&1").should =~ /-Xjdkhome/
|
150
|
+
end
|
134
151
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -3,10 +3,9 @@ name: jruby-launcher
|
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
|
+
- 1
|
6
7
|
- 0
|
7
|
-
|
8
|
-
- 9
|
9
|
-
version: 0.9.9
|
8
|
+
version: "1.0"
|
10
9
|
platform: java
|
11
10
|
authors:
|
12
11
|
- Nick Sieger
|
@@ -15,7 +14,7 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2010-
|
17
|
+
date: 2010-04-07 00:00:00 -05:00
|
19
18
|
default_executable:
|
20
19
|
dependencies: []
|
21
20
|
|