jruby-launcher 1.0.10-java → 1.0.11-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/Rakefile CHANGED
@@ -13,17 +13,7 @@ rescue LoadError
13
13
  end
14
14
  end
15
15
 
16
- file './lib/jruby-launcher.rb' => 'version.h' do |t|
17
- version = nil
18
- IO.readlines(t.prerequisites.first).grep(/LAUNCHER_VERSION\s+"([^"]+)"/) {|l| version = $1 }
19
- ruby = IO.readlines(t.name)
20
- File.open(t.name, "wb") do |f|
21
- ruby.each do |l|
22
- f << l.sub(/VERSION\s*=\s*"([^"]*)"/, "VERSION = \"#{version}\"")
23
- end
24
- end
25
- end
26
-
16
+ desc "Generate gemspec file"
27
17
  task :gemspec => './lib/jruby-launcher.rb' do
28
18
  @gemspec ||= Gem::Specification.new do |s|
29
19
  load './lib/jruby-launcher.rb'
@@ -42,8 +32,20 @@ task :gemspec => './lib/jruby-launcher.rb' do
42
32
  end
43
33
  end
44
34
 
45
- task :package => :gemspec do
35
+ desc "Create gem file"
36
+ task :package => [:update_version, :gemspec, :spec] do
46
37
  Gem::PackageTask.new(@gemspec) do |pkg|
47
38
  end
48
39
  Rake::Task['gem'].invoke
49
40
  end
41
+
42
+ desc "Update version.h based on information in lib/jruby-launcher.rb"
43
+ task :update_version do
44
+ load File.join(File.dirname(__FILE__), "lib", "jruby-launcher.rb")
45
+ version_file = File.join(File.dirname(__FILE__), "version.h")
46
+ version_file_content = File.read(version_file)
47
+ version_file_content.gsub! /JRUBY_LAUNCHER_VERSION\s+"[^"]+"/, "JRUBY_LAUNCHER_VERSION \"#{JRubyLauncher::VERSION}\""
48
+ File.open(version_file, "w") do |f|
49
+ f.puts version_file_content
50
+ end
51
+ end
data/argparser.cpp CHANGED
@@ -1,10 +1,11 @@
1
1
  /*
2
- * Copyright 2009-2011 JRuby Team (www.jruby.org).
2
+ * Copyright 2009-2012 JRuby Team (www.jruby.org).
3
3
  */
4
4
 
5
5
  #include <cstring>
6
6
  #include <cstdlib>
7
7
  #include <memory>
8
+ #include <string>
8
9
  #include "utilsfuncs.h"
9
10
  #include "argparser.h"
10
11
  #include "argnames.h"
@@ -166,12 +167,9 @@ bool ArgParser::initPlatformDir() {
166
167
 
167
168
  if (!found) { // try via PATH search
168
169
  logMsg("initPlatformDir: trying to find executable on PATH");
169
- char * location = findOnPath(platformDir.c_str());
170
- if (location != NULL) {
171
- strncpy(path, location, PATH_MAX);
172
- free(location);
173
- found = true;
174
- }
170
+ std::string location = findOnPath(platformDir.c_str());
171
+ strncpy(path, location.c_str(), PATH_MAX);
172
+ found = true;
175
173
  }
176
174
 
177
175
  if (!found) { // try via JRUBY_HOME
@@ -430,6 +428,7 @@ void ArgParser::prepareOptions() {
430
428
  option += bootClassPath;
431
429
  javaOptions.push_back(option);
432
430
  }
431
+
433
432
  }
434
433
 
435
434
  void ArgParser::setupMaxHeapAndStack() {
data/jvmlauncher.cpp CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
3
  *
4
- * Copyright 2009-2011 JRuby Team (www.jruby.org).
4
+ * Copyright 2009-2012 JRuby Team (www.jruby.org).
5
5
  * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
6
6
  *
7
7
  * The contents of this file are subject to the terms of either the GNU
data/jvmlauncher.h CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
3
  *
4
- * Copyright 2009-2011 JRuby Team (www.jruby.org).
4
+ * Copyright 2009-2012 JRuby Team (www.jruby.org).
5
5
  * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
6
6
  *
7
7
  * The contents of this file are subject to the terms of either the GNU
@@ -1,3 +1,3 @@
1
1
  module JRubyLauncher
2
- VERSION = "1.0.10"
2
+ VERSION = "1.0.11"
3
3
  end
data/platformlauncher.cpp CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
3
  *
4
- * Copyright 2009-2011 JRuby Team (www.jruby.org).
4
+ * Copyright 2009-2012 JRuby Team (www.jruby.org).
5
5
  * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
6
6
  *
7
7
  * The contents of this file are subject to the terms of either the GNU
data/platformlauncher.h CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
3
  *
4
- * Copyright 2009-2011 JRuby Team (www.jruby.org).
4
+ * Copyright 2009-2012 JRuby Team (www.jruby.org).
5
5
  * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
6
6
  *
7
7
  * The contents of this file are subject to the terms of either the GNU
@@ -1,4 +1,5 @@
1
1
  require File.expand_path('../spec_helper.rb', __FILE__)
2
+ load File.expand_path('../../lib/jruby-launcher.rb', __FILE__)
2
3
 
3
4
  describe "JRuby native launcher" do
4
5
  it "should run org.jruby.Main" do
@@ -210,6 +211,6 @@ describe "JRuby native launcher" do
210
211
  end
211
212
 
212
213
  it "should print the version" do
213
- jruby_launcher("-Xversion 2>&1").should =~ /Launcher Version [0-9.]+/
214
+ jruby_launcher("-Xversion 2>&1").should =~ /Launcher Version #{JRubyLauncher::VERSION}/
214
215
  end
215
216
  end
data/unixlauncher.cpp CHANGED
@@ -28,8 +28,15 @@ int UnixLauncher::run(int argc, char* argv[], char* envp[]) {
28
28
  if (nailgunClient) {
29
29
  progArgs.push_front("org.jruby.util.NailMain");
30
30
  char ** nailArgv = convertToArgvArray(progArgs);
31
+ int nailArgc = progArgs.size();
32
+
31
33
  if (printCommandLine) {
32
- return printArgvToConsole(nailArgv);
34
+ printListToConsole(progArgs);
35
+ for (int i = 0; i < nailArgc; i++) {
36
+ free(nailArgv[i]);
37
+ }
38
+ delete[] nailArgv;
39
+ return 0;
33
40
  }
34
41
  return nailgunClientMain(progArgs.size(), (char**)nailArgv, envp);
35
42
  }
@@ -65,12 +72,17 @@ int UnixLauncher::run(int argc, char* argv[], char* envp[]) {
65
72
  }
66
73
 
67
74
  char** newArgv = convertToArgvArray(commandLine);
75
+ int newArgc = commandLine.size();
68
76
 
69
77
  if (printCommandLine) {
70
- return printArgvToConsole(newArgv);
78
+ printListToConsole(commandLine);
79
+ for (int i = 0; i < newArgc; i++) {
80
+ free(newArgv[i]);
81
+ }
82
+ delete[] newArgv;
83
+ return 0;
71
84
  }
72
85
 
73
-
74
86
  if (!fileExists(java.c_str())) {
75
87
  string msg = "No `java' exists at " + java + ", please double-check JAVA_HOME.\n";
76
88
  printToConsole(msg.c_str());
data/utilsfuncs.cpp CHANGED
@@ -47,6 +47,10 @@
47
47
  #include <cstring>
48
48
  #include <cstdlib>
49
49
  #include <memory>
50
+ #include <list>
51
+ #include <algorithm>
52
+ #include <iterator>
53
+ #include <iostream>
50
54
  #include "utilsfuncs.h"
51
55
  #include "argnames.h"
52
56
 
@@ -114,7 +118,7 @@ bool fileExists(const char *path) {
114
118
  return true;
115
119
  }
116
120
 
117
- char* findOnPath(const char* name) {
121
+ string findOnPath(const char* name) {
118
122
  string path(getenv("PATH"));
119
123
  size_t start = 0;
120
124
  size_t sep;
@@ -133,9 +137,8 @@ char* findOnPath(const char* name) {
133
137
  elem += name;
134
138
 
135
139
  if (checkExists(elem.c_str(), 0)) {
136
- found = (char*) malloc(elem.length());
137
- strncpy(found, elem.c_str(), elem.length() + 1);
138
- return found;
140
+ string found_string(elem);
141
+ return found_string;
139
142
  }
140
143
 
141
144
  start = sep + 1;
@@ -244,26 +247,24 @@ bool printToConsole(const char *msg) {
244
247
  }
245
248
 
246
249
  char** convertToArgvArray(list<string> args) {
247
- char ** argv = (char**) malloc(sizeof (char*) * args.size() + 1);
250
+ char ** argv = new char*[args.size()+1];
248
251
  int i = 0;
249
252
  for (list<string>::iterator it = args.begin(); it != args.end(); ++it, ++i) {
250
- argv[i] = (char*) malloc(sizeof(char) * it->length() + 1);
251
- strncpy(argv[i], it->c_str(), it->length() + 1);
253
+ argv[i] = strdup((*it).c_str());
252
254
  }
253
- argv[i] = NULL;
255
+ argv[args.size()] = NULL;
254
256
  return argv;
255
257
  }
256
258
 
257
259
  void addToArgList(list<string> & args, int argc, char ** argv) {
258
260
  for (int i = 0; i < argc; i++) {
259
- args.push_back(argv[i]);
261
+ std::string str(argv[i]);
262
+ args.push_back(str);
260
263
  }
261
264
  }
262
265
 
263
- int printArgvToConsole(char** argv) {
264
- while (*argv) {
265
- printf("%s\n", *argv);
266
- argv++;
266
+ void printListToConsole(list<string> values) {
267
+ for (list<string>::iterator it = values.begin(); it != values.end(); ++it) {
268
+ std::cout << *it << std::endl;
267
269
  }
268
- return 0;
269
270
  }
data/utilsfuncs.h CHANGED
@@ -56,9 +56,9 @@ bool checkLoggingArg(int argc, char *argv[], bool delFile);
56
56
  bool printToConsole(const char *msg);
57
57
  char** convertToArgvArray(std::list<std::string> args);
58
58
  void addToArgList(std::list<std::string> & args, int argc, char ** argv);
59
- char* findOnPath(const char* name);
59
+ std::string findOnPath(const char* name);
60
60
  bool checkDirectory(const char* path);
61
- int printArgvToConsole(char** argv);
61
+ void printListToConsole(std::list<std::string> l);
62
62
 
63
63
  #ifndef WIN32
64
64
  #define FILE_SEP '/'
data/version.h CHANGED
@@ -1,11 +1,11 @@
1
1
  /*
2
- * Copyright 2009-2011 JRuby Team (www.jruby.org).
2
+ * Copyright 2009-2012 JRuby Team (www.jruby.org).
3
3
  */
4
4
 
5
5
 
6
6
  #ifndef _VERSION_H_
7
7
  #define _VERSION_H_
8
8
 
9
- #define JRUBY_LAUNCHER_VERSION "1.0.9"
9
+ #define JRUBY_LAUNCHER_VERSION "1.0.11"
10
10
 
11
11
  #endif // ! _VERSION_H_
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: jruby-launcher
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.10
5
+ version: 1.0.11
6
6
  platform: java
7
7
  authors:
8
8
  - Nick Sieger
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2012-01-03 00:00:00 Z
14
+ date: 2012-01-09 00:00:00 Z
15
15
  dependencies: []
16
16
 
17
17
  description: Builds and installs a native launcher for JRuby on your system
@@ -61,8 +61,6 @@ files:
61
61
  homepage: http://jruby.org
62
62
  licenses: []
63
63
 
64
- metadata: {}
65
-
66
64
  post_install_message:
67
65
  rdoc_options: []
68
66
 
@@ -83,9 +81,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
81
  requirements: []
84
82
 
85
83
  rubyforge_project: jruby-extras
86
- rubygems_version: 1.8.10
84
+ rubygems_version: 1.8.13
87
85
  signing_key:
88
- specification_version: 4
86
+ specification_version: 3
89
87
  summary: Native launcher for JRuby
90
88
  test_files: []
91
89