glassfish 1.0.2-universal-java → 1.0.3.beta.1-universal-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.
@@ -1,3 +1,19 @@
1
+ == 1.0.3
2
+
3
+ Under new management.
4
+
5
+ Verified to be compatible with Rails 3.
6
+
7
+ Can be daemonized with JRuby 1.5+ (JRUBY-4752).
8
+
9
+ Daemon mode in Mac OS X.
10
+
11
+ Log level can be either an integer or the corresponding string.
12
+
13
+ == 1.0.2
14
+
15
+ Fix for regression caused in 1.0.1 in daemon mode.
16
+
1
17
  == 1.0.1
2
18
 
3
19
  This is a quick update to 1.0.0.
@@ -0,0 +1,157 @@
1
+ # Glassfish gem
2
+
3
+ ## Introduction
4
+
5
+ GlassFish gem is a lightweight and robust deployment solution for
6
+ Ruby on Rails applications deployed on JRuby runtime. It is based
7
+ on GlassFish v3 application server.
8
+
9
+ GlassFish v3 is a Java based application server that allows deployment,
10
+ administration and monitoring of JavaEE as well as dynamic languages based web
11
+ frameworks such as Ruby On Rails, Grails etc.
12
+
13
+ GlassFish gem is based on GlassFish v3 nucleus. GlassFish v3 nucleus is the core module of GlassFish v3.
14
+
15
+ For more information on GlassFish v3 application server see [GlassFish project page](https://glassfish.dev.java.net/).
16
+
17
+ ## Requirement
18
+ [JDK 6](http://java.sun.com/javase/downloads/index.jsp) is required.
19
+
20
+ ## Supported Rack-based frameworks
21
+
22
+ * Rails
23
+ * Merb
24
+ * Sinatra
25
+
26
+ ## Getting Started
27
+
28
+ 1. Install the gem:
29
+
30
+ gem install glassfish
31
+
32
+ 2. Run glassfish in the top directory of your Rails or Merb application:
33
+
34
+ a. `jruby -S glassfish`
35
+
36
+ b. For applications that use Bundler:
37
+
38
+ jruby -S bundle exec glassfish
39
+
40
+ ## Usage
41
+
42
+ GlassFish gem's `glassfish` command autodetects the application you trying to
43
+ run on it. Internally it uses Grizzly handler to plug into Rack interface of
44
+ the application frameworks such as Rails, Merb or Sinatra.
45
+
46
+ $ glassfish
47
+
48
+ That's all you need to run your application.
49
+
50
+ $ glassfish -h
51
+
52
+ To run your rackup script
53
+
54
+ $ rackup -s Glassfish
55
+
56
+ or
57
+ $ glassfish
58
+
59
+
60
+ ## Synopsis
61
+
62
+ glassfish: GlassFish v3 server for Rack based frameworks such as: Rails,
63
+ Merb, Sinatra...
64
+
65
+ Usage:
66
+ glassfish [OPTION] APPLICATION_PATH
67
+
68
+ -h, --help: show help
69
+
70
+ -c, --contextroot PATH: change the context root (default: '/')
71
+
72
+ -p, --port PORT: change server port (default: 3000)
73
+
74
+ -a, --address HOST: bind to HOST address (default: 0.0.0.0)
75
+
76
+ -e, --environment ENV: change rails environment (default: development)
77
+
78
+ -n --runtimes NUMBER: Number of JRuby runtimes to create initially
79
+
80
+ --runtimes-min NUMBER: Minimum JRuby runtimes to create
81
+
82
+ --runtimes-max NUMBER: Maximum number of JRuby runtimes to create
83
+
84
+ -d, --daemon: Run GlassFish as daemon. Currently works with
85
+ Linux and Solaris OS.
86
+
87
+ -P, --pid FILE: PID file where PID will be written. Applicable
88
+ when used with -d option. The default pid file
89
+ is tmp/pids/glassfish-<PID>.pid
90
+
91
+ -l, --log FILE: Log file, where the server log messages will go.
92
+ By default the server logs go to
93
+ log/development.log file. To see the logs on
94
+ console run with -l option without any argument.
95
+
96
+ --log-level LEVEL: Log level 0 to 7, or equivalent name as string.
97
+ Default is 3 (or INFO).
98
+ 0 (OFF), 1 (SEVERE), 2 (WARNING), 3 (INFO),
99
+ 4 (FINE), 5 (FINER), 6 (FINEST), 7 (ALL).
100
+
101
+ --config FILE: Configuration file location. Use glassfish.yml
102
+ as template. Generate it using 'gfrake config'
103
+ command.
104
+
105
+ APPLICATION_PATH (optional): Path to the application to be run (default:
106
+ current).
107
+
108
+ For further configuration, run GlassFish rake command 'gfrake -T'
109
+
110
+ ## Configuration
111
+
112
+ $ jruby -S gfrake -T
113
+
114
+ rake clean # Clean GlassFish generated temporary files (tmp/.glassfish)
115
+ rake config # Generate a configuration file to customize GlassFish gem
116
+ rake version # Display version of GlassFish gem
117
+
118
+ * Note: Although help screen shows `rake` command, you need to use `gfrake` instead.
119
+
120
+ * `gfrake config` will place `glassfish.yml` in the application's config directory.
121
+ `glassfish.yml` contains default options. Use it as template.
122
+ You can also use `--config` option with the `glassfish` command
123
+
124
+ ## Application auto-detection
125
+
126
+ Rails, Merb and Sinatra applications are detected automatically and configured appropriately.
127
+ You can provide a rack-up script `*.ru` in to the application directory to plug in any other framework.
128
+
129
+ Some key points:
130
+
131
+ * Rails version < 2.2 is single threaded, for improved scaling you can
132
+ configure the JRuby runtime pool using `--runtimes`, `--runtimes-min` or
133
+ `--runtimes-max` options.
134
+ * Multi-thread-safe execution (as introduced in Rails 2.2 or for Merb) is
135
+ detected and runtime pooling is disabled. You would still need to tell Rails
136
+ to enable multi-threading by commenting out the following line from
137
+ `config/environments/production.rb`.
138
+
139
+ `#config.threadsafe!`
140
+
141
+ Or you can simply call `config.threadsafe!` form any Rails initialization
142
+ script.
143
+
144
+ ## Known Issues
145
+
146
+ * Running `glassfish` in a directory that is neither a Rails or Merb
147
+ application does not report a meaningful error.
148
+ See [this issue](https://glassfish.dev.java.net/issues/show_bug.cgi?id=6744).
149
+
150
+
151
+ ## Source
152
+
153
+ This fork is available on [Github](http://github.com/BanzaiMan/glassfish-gem).
154
+
155
+ ## License
156
+
157
+ GlassFish v3 gem is provided with [CDDL 1.0 and GPL 2.0 dual license](https://glassfish.dev.java.net/public/CDDL+GPL.html).
data/bin/gfrake CHANGED
@@ -1,3 +1,5 @@
1
+ #! /usr/bin/env jruby
2
+
1
3
  #--
2
4
  #DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
5
  #
@@ -1,56 +1,60 @@
1
- # == Synopsis
2
- #
3
- # glassfish: GlassFish v3 server for Rack based frameworks such as: Rails, Merb, Sinatra...
4
- #
5
- # == Usage:
6
- #
7
- # glassfish [OPTION] APPLICATION_PATH
8
- #
9
- # -h, --help::
10
- # show help
11
- #
12
- # -c, --contextroot PATH::
13
- # change the context root (default: '/')
14
- #
15
- # -p, --port PORT::
16
- # change server port (default: 3000)
17
- #
18
- # -a, --address HOST::
19
- # bind to HOST address (default: 0.0.0.0)
20
- #
21
- # -e, --environment ENV::
22
- # change rails environment (default: development)
23
- #
24
- # -n --runtimes NUMBER::
25
- # Number of JRuby runtimes to create initially
26
- #
27
- # --runtimes-min NUMBER::
28
- # Minimum JRuby runtimes to create
29
- #
30
- # --runtimes-max NUMBER::
31
- # Maximum number of JRuby runtimes to create
32
- #
33
- # -d, --daemon::
34
- # Run GlassFish as daemon. Currently works with Linux and Solaris OS.
35
- #
36
- # -P, --pid FILE::
37
- # PID file where PID will be written. Applicable when used with -d option. The default pid file is tmp/pids/glassfish-<PID>.pid
38
- #
39
- # -l, --log FILE::
40
- # Log file, where the server log messages will go. By default the server logs go to log/development.log file. To see the logs on console run with -l option without any argument.
41
- #
42
- # --log-level LEVEL::
43
- # Log level 0 to 7. 0:OFF, 1:SEVERE, 2:WARNING, 3:INFO (default), 4:FINE, 5:FINER, 6:FINEST, 7:ALL.
44
- #
45
- # --config FILE::
46
- # Configuration file location. Use glassfish.yml as template. Generate it using 'gfrake config' command.
47
- #
48
- # APPLICATION_PATH (optional): Path to the application to be run (default: current).
49
- #
50
- # For further configuration, run GlassFish rake command 'gfrake -T'
1
+ #! /usr/bin/env jruby
51
2
 
52
- require 'glassfish'
3
+ # == Synopsis
4
+ #
5
+ # glassfish: GlassFish v3 server for Rack based frameworks such as: Rails, Merb, Sinatra...
6
+ #
7
+ # == Usage:
8
+ #
9
+ # glassfish [OPTION] APPLICATION_PATH
10
+ #
11
+ # -h, --help::
12
+ # show help
13
+ #
14
+ # -c, --contextroot PATH::
15
+ # change the context root (default: '/')
16
+ #
17
+ # -p, --port PORT::
18
+ # change server port (default: 3000)
19
+ #
20
+ # -a, --address HOST::
21
+ # bind to HOST address (default: 0.0.0.0)
22
+ #
23
+ # -e, --environment ENV::
24
+ # change rails environment (default: development)
25
+ #
26
+ # -n --runtimes NUMBER::
27
+ # Number of JRuby runtimes to create initially
28
+ #
29
+ # --runtimes-min NUMBER::
30
+ # Minimum JRuby runtimes to create
31
+ #
32
+ # --runtimes-max NUMBER::
33
+ # Maximum number of JRuby runtimes to create
34
+ #
35
+ # -d, --daemon::
36
+ # Run GlassFish as daemon. Currently works with Linux and Solaris OS.
37
+ #
38
+ # -P, --pid FILE::
39
+ # PID file where PID will be written. Applicable when used with -d option. The default pid file is tmp/pids/glassfish-<PID>.pid
40
+ #
41
+ # -l, --log FILE::
42
+ # Log file, where the server log messages will go. By default the server logs go to log/development.log file. To see the logs on console run with -l option without any argument.
43
+ #
44
+ # --log-level LEVEL::
45
+ # Log level 0 to 7, or equivalent name as string. Default is 3 (or INFO). 0 (OFF), 1 (SEVERE), 2 (WARNING), 3 (INFO), 4 (FINE), 5 (FINER), 6 (FINEST), 7 (ALL).
46
+ #
47
+ # --config FILE::
48
+ # Configuration file location. Use glassfish.yml as template. Generate it using 'gfrake config' command.
49
+ #
50
+ # APPLICATION_PATH (optional): Path to the application to be run (default: current).
51
+ #
52
+ # For further configuration, run GlassFish rake command 'gfrake -T'
53
53
 
54
- options = GlassFish::CommandLineParser.new.parse
55
- GlassFish::Server.start options
54
+ require 'glassfish'
56
55
 
56
+ options = GlassFish::CommandLineParser.new.parse
57
+
58
+ ENV['RAILS_ENV'] = options[:environment]
59
+
60
+ GlassFish::Server.start options
@@ -71,7 +71,7 @@ log:
71
71
 
72
72
  # Logging level. Log level 0 to 7. 0:OFF, 1:SEVERE, 2:WARNING,
73
73
  # 3:INFO (default), 4:FINE, 5:FINER, 6:FINEST, 7:ALL.
74
- log-level: 3
74
+ log-level: info
75
75
 
76
76
  #
77
77
  # Runtime configuration
@@ -129,8 +129,4 @@ daemon:
129
129
  # JVM ergonomics document,
130
130
  # http://java.sun.com/javase/6/docs/technotes/guides/vm/gc-ergonomics.html
131
131
  #
132
- #jvm-options: -server -Xmx2500m -Xms64m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:NewRatio=2 -XX:+DisableExplicitGC -Dhk2.file.directory.changeIntervalTimer=6000
133
-
134
-
135
-
136
-
132
+ #jvm-options: -server -Xmx2500m -Xms64m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:NewRatio=2 -XX:+DisableExplicitGC -Dhk2.file.directory.changeIntervalTimer=6000
@@ -34,7 +34,8 @@
34
34
  #holder.
35
35
  #++
36
36
 
37
- require 'admin-cli.jar'
37
+ require File.join(File.dirname(__FILE__), 'java', 'glassfish-embedded-nucleus')
38
+ require File.join(File.dirname(__FILE__), 'java', 'admin-cli.jar')
38
39
  require 'java'
39
40
 
40
41
  #
@@ -43,7 +44,7 @@ require 'java'
43
44
  #
44
45
  module GlassFish
45
46
  class ASAdmin
46
- import com.sun.enterprise.admin.cli.AsadminMain
47
+ java_import com.sun.enterprise.admin.cli.AsadminMain
47
48
  AsadminMain.main(ARGV.to_java :String)
48
49
  end
49
50
  end
@@ -34,11 +34,14 @@
34
34
  #holder.
35
35
  #++
36
36
 
37
+ $LOAD_PATH << "#{File.dirname(__FILE__)}/../lib/java"
38
+
37
39
  require 'rdoc_usage'
38
40
  require 'getoptlong'
39
41
  require 'pathname'
40
42
  require 'config'
41
43
  require 'java'
44
+ require 'glassfish-gem.jar'
42
45
 
43
46
  #
44
47
  # Parses command line options
@@ -106,7 +109,11 @@ module GlassFish
106
109
  config[:log] = File.expand_path arg
107
110
  end
108
111
  when '--log-level'
109
- config[:log_level] = arg.to_i
112
+ if arg =~ /^[0-7]$/
113
+ config[:log_level] = arg.to_i
114
+ else
115
+ config[:log_level] = org.glassfish.scripting.gem.Options::LogLevel.value_of(arg.to_s.upcase).ordinal
116
+ end
110
117
  when '--config'
111
118
  config_file = arg
112
119
  end
@@ -159,7 +166,12 @@ module GlassFish
159
166
  end
160
167
 
161
168
  val = arg['log-level']
162
- config[:log_level] = val.to_i unless val.nil?
169
+ puts "arg['log-level']: #{arg['log-level']}"
170
+ if val.to_s =~ /^[0-7]$/
171
+ config[:log_level] = val.to_i
172
+ else
173
+ config[:log_level] = org.glassfish.scripting.gem.Options::LogLevel.value_of(val.to_s.upcase).ordinal
174
+ end
163
175
  when 'jruby-runtime-pool'
164
176
  config[:runtimes] = arg['initial'] unless arg['initial'].nil?
165
177
  config[:runtimes_min] = arg['min'] unless arg['min'].nil?
@@ -36,7 +36,8 @@
36
36
 
37
37
  require 'java'
38
38
  require 'yaml'
39
- require 'ftools'
39
+ require 'fileutils'
40
+ require 'rake'
40
41
  require 'socket'
41
42
 
42
43
  module GlassFish
@@ -83,11 +84,8 @@ module GlassFish
83
84
  if(config[:daemon])
84
85
  os = java.lang.System.getProperty("os.name").downcase
85
86
  version = java.lang.System.getProperty("os.version")
86
- #check the platform, Currently daemon mode works only on linux and
87
- #solaris
88
- if(!os.include?("linux") and !os.include?("sunos"))
89
- Config.fail "You are running on #{java.lang.System.getProperty("os.name")} #{version}. Currently daemon mode only works on Linux or Solaris platforms!"
90
- end
87
+
88
+ validate_os_for_daemon_support(os)
91
89
 
92
90
  # In daemon mode you can't log to console. Let's fail and let user spcifiy the log file explicitly
93
91
  if(config[:log_console])
@@ -105,6 +103,10 @@ module GlassFish
105
103
  Config.absolutize config[:app_dir], config[:pid]
106
104
  end
107
105
 
106
+ unless dir_has_app? config[:app_dir]
107
+ raise RuntimeError, "#{config[:app_dir]} does not contain supported application"
108
+ end
109
+
108
110
  # log_level
109
111
  if not (0..7).include?(config[:log_level])
110
112
  STDERR.puts "Invalid log level #{config[:log_level]}. Chose a number between 0 to 7."
@@ -116,25 +118,7 @@ module GlassFish
116
118
  config[:runtimes_max] = config[:runtimes]
117
119
  end
118
120
 
119
- # JRuby runtime
120
- runtimes_err = " Invalid runtime configuration, initial:#{config[:runtimes]}, min:#{config[:runtimes_min]}, max:#{config[:runtimes_max]}."
121
- err = false
122
- if(config[:runtimes] < 1 || config[:runtimes] > config[:runtimes_max] || config[:runtimes] < config[:runtimes_min])
123
- err = true;
124
- runtimes_err += "\n\tinitial runtime must be > 0, <= runtimes-max and >= runtimes-min."
125
- end
126
- if(config[:runtimes_min] < 1 || config[:runtimes_min] > config[:runtimes] || config[:runtimes_min] > config[:runtimes_max])
127
- err = true;
128
- runtimes_err += "\n\truntimes-min must be > 0, <=runtimes-max and <= initial_runtmes"
129
- end
130
- if(config[:runtimes_max] < 1 || config[:runtimes_max] < config[:runtimes_min] || config[:runtimes_max] < config[:runtimes])
131
- err=true
132
- runtimes_err += "\n\truntimes-max must be > 0, >=runtimes-min and >= initial_runtmes"
133
- end
134
- if(err)
135
- Config.fail runtimes_err
136
- end
137
-
121
+ validate_runtimes_params(config)
138
122
 
139
123
  # contextroot
140
124
  # There is not much to validate here. For now we leave it as it is
@@ -198,13 +182,13 @@ module GlassFish
198
182
  def check_domain_dir?(domain_dir)
199
183
  #create Glassfish domain directory if it does not exist
200
184
  unless File.exist? domain_dir
201
- File.makedirs(domain_dir)
185
+ FileUtils.mkdir_p(domain_dir)
202
186
  return true
203
187
  end
204
188
 
205
189
  config_dir = File.join(domain_dir, "config")
206
190
  unless File.exist? config_dir
207
- File.makedirs(config_dir)
191
+ FileUtils.mkdir_p(config_dir)
208
192
  return true
209
193
  end
210
194
 
@@ -220,5 +204,80 @@ module GlassFish
220
204
  end
221
205
  true
222
206
  end
207
+
208
+ def validate_os_for_daemon_support(os)
209
+ #check the platform, Currently daemon mode works only on linux, solaris and Mac OS X.
210
+ if(!os.include?("linux") and !os.include?("sunos") and !os.include?("mac os x"))
211
+ Config.fail "You are running on #{java.lang.System.getProperty("os.name")} #{version}. Currently daemon mode only works on Linux, Solaris or Mac OS X platform."
212
+ end
213
+
214
+ end
215
+
216
+ def validate_runtimes_params(config)
217
+ # JRuby runtime
218
+ runtimes_err = " Invalid runtime configuration, initial:#{config[:runtimes]}, min:#{config[:runtimes_min]}, max:#{config[:runtimes_max]}."
219
+ err = false
220
+ if(config[:runtimes] < 1 || config[:runtimes] > config[:runtimes_max] || config[:runtimes] < config[:runtimes_min])
221
+ err = true;
222
+ runtimes_err += "\n\tinitial runtime must be > 0, <= runtimes-max and >= runtimes-min."
223
+ end
224
+ if(config[:runtimes_min] < 1 || config[:runtimes_min] > config[:runtimes] || config[:runtimes_min] > config[:runtimes_max])
225
+ err = true;
226
+ runtimes_err += "\n\truntimes-min must be > 0, <=runtimes-max and <= initial_runtmes"
227
+ end
228
+ if(config[:runtimes_max] < 1 || config[:runtimes_max] < config[:runtimes_min] || config[:runtimes_max] < config[:runtimes])
229
+ err=true
230
+ runtimes_err += "\n\truntimes-max must be > 0, >=runtimes-min and >= initial_runtmes"
231
+ end
232
+ if(err)
233
+ Config.fail runtimes_err
234
+ end
235
+
236
+ end
237
+
238
+ def dir_has_app?(dir)
239
+ if ! File.directory?(dir)
240
+ return false
241
+ end
242
+
243
+ return dir_has_rails?(dir) || dir_has_merb?(dir) || dir_has_rack?(dir)
244
+ end
245
+
246
+ def dir_has_rails?(dir)
247
+ Dir.chdir(dir) do
248
+ app = Rake.application = RakeApp.new
249
+ app.load_rake_file
250
+ return false unless task = app.lookup("environment")
251
+ end
252
+ true
253
+ end
254
+
255
+ def dir_has_merb?(dir)
256
+ Dir.chdir(dir) do
257
+ app = Rake.application = RakeApp.new
258
+ app.load_rake_file
259
+ return false unless task = app.lookup("merb_env")
260
+ end
261
+ true
262
+ end
263
+
264
+ def dir_has_rack?(dir)
265
+ Dir.chdir(dir) do
266
+ return false unless File.exist?('config.ru') || ! Dir['*/config.ru'].empty?
267
+ end
268
+ true
269
+ end
270
+
271
+ class RakeApp < Rake::Application
272
+ def load_rake_file
273
+ Rake::Application::DEFAULT_RAKEFILES.each do |rf|
274
+ if File.exist? rf
275
+ load rf
276
+ break
277
+ end
278
+ end
279
+ end
280
+ end
281
+
223
282
  end
224
283
  end
Binary file
Binary file
Binary file
@@ -1,8 +1,12 @@
1
1
  module Rails
2
- class Configuration
2
+ class Configuration
3
3
  def threadsafe?
4
4
  if(Rails::Configuration.instance_methods.include?'threadsafe!')
5
- preload_frameworks && cache_classes && !dependency_loading && action_controller.allow_concurrency
5
+ if(Rails::Configuration.instance_methods.include?'preload_frameworks')
6
+ preload_frameworks && cache_classes && !dependency_loading && action_controller.allow_concurrency
7
+ else
8
+ cache_classes && !dependency_loading && action_controller.allow_concurrency
9
+ end
6
10
  else
7
11
  false
8
12
  end
@@ -0,0 +1 @@
1
+ # empty file to suppress warning when we 'require "asadmin"'.
@@ -45,14 +45,15 @@ require 'java'
45
45
  require 'glassfish-gem.jar'
46
46
  require 'akuma.jar'
47
47
  require 'yaml'
48
- require 'ftools'
48
+ require 'fileutils'
49
49
  require 'version'
50
50
  require 'config'
51
51
 
52
52
  module GlassFish
53
53
  class Server
54
- import "org.glassfish.scripting.gem.GlassFishMain"
55
- import "org.glassfish.scripting.gem.Options"
54
+ java_import "org.glassfish.scripting.gem.GlassFishMain"
55
+ java_import "org.glassfish.scripting.gem.Options"
56
+ java_import "com.sun.akuma.CLibrary"
56
57
 
57
58
  java.lang.System.setProperty("addtional.load.path", "#{File.dirname(__FILE__)}/../lib")
58
59
 
@@ -61,14 +62,14 @@ module GlassFish
61
62
  def initialize(args, &block)
62
63
 
63
64
  unless args[:log_level].nil?
64
- if args[:log_level] > 4
65
+ if args[:log_level] > Options::LogLevel::FINE.ordinal
65
66
  puts "Arguments: "
66
67
  args.each do |k, v|
67
68
  puts "\t#{k}=>#{v}"
68
69
  end
69
70
  end
70
71
 
71
- if args[:log_level] > 3
72
+ if args[:log_level] > Options::LogLevel::INFO.ordinal
72
73
  debug = true
73
74
  end
74
75
 
@@ -90,10 +91,9 @@ module GlassFish
90
91
  @opts.log = args[:log]
91
92
  @opts.log_console = args[:log_console]
92
93
  @opts.domainDir = args[:domain_dir]
93
- @opts.log_level = args[:log_level]
94
+ @opts.log_level = Options::LogLevel.values()[args[:log_level]]
94
95
  @opts.jvm_opts = args[:jvm_options]
95
-
96
-
96
+
97
97
  unless args[:grizzly_config].nil?
98
98
  args[:grizzly_config].each do |key, val|
99
99
  case key
@@ -127,7 +127,7 @@ module GlassFish
127
127
  end
128
128
 
129
129
  #Create the app using Rack builder
130
- if(block)
130
+ if block_given?
131
131
  app = Rack::Builder.new(&block).to_app
132
132
  app = Rack::CommonLogger.new(@app) if debug
133
133
  if app.nil?
@@ -147,6 +147,9 @@ module GlassFish
147
147
  end
148
148
 
149
149
  def start
150
+ ENV.each do |k,v|
151
+ CLibrary::LIBC.setenv(k, v)
152
+ end
150
153
  GlassFishMain.start @opts
151
154
  end
152
155
  alias :start! :start
@@ -35,6 +35,6 @@
35
35
  #++
36
36
 
37
37
  module GlassFish
38
- VERSION = "1.0.2"
38
+ VERSION = "1.0.3.dev"
39
39
  FULLVERSION = "GlassFish gem version: #{VERSION}\nhttp://glassfishgem.rubyforge.org"
40
40
  end
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glassfish
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3.beta.1
5
5
  platform: universal-java
6
6
  authors:
7
+ - Hirotsugu Asari
7
8
  - Vivek Pandey
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
12
 
12
- date: 2009-12-22 00:00:00 -08:00
13
+ date: 2010-12-07 00:00:00 -05:00
13
14
  default_executable: glassfish
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
@@ -25,16 +26,16 @@ dependencies:
25
26
  description: |-
26
27
  GlassFish gem is an embedded GlassFish V3 application server which
27
28
  would help run your Ruby on Rails application
28
- email: vivek.pandey@sun.com
29
+ email:
30
+ - asari.ruby@gmail.com
31
+ - vivek.pandey@sun.com
29
32
  executables:
30
33
  - glassfish
31
34
  - gfrake
32
35
  extensions: []
33
36
 
34
- extra_rdoc_files:
35
- - README.txt
36
- - History.txt
37
- - LICENSE.txt
37
+ extra_rdoc_files: []
38
+
38
39
  files:
39
40
  - bin/gfrake
40
41
  - bin/glassfish
@@ -52,18 +53,20 @@ files:
52
53
  - lib/java/glassfish-gem.jar
53
54
  - lib/java/grizzly-jruby-module.jar
54
55
  - lib/java/grizzly-jruby.jar
56
+ - lib/java/jna.jar
55
57
  - lib/jruby/rails_path.rb
56
58
  - lib/jruby/rack/grizzly_helper.rb
57
59
  - lib/jruby/rack/merb.rb
58
60
  - lib/jruby/rack/rackup.rb
59
61
  - lib/jruby/rack/rails.rb
60
62
  - lib/jruby/rack/sinatra.rb
63
+ - lib/lib/asadmin/default.rb
61
64
  - lib/rack/adapter/merb.rb
62
65
  - lib/rack/adapter/rails.rb
63
66
  - lib/rack/handler/glassfish.rb
64
67
  - lib/rack/handler/grizzly.rb
65
68
  - generators/gfrake/templates/glassfish.yml
66
- - README.txt
69
+ - README.md
67
70
  - History.txt
68
71
  - LICENSE.txt
69
72
  has_rdoc: true
@@ -83,9 +86,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
83
86
  version:
84
87
  required_rubygems_version: !ruby/object:Gem::Requirement
85
88
  requirements:
86
- - - ">="
89
+ - - ">"
87
90
  - !ruby/object:Gem::Version
88
- version: "0"
91
+ version: 1.3.1
89
92
  version:
90
93
  requirements: []
91
94
 
data/README.txt DELETED
@@ -1,148 +0,0 @@
1
- = GlassFish v3 server for Rack based web frameworks (Rails, Merb, ...)
2
-
3
- GlassFish gem is a lightweight and robust deployment solution for
4
- Ruby on Rails applications deployed on JRuby runtime. It is based
5
- on GlassFish v3 application server.
6
-
7
- GlassFish v3 is a Java based application server that allows deployment,
8
- administration and monitoring of JavaEE as well as dynamic languages based web
9
- frameworks such as Ruby On Rails, Grails etc.
10
-
11
- GlassFish gem is based on GlassFish v3 nucleus. GlassFish v3 nucleus is the core module of GlassFish v3.
12
-
13
- For more information on GlassFish v3 application server see GlassFish project page[https://glassfish.dev.java.net/].
14
-
15
- == Requires JDK 6
16
- Get JDK 6 from here[http://java.sun.com/javase/downloads/index.jsp]
17
-
18
- == Supported Rack based frameworks
19
-
20
- * Rails
21
- * Merb
22
- * Sinatra
23
-
24
- === Getting Started
25
-
26
- 1. Install the gem: <tt>gem install glassfish</tt>.
27
- 2. Run glassfish in the top directory of your Rails or Merb application:
28
-
29
- $glassfish
30
-
31
- === Usage
32
-
33
- GlassFish gem's +glassfish+ command autodetects the application you trying to
34
- run on it. Internally it uses Grizzly handler to plugin to Rack interface of
35
- the application frameworks such as Rails, Merb or Sinatra.
36
-
37
- $ glassfish
38
-
39
- That's all you need to run your application.
40
-
41
- $glassfish -h
42
-
43
- To run your rackup script
44
-
45
- $ rackup -s Glassfish
46
-
47
- or
48
- $ glassfish
49
-
50
-
51
- ===Synopsis
52
-
53
- glassfish: GlassFish v3 server for Rack based frameworks such as: Rails,
54
- Merb, Sinatra...
55
-
56
- ===Usage:
57
-
58
- glassfish [OPTION] APPLICATION_PATH
59
-
60
- -h, --help: show help
61
-
62
- -c, --contextroot PATH: change the context root (default: '/')
63
-
64
- -p, --port PORT: change server port (default: 3000)
65
-
66
- -a, --address HOST: bind to HOST address (default: 0.0.0.0)
67
-
68
- -e, --environment ENV: change rails environment (default: development)
69
-
70
- -n --runtimes NUMBER: Number of JRuby runtimes to create initially
71
-
72
- --runtimes-min NUMBER: Minimum JRuby runtimes to create
73
-
74
- --runtimes-max NUMBER: Maximum number of JRuby runtimes to create
75
-
76
- -d, --daemon: Run GlassFish as daemon. Currently works with
77
- Linux and Solaris OS.
78
-
79
- -P, --pid FILE: PID file where PID will be written. Applicable
80
- when used with -d option. The default pid file
81
- is tmp/pids/glassfish-<PID>.pid
82
-
83
- -l, --log FILE: Log file, where the server log messages will go.
84
- By default the server logs go to
85
- log/development.log file. To see the logs on
86
- console run with -l option without any argument.
87
-
88
- --log-level LEVEL: Log level 0 to 7. 0:OFF, 1:SEVERE, 2:WARNING,
89
- 3:INFO (default), 4:FINE, 5:FINER, 6:FINEST,
90
- 7:ALL.
91
-
92
- --config FILE: Configuration file location. Use glassfish.yml
93
- as template. Generate it using 'gfrake config'
94
- command.
95
-
96
- APPLICATION_PATH (optional): Path to the application to be run (default:
97
- current).
98
-
99
- For further configuration, run GlassFish rake command 'gfrake -T'
100
-
101
- ===Configuration
102
-
103
- $gfrake -T
104
-
105
- rake clean # Clean GlassFish generated temporary files (tmp/.glassfish)
106
- rake config # Generate a configuration file to customize GlassFish gem
107
- rake version # Display version of GlassFish gem
108
-
109
- <b>Note:</b> Although help screen shows rake command. You need to use gfrake instead.
110
-
111
- * <tt>gfrake config</tt> will place <b>glassfish.yml</b> in the application's config directory. <b>glassfish.yml</b> contains default options. Use it as template. You can also use <tt>--config</tt> option with the <tt>glassfish</tt> command
112
-
113
- === Application auto-detection
114
-
115
- Rails, Merb and Sinatra applications are detected automatically and configured appropriately. You can provide a rack-up script <tt>*.ru</tt> in to the application directory to plugin any other framework.
116
-
117
- Some key points:
118
-
119
- * Rails version < 2.2 is single threaded, for improved scaling you can
120
- configure the JRuby runtime pool using <tt>--runtimes, --runtimes-min or
121
- --runtimes-max</tt> options.
122
- * Multi-thread-safe execution (as introduced in Rails 2.2 or for Merb) is
123
- detected and runtime pooling is disabled. You would still need to tell Rails
124
- to enable multi-threading by commenting out the following line from
125
- <tt>config/environments/production.rb</tt>.
126
-
127
- <tt>#config.threadsafe!</tt>
128
-
129
- Or you can simply call config.threadsafe! form any Rails initialization
130
- script.
131
-
132
- === Known Issues
133
-
134
- * Running <tt>glassfish</tt> in a directory that is neither a Rails or Merb
135
- application does not report a meaningful error.
136
- See this issue[https://glassfish.dev.java.net/issues/show_bug.cgi?id=6744]
137
-
138
-
139
- === Source
140
-
141
- You can get the GlassFish source using svn, in any of the following ways:
142
-
143
- <tt>svn co https://svn.dev.java.net/svn/glassfish-scripting/trunk/rails/gem</tt>
144
-
145
- === License
146
-
147
- GlassFish v3 gem is provided with CDDL 1.0 and GPL 2.0 dual license. For
148
- details see https://glassfish.dev.java.net/public/CDDL+GPL.html.