winstone 0.2.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.1
@@ -13,6 +13,7 @@ class WinstoneStarter
13
13
  winstone install - installs winstone
14
14
  winstone <server-params> - runs the winstone server
15
15
  winstone lite <server-params> - runs winstone (lite) server
16
+ winstone tool <tool-params> - runs winstone tool
16
17
  TEXT
17
18
 
18
19
  def initialize
@@ -32,7 +33,9 @@ class WinstoneStarter
32
33
  jar_file1 = install_dir + "/winstone-#{verion}.jar"
33
34
  jar_file2 = install_dir + "/winstone-lite-#{verion}.jar"
34
35
 
35
- case ARGV.shift
36
+ param = ARGV.length == 0 ? "" : ARGV.first
37
+
38
+ case param
36
39
  when /(-v)|(--version)/ then
37
40
  puts "Version: #{File.open(File::dirname(__FILE__) + "/../VERSION").readlines().first}"
38
41
  when 'install' then
@@ -42,9 +45,14 @@ class WinstoneStarter
42
45
  when 'help' then
43
46
  puts USAGE and return
44
47
  when 'lite' then
45
- @wrapper.run 'winstone', jar_file2, ["-Xmx1024m", "-Xss1024k" ], ARGV
48
+ @wrapper.run_jar 'winstone', jar_file2, ["-Xmx1024m", "-Xss1024k" ], ARGV
49
+ when 'tool' then
50
+ ARGV.shift
51
+ main_class = ARGV.shift
52
+ class_path = jar_file1
53
+ @wrapper.run_cp 'winstone', class_path, main_class, ["-Xmx1024m", "-Xss1024k" ], ARGV
46
54
  else
47
- @wrapper.run 'winstone', jar_file1, ["-Xmx1024m", "-Xss1024k" ], ARGV
55
+ @wrapper.run_jar 'winstone', jar_file1, ["-Xmx1024m", "-Xss1024k" ], ARGV
48
56
  end
49
57
  end
50
58
  end
@@ -58,11 +58,17 @@ class JarWrapper
58
58
  unzip_file(destination) if destination =~ /\.zip$/
59
59
  end
60
60
 
61
- def run name, jar_file, java_opts, args
61
+ def run_jar name, jar_file, java_opts, args
62
62
  runner = Runner.new
63
63
 
64
- runner.run name, jar_file, java_opts, args
64
+ runner.run_jar name, jar_file, java_opts, args
65
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
66
72
  end
67
73
 
68
74
 
@@ -1,6 +1,6 @@
1
1
 
2
2
  class Runner
3
- def run name, jar_file, java_opts, args
3
+ def run_jar name, jar_file, java_opts, args
4
4
  @jar_file = jar_file
5
5
 
6
6
  # forking = ARGV.include?("--fork") and ARGV.first != "install"
@@ -41,19 +41,28 @@
41
41
  # return if no_runner
42
42
  # return if jruby and not osx
43
43
 
44
- construct_command(name, java_opts, args) do |command|
44
+ construct_command(true, name, java_opts, args) do |command|
45
45
  exec(command.join(" "))
46
46
  end
47
47
 
48
48
  end
49
-
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
50
59
  # Trade in this Ruby instance for a JRuby instance, loading in a
51
60
  # starter script and passing it some arguments.
52
61
  # If --jruby is passed, use the installed version of jruby, instead of
53
62
  # our vendored jarred one (useful for gems).
54
- def construct_command(name, java_opts=[], args="")
63
+ def construct_command(exec_mode, name, java_opts=[], args="")
55
64
  bin = File.expand_path(File.join(File.dirname(__FILE__), %w{.. .. bin #{name}}))
56
- ENV['RUBYOPT'] = nil # disable other native args
65
+ #ENV['RUBYOPT'] = nil # disable other native args
57
66
 
58
67
  # Windows XP updates
59
68
 
@@ -67,7 +76,14 @@
67
76
  command.push(*java_args)
68
77
 
69
78
  command.push(*java_opts) if java_opts.length > 0
70
- command.push("-jar", @jar_file)
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
+
71
87
  #command.push("-Djruby.memory.max=500m", "-Djruby.stack.max=1024k", "-cp", jruby_complete, "org.jruby.Main")
72
88
 
73
89
  command.push "--debug" if debug_mode?
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{winstone}
8
- s.version = "0.2.0"
8
+ s.version = "0.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Alexander Shvets}]
12
- s.date = %q{2011-09-22}
12
+ s.date = %q{2011-09-23}
13
13
  s.description = %q{Gem wrapper for winstone server.}
14
14
  s.email = %q{alexander.shvets@gmail.com}
15
15
  s.executables = [%q{winstone}]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: winstone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-22 00:00:00.000000000Z
12
+ date: 2011-09-23 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jeweler
16
- requirement: &2156205460 !ruby/object:Gem::Requirement
16
+ requirement: &2153166760 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2156205460
24
+ version_requirements: *2153166760
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: zip
27
- requirement: &2156204120 !ruby/object:Gem::Requirement
27
+ requirement: &2153166040 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2156204120
35
+ version_requirements: *2153166040
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: jeweler
38
- requirement: &2156202340 !ruby/object:Gem::Requirement
38
+ requirement: &2153165260 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2156202340
46
+ version_requirements: *2153165260
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: zip
49
- requirement: &2156200720 !ruby/object:Gem::Requirement
49
+ requirement: &2153164420 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2156200720
57
+ version_requirements: *2153164420
58
58
  description: Gem wrapper for winstone server.
59
59
  email: alexander.shvets@gmail.com
60
60
  executables: