winstone 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +4 -3
- data/VERSION +1 -1
- data/bin/winstone +17 -14
- data/winstone.gemspec +13 -10
- metadata +121 -87
- data/lib/jar_wrapper.rb +0 -16
- data/lib/jar_wrapper/jar_wrapper.rb +0 -74
- data/lib/jar_wrapper/jvm_options_probe.rb +0 -35
- data/lib/jar_wrapper/runner.rb +0 -134
data/README
CHANGED
@@ -7,7 +7,8 @@
|
|
7
7
|
|
8
8
|
== Usage
|
9
9
|
|
10
|
-
winstone install
|
11
|
-
winstone <params>
|
12
|
-
winstone lite <params>
|
10
|
+
winstone install - installs winstone
|
11
|
+
winstone <params> - runs the winstone server
|
12
|
+
winstone lite <params> - runs the winstone (lite) server
|
13
|
+
winstone tool <tool-params> - runs winstone tool
|
13
14
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
data/bin/winstone
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
3
|
+
#$:.unshift(File::join(File::dirname(File::dirname(__FILE__)), "lib"))
|
4
4
|
|
5
5
|
require 'rubygems' unless RUBY_VERSION =~ /1.9.*/
|
6
6
|
require 'jar_wrapper'
|
7
7
|
|
8
8
|
class WinstoneStarter
|
9
|
+
WINSTONE_VERSION = "0.9.10"
|
9
10
|
|
10
11
|
USAGE= <<-TEXT
|
11
12
|
Usage:
|
@@ -18,20 +19,20 @@ class WinstoneStarter
|
|
18
19
|
|
19
20
|
def initialize
|
20
21
|
@wrapper = JarWrapper.new
|
22
|
+
@wrapper.java_opts = ["-Xmx1024m", "-Xss1024k" ]
|
21
23
|
end
|
22
24
|
|
23
25
|
def run
|
24
26
|
install_dir = ENV['HOME'] + "/.winstone/assets"
|
25
|
-
verion = "0.9.10"
|
26
|
-
|
27
|
-
source1 = "http://surfnet.dl.sourceforge.net/project/winstone/winstone/v#{verion}/winstone-#{verion}.jar"
|
28
|
-
source2 = "http://surfnet.dl.sourceforge.net/project/winstone/winstone/v#{verion}/winstone-lite-#{verion}.jar"
|
29
27
|
|
30
|
-
|
31
|
-
|
28
|
+
source1 = "http://surfnet.dl.sourceforge.net/project/winstone/winstone/v#{WINSTONE_VERSION}/winstone-#{WINSTONE_VERSION}.jar"
|
29
|
+
source2 = "http://surfnet.dl.sourceforge.net/project/winstone/winstone/v#{WINSTONE_VERSION}/winstone-lite-#{WINSTONE_VERSION}.jar"
|
32
30
|
|
33
|
-
|
34
|
-
|
31
|
+
target1 = install_dir + "/winstone-#{WINSTONE_VERSION}.jar"
|
32
|
+
target2 = install_dir + "/winstone-lite-#{WINSTONE_VERSION}.jar"
|
33
|
+
|
34
|
+
jar_file1 = install_dir + "/winstone-#{WINSTONE_VERSION}.jar"
|
35
|
+
jar_file2 = install_dir + "/winstone-lite-#{WINSTONE_VERSION}.jar"
|
35
36
|
|
36
37
|
param = ARGV.length == 0 ? "" : ARGV.first
|
37
38
|
|
@@ -45,14 +46,16 @@ class WinstoneStarter
|
|
45
46
|
when 'help' then
|
46
47
|
puts USAGE and return
|
47
48
|
when 'lite' then
|
48
|
-
@wrapper.
|
49
|
+
@wrapper.jar_file = jar_file2
|
50
|
+
@wrapper.run ARGV
|
49
51
|
when 'tool' then
|
50
52
|
ARGV.shift
|
51
|
-
|
52
|
-
|
53
|
-
@wrapper.
|
53
|
+
@wrapper.classpath = jar_file1
|
54
|
+
@wrapper.main_class = ARGV.shift
|
55
|
+
@wrapper.run ARGV
|
54
56
|
else
|
55
|
-
|
57
|
+
@wrapper.jar_file = jar_file1
|
58
|
+
@wrapper.run ARGV
|
56
59
|
end
|
57
60
|
end
|
58
61
|
end
|
data/winstone.gemspec
CHANGED
@@ -5,14 +5,15 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{winstone}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = [
|
11
|
+
s.authors = ["Alexander Shvets"]
|
12
12
|
s.date = %q{2011-09-23}
|
13
|
+
s.default_executable = %q{winstone}
|
13
14
|
s.description = %q{Gem wrapper for winstone server.}
|
14
15
|
s.email = %q{alexander.shvets@gmail.com}
|
15
|
-
s.executables = [
|
16
|
+
s.executables = ["winstone"]
|
16
17
|
s.extra_rdoc_files = [
|
17
18
|
"README"
|
18
19
|
]
|
@@ -24,10 +25,6 @@ Gem::Specification.new do |s|
|
|
24
25
|
"bin/Gemfile",
|
25
26
|
"bin/winstone",
|
26
27
|
"bin/winstone.bat",
|
27
|
-
"lib/jar_wrapper.rb",
|
28
|
-
"lib/jar_wrapper/jar_wrapper.rb",
|
29
|
-
"lib/jar_wrapper/jvm_options_probe.rb",
|
30
|
-
"lib/jar_wrapper/runner.rb",
|
31
28
|
"winstone.gemspec"
|
32
29
|
]
|
33
30
|
s.homepage = %q{http://github.com/shvets/winstone}
|
@@ -43,9 +40,9 @@ Gem::Specification.new do |s|
|
|
43
40
|
|
44
41
|
-------------------------------------------------------------------------------
|
45
42
|
}
|
46
|
-
s.require_paths = [
|
47
|
-
s.requirements = [
|
48
|
-
s.rubygems_version = %q{1.
|
43
|
+
s.require_paths = ["lib"]
|
44
|
+
s.requirements = ["none"]
|
45
|
+
s.rubygems_version = %q{1.5.1}
|
49
46
|
s.summary = %q{Gem wrapper for winstone server (Summary).}
|
50
47
|
|
51
48
|
if s.respond_to? :specification_version then
|
@@ -54,19 +51,25 @@ Gem::Specification.new do |s|
|
|
54
51
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
55
52
|
s.add_runtime_dependency(%q<jeweler>, [">= 0"])
|
56
53
|
s.add_runtime_dependency(%q<zip>, [">= 0"])
|
54
|
+
s.add_runtime_dependency(%q<jar_wrapper>, [">= 0"])
|
57
55
|
s.add_runtime_dependency(%q<jeweler>, [">= 0"])
|
58
56
|
s.add_runtime_dependency(%q<zip>, [">= 0"])
|
57
|
+
s.add_runtime_dependency(%q<jar_wrapper>, [">= 0"])
|
59
58
|
else
|
60
59
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
61
60
|
s.add_dependency(%q<zip>, [">= 0"])
|
61
|
+
s.add_dependency(%q<jar_wrapper>, [">= 0"])
|
62
62
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
63
63
|
s.add_dependency(%q<zip>, [">= 0"])
|
64
|
+
s.add_dependency(%q<jar_wrapper>, [">= 0"])
|
64
65
|
end
|
65
66
|
else
|
66
67
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
67
68
|
s.add_dependency(%q<zip>, [">= 0"])
|
69
|
+
s.add_dependency(%q<jar_wrapper>, [">= 0"])
|
68
70
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
69
71
|
s.add_dependency(%q<zip>, [">= 0"])
|
72
|
+
s.add_dependency(%q<jar_wrapper>, [">= 0"])
|
70
73
|
end
|
71
74
|
end
|
72
75
|
|
metadata
CHANGED
@@ -1,106 +1,140 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: winstone
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.1
|
3
|
+
version: !ruby/object:Gem::Version
|
5
4
|
prerelease:
|
5
|
+
version: 0.3.2
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
- Alexander Shvets
|
7
|
+
authors:
|
8
|
+
- Alexander Shvets
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
12
|
+
|
13
|
+
date: 2011-09-23 00:00:00 -04:00
|
14
|
+
default_executable: winstone
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: jeweler
|
18
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
requirement: *id001
|
25
|
+
prerelease: false
|
26
|
+
type: :runtime
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: zip
|
29
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: "0"
|
35
|
+
requirement: *id002
|
36
|
+
prerelease: false
|
37
|
+
type: :runtime
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: jar_wrapper
|
40
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: "0"
|
46
|
+
requirement: *id003
|
47
|
+
prerelease: false
|
48
|
+
type: :runtime
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: jeweler
|
51
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: "0"
|
57
|
+
requirement: *id004
|
58
|
+
prerelease: false
|
59
|
+
type: :runtime
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: zip
|
62
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: "0"
|
68
|
+
requirement: *id005
|
69
|
+
prerelease: false
|
70
|
+
type: :runtime
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: jar_wrapper
|
73
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: "0"
|
79
|
+
requirement: *id006
|
80
|
+
prerelease: false
|
81
|
+
type: :runtime
|
58
82
|
description: Gem wrapper for winstone server.
|
59
83
|
email: alexander.shvets@gmail.com
|
60
|
-
executables:
|
61
|
-
- winstone
|
84
|
+
executables:
|
85
|
+
- winstone
|
62
86
|
extensions: []
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
-
|
68
|
-
-
|
69
|
-
-
|
70
|
-
-
|
71
|
-
- bin/
|
72
|
-
- bin/winstone
|
73
|
-
-
|
74
|
-
-
|
75
|
-
|
76
|
-
- lib/jar_wrapper/runner.rb
|
77
|
-
- winstone.gemspec
|
87
|
+
|
88
|
+
extra_rdoc_files:
|
89
|
+
- README
|
90
|
+
files:
|
91
|
+
- CHANGES
|
92
|
+
- README
|
93
|
+
- Rakefile
|
94
|
+
- VERSION
|
95
|
+
- bin/Gemfile
|
96
|
+
- bin/winstone
|
97
|
+
- bin/winstone.bat
|
98
|
+
- winstone.gemspec
|
99
|
+
has_rdoc: true
|
78
100
|
homepage: http://github.com/shvets/winstone
|
79
101
|
licenses: []
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
102
|
+
|
103
|
+
post_install_message: |
|
104
|
+
|
105
|
+
-------------------------------------------------------------------------------
|
106
|
+
|
107
|
+
Please now run:
|
108
|
+
|
109
|
+
$ winstone install
|
110
|
+
|
111
|
+
NB. This will download jars that this gem needs to run from the internet.
|
112
|
+
It will put them into ~/.winstone/assets.
|
113
|
+
|
114
|
+
-------------------------------------------------------------------------------
|
115
|
+
|
84
116
|
rdoc_options: []
|
85
|
-
|
86
|
-
|
87
|
-
|
117
|
+
|
118
|
+
require_paths:
|
119
|
+
- lib
|
120
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
121
|
none: false
|
89
|
-
requirements:
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: "0"
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
127
|
none: false
|
95
|
-
requirements:
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
requirements:
|
100
|
-
- none
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: "0"
|
132
|
+
requirements:
|
133
|
+
- none
|
101
134
|
rubyforge_project:
|
102
|
-
rubygems_version: 1.
|
135
|
+
rubygems_version: 1.5.1
|
103
136
|
signing_key:
|
104
137
|
specification_version: 3
|
105
138
|
summary: Gem wrapper for winstone server (Summary).
|
106
139
|
test_files: []
|
140
|
+
|
data/lib/jar_wrapper.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'rubygems' unless RUBY_VERSION =~ /1.9.*/
|
2
|
-
|
3
|
-
$:.unshift(File.dirname(__FILE__)) unless
|
4
|
-
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
5
|
-
|
6
|
-
require 'fileutils'
|
7
|
-
require 'net/http'
|
8
|
-
|
9
|
-
require 'jar_wrapper/jar_wrapper'
|
10
|
-
require 'jar_wrapper/runner'
|
11
|
-
require 'jar_wrapper/jvm_options_probe'
|
12
|
-
|
13
|
-
require 'rbconfig'
|
14
|
-
WINDOZE = Config::CONFIG['host_os'] =~ /mswin|mingw|windows/
|
15
|
-
|
16
|
-
WINDOZE ? (require "zip/zipfilesystem") : (require 'zip/zip')
|
@@ -1,74 +0,0 @@
|
|
1
|
-
require 'open-uri'
|
2
|
-
|
3
|
-
class JarWrapper
|
4
|
-
def download_file_to(uri, destination_file)
|
5
|
-
print " downloading #{uri}... "; $stdout.flush
|
6
|
-
|
7
|
-
temp = destination_file + ".part"
|
8
|
-
FileUtils.mkdir_p(File.dirname(destination_file))
|
9
|
-
|
10
|
-
File.open(temp, "wb") do |out_file|
|
11
|
-
open(uri) do |in_file|
|
12
|
-
done = false
|
13
|
-
|
14
|
-
while(!done) do
|
15
|
-
buffer = in_file.read(1024*1000)
|
16
|
-
out_file.write(buffer)
|
17
|
-
|
18
|
-
if buffer.nil? || buffer.size == 0
|
19
|
-
done = true
|
20
|
-
else
|
21
|
-
print("#"); $stdout.flush
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
if File.open(temp).read(200) =~ /Access Denied/
|
28
|
-
puts "\n\n*** Error downloading #{uri}, got Access Denied from S3."
|
29
|
-
FileUtils.rm_rf(temp)
|
30
|
-
exit
|
31
|
-
end
|
32
|
-
|
33
|
-
FileUtils.cp(temp, destination_file)
|
34
|
-
FileUtils.rm_rf(temp)
|
35
|
-
puts "\ndone!"
|
36
|
-
end
|
37
|
-
|
38
|
-
# unzip a .zip file into the directory it is located
|
39
|
-
def unzip_file(path)
|
40
|
-
print "unzipping #{path}..."; $stdout.flush
|
41
|
-
source = File.expand_path(path)
|
42
|
-
Dir.chdir(File.dirname(source)) do
|
43
|
-
Zip::ZipFile.open(source) do |zipfile|
|
44
|
-
zipfile.entries.each do |entry|
|
45
|
-
FileUtils.mkdir_p(File.dirname(entry.name))
|
46
|
-
begin
|
47
|
-
entry.extract
|
48
|
-
rescue Zip::ZipDestinationFileExistsError
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def install source, destination
|
56
|
-
download_file_to(source, destination)
|
57
|
-
|
58
|
-
unzip_file(destination) if destination =~ /\.zip$/
|
59
|
-
end
|
60
|
-
|
61
|
-
def run_jar name, jar_file, java_opts, args
|
62
|
-
runner = Runner.new
|
63
|
-
|
64
|
-
runner.run_jar name, jar_file, java_opts, args
|
65
|
-
end
|
66
|
-
|
67
|
-
def run_cp name, class_path, main_class, java_opts, args
|
68
|
-
runner = Runner.new
|
69
|
-
|
70
|
-
runner.run_cp name, class_path, main_class, java_opts, args
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'rbconfig'
|
2
|
-
|
3
|
-
require 'open3' unless Config::CONFIG['host_os'] =~ /mswin|mingw|windows/
|
4
|
-
|
5
|
-
class JvmOptionsProbe
|
6
|
-
|
7
|
-
def initialize
|
8
|
-
@d32 = @d64 = @client = false
|
9
|
-
|
10
|
-
if WINDOZE
|
11
|
-
@help = `java -h`
|
12
|
-
@d32 = (@help == `java -d32`) ? true : false
|
13
|
-
@d64 = (@help == `java -d64`) ? true : false
|
14
|
-
@client = (@help == `java -client`) ? true : false
|
15
|
-
else
|
16
|
-
@help = Open3.popen3("java -h")[2].readlines
|
17
|
-
@d32 = (@help == Open3.popen3("java -d32")[2].readlines) ? true : false
|
18
|
-
@d64 = (@help == Open3.popen3("java -d64")[2].readlines) ? true : false
|
19
|
-
@client = (@help == Open3.popen3("java -client")[2].readlines) ? true : false
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def can_use_d32?
|
24
|
-
@d32
|
25
|
-
end
|
26
|
-
|
27
|
-
def can_use_d64?
|
28
|
-
@d64
|
29
|
-
end
|
30
|
-
|
31
|
-
def can_use_client?
|
32
|
-
@client
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
data/lib/jar_wrapper/runner.rb
DELETED
@@ -1,134 +0,0 @@
|
|
1
|
-
|
2
|
-
class Runner
|
3
|
-
def run_jar name, jar_file, java_opts, args
|
4
|
-
@jar_file = jar_file
|
5
|
-
|
6
|
-
# forking = ARGV.include?("--fork") and ARGV.first != "install"
|
7
|
-
# no_runner = ARGV.include?("--no-sub-jruby")
|
8
|
-
# jruby = Config::CONFIG["RUBY_INSTALL_NAME"] == "jruby"
|
9
|
-
# osx = !(RUBY_PLATFORM =~/(windows|linux)/)
|
10
|
-
# begin
|
11
|
-
# if forking and not jruby
|
12
|
-
# # jRuby doesn't support fork() because of the runtime stuff...
|
13
|
-
# forking = false
|
14
|
-
# puts 'Forking failed, attempting to start anyway...' if (pid = fork) == -1
|
15
|
-
# exit unless pid.nil? # kill the parent process
|
16
|
-
#
|
17
|
-
# if pid.nil?
|
18
|
-
# # reopen the standard pipes to nothingness
|
19
|
-
# # STDIN.reopen Redcar.null_device
|
20
|
-
# # STDOUT.reopen Redcar.null_device, 'a'
|
21
|
-
# STDERR.reopen STDOUT
|
22
|
-
# end
|
23
|
-
# elsif forking and SPOON_AVAILABLE and ::Spoon.supported?
|
24
|
-
# # so we need to try something different...
|
25
|
-
#
|
26
|
-
# forking = false
|
27
|
-
# construct_command do |command|
|
28
|
-
# command.push('--silent')
|
29
|
-
# ::Spoon.spawnp(*command)
|
30
|
-
# end
|
31
|
-
# exit 0
|
32
|
-
# elsif forking
|
33
|
-
# raise NotImplementedError, "Something weird has happened. Please contact us."
|
34
|
-
# end
|
35
|
-
# rescue NotImplementedError
|
36
|
-
# puts $!.class.name + ": " + $!.message
|
37
|
-
# puts "Forking isn't supported on this system. Sorry."
|
38
|
-
# puts "Starting normally..."
|
39
|
-
# end
|
40
|
-
#
|
41
|
-
# return if no_runner
|
42
|
-
# return if jruby and not osx
|
43
|
-
|
44
|
-
construct_command(true, name, java_opts, args) do |command|
|
45
|
-
exec(command.join(" "))
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
|
50
|
-
def run_cp name, class_path, main_class, java_opts, args
|
51
|
-
@main_class = main_class
|
52
|
-
@class_path = class_path
|
53
|
-
|
54
|
-
construct_command(false, name, java_opts, args) do |command|
|
55
|
-
exec(command.join(" "))
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|
59
|
-
# Trade in this Ruby instance for a JRuby instance, loading in a
|
60
|
-
# starter script and passing it some arguments.
|
61
|
-
# If --jruby is passed, use the installed version of jruby, instead of
|
62
|
-
# our vendored jarred one (useful for gems).
|
63
|
-
def construct_command(exec_mode, name, java_opts=[], args="")
|
64
|
-
bin = File.expand_path(File.join(File.dirname(__FILE__), %w{.. .. bin #{name}}))
|
65
|
-
#ENV['RUBYOPT'] = nil # disable other native args
|
66
|
-
|
67
|
-
# Windows XP updates
|
68
|
-
|
69
|
-
# if RUBY_PLATFORM =~ /window/
|
70
|
-
# bin = "\"#{bin}\""
|
71
|
-
# jruby_complete = "\"#{jruby_complete}\""
|
72
|
-
# end
|
73
|
-
|
74
|
-
# unfortuanately, ruby doesn't support [a, *b, c]
|
75
|
-
command = ["java"]
|
76
|
-
command.push(*java_args)
|
77
|
-
|
78
|
-
command.push(*java_opts) if java_opts.length > 0
|
79
|
-
|
80
|
-
if exec_mode
|
81
|
-
command.push("-jar", @jar_file)
|
82
|
-
else
|
83
|
-
command.push("-cp", @class_path)
|
84
|
-
command.push(@main_class)
|
85
|
-
end
|
86
|
-
|
87
|
-
#command.push("-Djruby.memory.max=500m", "-Djruby.stack.max=1024k", "-cp", jruby_complete, "org.jruby.Main")
|
88
|
-
|
89
|
-
command.push "--debug" if debug_mode?
|
90
|
-
# command.push(bin)
|
91
|
-
# command.push(*cleaned_args)
|
92
|
-
# command.push("--no-sub-jruby", "--ignore-stdin")
|
93
|
-
command.push(*args)
|
94
|
-
|
95
|
-
puts command.join(' ')
|
96
|
-
yield command
|
97
|
-
end
|
98
|
-
|
99
|
-
# def cleaned_args
|
100
|
-
# # We should never pass --fork to a subprocess
|
101
|
-
# result = ARGV.find_all {|arg| arg != '--fork'}.map do |arg|
|
102
|
-
# if arg =~ /--(.+)=(.+)/
|
103
|
-
# "--" + $1 + "=\"" + $2 + "\""
|
104
|
-
# else
|
105
|
-
# arg
|
106
|
-
# end
|
107
|
-
# end
|
108
|
-
# result.delete("install")
|
109
|
-
# result
|
110
|
-
# end
|
111
|
-
|
112
|
-
def debug_mode?
|
113
|
-
ARGV.include?("--debug")
|
114
|
-
end
|
115
|
-
|
116
|
-
def java_args
|
117
|
-
str = []
|
118
|
-
if Config::CONFIG["host_os"] =~ /darwin/
|
119
|
-
str.push "-XstartOnFirstThread"
|
120
|
-
end
|
121
|
-
|
122
|
-
# if ARGV.include?("--load-timings")
|
123
|
-
# str.push "-Djruby.debug.loadService.timing=true"
|
124
|
-
# end
|
125
|
-
|
126
|
-
jvm_options_probe = JvmOptionsProbe.new
|
127
|
-
|
128
|
-
str.push "-d32" if jvm_options_probe.can_use_d32?
|
129
|
-
str.push "-client" if jvm_options_probe.can_use_client?
|
130
|
-
|
131
|
-
str
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|