trinidad 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/lib/rack/handler/trinidad.rb +24 -14
- data/lib/trinidad.rb +1 -1
- metadata +4 -4
data/History.txt
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'trinidad'
|
2
|
-
|
3
1
|
require 'rack/handler'
|
4
2
|
require 'rack/handler/servlet'
|
5
3
|
|
@@ -7,19 +5,9 @@ module Rack
|
|
7
5
|
module Handler
|
8
6
|
class Trinidad < Rack::Handler::Servlet
|
9
7
|
def self.run(app, options={})
|
10
|
-
|
11
|
-
opts = {}
|
12
|
-
options.each {|k, v| opts[k.to_s.downcase.to_sym] = v}
|
13
|
-
|
14
|
-
threads = (opts[:threads] || '1:1').split(':')
|
15
|
-
opts[:app] = app
|
16
|
-
opts[:port] ||= 3000
|
17
|
-
opts[:address] = opts[:host] || 'localhost'
|
18
|
-
opts[:jruby_min_runtimes], opts[:jruby_max_runtimes] = threads[0].to_i, threads[1].to_i
|
8
|
+
opts = parse_options(options)
|
19
9
|
|
20
|
-
|
21
|
-
dispatcher = org.jruby.rack.embed.Dispatcher.new(context, self.new(app))
|
22
|
-
servlet = org.jruby.rack.embed.Servlet.new(dispatcher, context)
|
10
|
+
servlet = create_servlet(app)
|
23
11
|
|
24
12
|
opts[:servlet] = {:instance => servlet, :name => 'RackServlet'}
|
25
13
|
|
@@ -34,6 +22,28 @@ module Rack
|
|
34
22
|
"Threads=MIN:MAX" => "min:max threads to use (default 1:1, threadsafe)",
|
35
23
|
}
|
36
24
|
end
|
25
|
+
|
26
|
+
def self.parse_options(options = {})
|
27
|
+
# some libs use :Port, :port and :Host, :host, unify this
|
28
|
+
opts = {}
|
29
|
+
options.each {|k, v| opts[k.to_s.downcase.to_sym] = v}
|
30
|
+
|
31
|
+
# this is rack's configuration file but also the trinidad's configuration.
|
32
|
+
# Removing it we allow to load trinidad's default configuration.
|
33
|
+
opts.delete(:config)
|
34
|
+
|
35
|
+
threads = (opts[:threads] || '1:1').split(':')
|
36
|
+
opts[:port] ||= 3000
|
37
|
+
opts[:address] ||= opts[:host] || 'localhost'
|
38
|
+
opts[:jruby_min_runtimes], opts[:jruby_max_runtimes] = threads[0].to_i, threads[1].to_i
|
39
|
+
opts
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.create_servlet(app)
|
43
|
+
context = org.jruby.rack.embed.Context.new('Trinidad')
|
44
|
+
dispatcher = org.jruby.rack.embed.Dispatcher.new(context, self.new(app))
|
45
|
+
org.jruby.rack.embed.Servlet.new(dispatcher, context)
|
46
|
+
end
|
37
47
|
end
|
38
48
|
|
39
49
|
register :trinidad, Trinidad
|
data/lib/trinidad.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: trinidad
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.3.
|
5
|
+
version: 1.3.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- David Calavera
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-02-16 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: trinidad_jars
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
requirements:
|
53
53
|
- - ~>
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 2.
|
55
|
+
version: "2.7"
|
56
56
|
requirement: *id004
|
57
57
|
prerelease: false
|
58
58
|
type: :development
|
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
135
|
requirements: []
|
136
136
|
|
137
137
|
rubyforge_project: trinidad
|
138
|
-
rubygems_version: 1.8.
|
138
|
+
rubygems_version: 1.8.15
|
139
139
|
signing_key:
|
140
140
|
specification_version: 2
|
141
141
|
summary: Simple library to run rails applications into an embedded Tomcat
|