trinidad 1.4.4 → 1.4.5.B1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/History.txt +36 -0
- data/README.md +130 -64
- data/Rakefile +6 -3
- data/lib/trinidad.rb +1 -0
- data/lib/trinidad/extensions.rb +16 -16
- data/lib/trinidad/helpers.rb +34 -0
- data/lib/trinidad/lifecycle/base.rb +20 -20
- data/lib/trinidad/lifecycle/host.rb +34 -9
- data/lib/trinidad/lifecycle/host/rolling_reload.rb +31 -9
- data/lib/trinidad/lifecycle/web_app/default.rb +1 -1
- data/lib/trinidad/lifecycle/web_app/shared.rb +15 -8
- data/lib/trinidad/lifecycle/web_app/war.rb +26 -26
- data/lib/trinidad/logging.rb +149 -120
- data/lib/trinidad/server.rb +375 -135
- data/lib/trinidad/version.rb +1 -1
- data/lib/trinidad/web_app.rb +69 -35
- data/rakelib/tomcat.rake +1 -0
- data/trinidad.gemspec +4 -6
- metadata +160 -155
data/lib/trinidad/version.rb
CHANGED
data/lib/trinidad/web_app.rb
CHANGED
@@ -13,7 +13,7 @@ module Trinidad
|
|
13
13
|
RailsWebApp.new(config, default_config)
|
14
14
|
end
|
15
15
|
|
16
|
-
def initialize(config, default_config)
|
16
|
+
def initialize(config, default_config = Trinidad.configuration)
|
17
17
|
@config, @default_config = config, default_config || {}
|
18
18
|
complete_config!
|
19
19
|
# NOTE: we should maybe @config.freeze here ?!
|
@@ -30,13 +30,16 @@ module Trinidad
|
|
30
30
|
use_default ? default_config.key?(key) : false
|
31
31
|
end
|
32
32
|
|
33
|
-
%w{ root_dir rackup
|
33
|
+
%w{ root_dir rackup async_supported reload_strategy host_name }.each do |method|
|
34
34
|
class_eval "def #{method}; self[:'#{method}']; end"
|
35
35
|
end
|
36
|
-
alias_method :web_app_dir, :root_dir # is getting deprecated soon
|
37
36
|
|
37
|
+
alias_method :web_app_dir, :root_dir # is getting deprecated soon
|
38
38
|
def app_root; root_dir; end
|
39
39
|
|
40
|
+
# @deprecated use `self[:log]` instead
|
41
|
+
def log; self[:log]; end
|
42
|
+
|
40
43
|
def context_path
|
41
44
|
path = self[:context_path] || self[:path]
|
42
45
|
path ? path.to_s : path
|
@@ -87,7 +90,7 @@ module Trinidad
|
|
87
90
|
def environment; self[:environment] || @@defaults[:environment]; end # TODO check web.xml
|
88
91
|
|
89
92
|
def public_dir
|
90
|
-
@public_dir ||= expand_path(public_root)
|
93
|
+
@public_dir ||= ( public_root == '/' ? root_dir : expand_path(public_root) )
|
91
94
|
end
|
92
95
|
|
93
96
|
# by (a "Rails") convention use '[RAILS_ROOT]/tmp'
|
@@ -144,6 +147,7 @@ module Trinidad
|
|
144
147
|
add_context_param 'jruby.compat.version', jruby_compat_version
|
145
148
|
add_context_param 'public.root', public_root
|
146
149
|
add_context_param 'jruby.rack.layout_class', layout_class
|
150
|
+
add_context_param 'jruby.rack.error', false # do not start error app on errors
|
147
151
|
@context_params
|
148
152
|
end
|
149
153
|
# @deprecated replaced with {#context_params}
|
@@ -388,20 +392,8 @@ module Trinidad
|
|
388
392
|
raise NotImplementedError.new "context_listener expected to be redefined"
|
389
393
|
end
|
390
394
|
|
391
|
-
|
392
|
-
|
393
|
-
'JRuby::Rack::FileSystemLayout' # handles Rails as well as Rack
|
394
|
-
end
|
395
|
-
else
|
396
|
-
def layout_class
|
397
|
-
# NOTE: we'll also need to do a GEM_PATH hack to avoid a bug :
|
398
|
-
if gem_path = ENV['GEM_PATH']
|
399
|
-
add_context_param 'gem.path', gem_path
|
400
|
-
# ENV['GEM_PATH'] will contain twice the same entry(ies) ...
|
401
|
-
end
|
402
|
-
add_context_param 'rails.root', app_root # still boots a rack app
|
403
|
-
'JRuby::Rack::RailsFilesystemLayout' # no plain FS layout defined !
|
404
|
-
end
|
395
|
+
def layout_class
|
396
|
+
'JRuby::Rack::FileSystemLayout' # handles Rails as well as Rack
|
405
397
|
end
|
406
398
|
|
407
399
|
def complete_config!
|
@@ -538,17 +530,20 @@ module Trinidad
|
|
538
530
|
end
|
539
531
|
|
540
532
|
def self.war?(config, default_config = nil)
|
541
|
-
|
533
|
+
root_dir = root_dir(config, default_config)
|
534
|
+
return true if root_dir && root_dir.to_s[-4..-1] == '.war'
|
535
|
+
context_path = config[:context_path] # backwards-compatibility :
|
536
|
+
context_path && context_path.to_s[-4..-1] == '.war'
|
542
537
|
end
|
543
538
|
|
544
539
|
private
|
545
540
|
|
546
|
-
def self.root_dir(config, default_config)
|
541
|
+
def self.root_dir(config, default_config, default_dir = Dir.pwd)
|
547
542
|
# for backwards compatibility accepts the :web_app_dir "alias"
|
548
543
|
config[:root_dir] || config[:web_app_dir] ||
|
549
544
|
( default_config &&
|
550
545
|
( default_config[:root_dir] || default_config[:web_app_dir] ) ) ||
|
551
|
-
|
546
|
+
default_dir
|
552
547
|
end
|
553
548
|
|
554
549
|
def self.context_path(config, default_config = nil)
|
@@ -629,7 +624,7 @@ module Trinidad
|
|
629
624
|
|
630
625
|
end
|
631
626
|
|
632
|
-
# Rack web application (looks for a rackup config.ru file).
|
627
|
+
# Rack web application (looks for a "rackup" *config.ru* file).
|
633
628
|
class RackupWebApp < WebApp
|
634
629
|
|
635
630
|
def context_params
|
@@ -646,7 +641,7 @@ module Trinidad
|
|
646
641
|
|
647
642
|
end
|
648
643
|
|
649
|
-
# Rails web
|
644
|
+
# Rails web application specifics (supports same versions as JRuby-Rack).
|
650
645
|
class RailsWebApp < WebApp
|
651
646
|
|
652
647
|
def context_params
|
@@ -680,7 +675,12 @@ module Trinidad
|
|
680
675
|
end
|
681
676
|
|
682
677
|
def self.threadsafe_match?(file)
|
683
|
-
File.exist?(file) &&
|
678
|
+
File.exist?(file) && (
|
679
|
+
file_line_match?(file, /^[^#]*threadsafe!/) || ( # Rails 4.0
|
680
|
+
file_line_match?(file, /^[^#]*config\.eager_load = true/) &&
|
681
|
+
file_line_match?(file, /^[^#]*config\.cache_classes = true/)
|
682
|
+
)
|
683
|
+
)
|
684
684
|
end
|
685
685
|
|
686
686
|
end
|
@@ -688,30 +688,64 @@ module Trinidad
|
|
688
688
|
# A web application for deploying (java) .war files.
|
689
689
|
class WarWebApp < WebApp
|
690
690
|
|
691
|
-
def
|
692
|
-
|
691
|
+
def root_dir
|
692
|
+
@root_dir ||= ( config[:root_dir] || begin
|
693
|
+
path = config[:context_path]
|
694
|
+
path.to_s if path.to_s[-4..-1] == '.war'
|
695
|
+
end || default_confit[:root_dir] )
|
693
696
|
end
|
694
|
-
|
695
|
-
def
|
696
|
-
@
|
697
|
+
|
698
|
+
def context_path
|
699
|
+
@path ||= begin
|
700
|
+
path = File.basename(super)
|
701
|
+
context_name = Trinidad::Tomcat::ContextName.new(path)
|
702
|
+
context_name.path # removes .war handles ## versioning
|
703
|
+
end
|
697
704
|
end
|
698
|
-
|
705
|
+
|
699
706
|
def work_dir
|
700
|
-
|
707
|
+
self[:work_dir]
|
701
708
|
end
|
702
709
|
|
710
|
+
def log_dir
|
711
|
+
@log_dir ||= self[:log_dir] || begin
|
712
|
+
if work_dir then work_dir
|
713
|
+
else
|
714
|
+
if root_dir[-4..-1] == '.war'
|
715
|
+
parent_dir = File.dirname(root_dir)
|
716
|
+
expanded_dir = File.join(parent_dir, context_path)
|
717
|
+
File.exist?(expanded_dir) ? expanded_dir : parent_dir
|
718
|
+
else
|
719
|
+
File.join(root_dir, 'log')
|
720
|
+
end
|
721
|
+
end
|
722
|
+
end
|
723
|
+
end
|
724
|
+
|
703
725
|
def monitor
|
704
|
-
File.expand_path(root_dir)
|
726
|
+
root_dir ? File.expand_path(root_dir) : nil # the .war file itself
|
727
|
+
end
|
728
|
+
|
729
|
+
def class_loader
|
730
|
+
@class_loader ||= nil # lifecycle will setup JRuby CL
|
705
731
|
end
|
706
732
|
|
707
|
-
def
|
708
|
-
|
733
|
+
def context_params
|
734
|
+
warbler? ? super : @context_params ||= {}
|
709
735
|
end
|
710
|
-
|
736
|
+
|
711
737
|
def layout_class
|
712
738
|
'JRuby::Rack::WebInfLayout'
|
713
739
|
end
|
714
740
|
|
741
|
+
def define_lifecycle
|
742
|
+
Trinidad::Lifecycle::WebApp::War.new(self)
|
743
|
+
end
|
744
|
+
|
745
|
+
private
|
746
|
+
|
747
|
+
def warbler?; nil; end # TODO detect warbler created .war ?!
|
748
|
+
|
715
749
|
end
|
716
750
|
|
717
751
|
end
|
data/rakelib/tomcat.rake
CHANGED
data/trinidad.gemspec
CHANGED
@@ -21,15 +21,13 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.rdoc_options = ["--charset=UTF-8"]
|
22
22
|
s.extra_rdoc_files = %w[README.md LICENSE]
|
23
23
|
|
24
|
-
s.add_dependency('trinidad_jars', ">= 1.
|
25
|
-
s.add_dependency('jruby-rack', ">= 1.1.
|
24
|
+
s.add_dependency('trinidad_jars', ">= 1.2.2")
|
25
|
+
s.add_dependency('jruby-rack', ">= 1.1.13")
|
26
26
|
|
27
|
-
s.add_development_dependency('rack')
|
28
27
|
s.add_development_dependency('rake')
|
29
|
-
s.add_development_dependency('rspec', '~> 2.
|
30
|
-
s.add_development_dependency('mocha')
|
28
|
+
s.add_development_dependency('rspec', '~> 2.12.0')
|
29
|
+
s.add_development_dependency('mocha', '~> 0.12.1')
|
31
30
|
s.add_development_dependency('fakefs', '>= 0.4.0')
|
32
|
-
s.add_development_dependency('sinatra')
|
33
31
|
|
34
32
|
s.files = `git ls-files`.split("\n").sort.
|
35
33
|
reject { |file| file =~ /^\./ }. # .gitignore, .travis.yml
|
metadata
CHANGED
@@ -1,171 +1,176 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: trinidad
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
version: 1.4.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: 6
|
5
|
+
version: 1.4.5.B1
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
|
9
|
-
autorequire:
|
7
|
+
authors:
|
8
|
+
- David Calavera
|
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
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
12
|
+
date: 2013-03-08 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: trinidad_jars
|
16
|
+
version_requirements: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 1.2.2
|
21
|
+
none: false
|
22
|
+
requirement: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.2.2
|
27
|
+
none: false
|
28
|
+
prerelease: false
|
29
|
+
type: :runtime
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: jruby-rack
|
32
|
+
version_requirements: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 1.1.13
|
37
|
+
none: false
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 1.1.13
|
43
|
+
none: false
|
44
|
+
prerelease: false
|
45
|
+
type: :runtime
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: !binary |-
|
53
|
+
MA==
|
54
|
+
none: false
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: !binary |-
|
60
|
+
MA==
|
61
|
+
none: false
|
62
|
+
prerelease: false
|
63
|
+
type: :development
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
name: rspec
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - "~>"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 2.12.0
|
71
|
+
none: false
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 2.12.0
|
77
|
+
none: false
|
78
|
+
prerelease: false
|
79
|
+
type: :development
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: mocha
|
82
|
+
version_requirements: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - "~>"
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 0.12.1
|
87
|
+
none: false
|
88
|
+
requirement: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - "~>"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: 0.12.1
|
93
|
+
none: false
|
94
|
+
prerelease: false
|
95
|
+
type: :development
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: fakefs
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 0.4.0
|
103
|
+
none: false
|
104
|
+
requirement: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: 0.4.0
|
109
|
+
none: false
|
110
|
+
prerelease: false
|
111
|
+
type: :development
|
103
112
|
description: Trinidad allows you to run Rails or Rack applications within an embedded Apache Tomcat container. Serves your requests with the elegance of a cat !
|
104
113
|
email: calavera@apache.org
|
105
|
-
executables:
|
106
|
-
|
114
|
+
executables:
|
115
|
+
- trinidad
|
107
116
|
extensions: []
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
117
|
+
extra_rdoc_files:
|
118
|
+
- README.md
|
119
|
+
- LICENSE
|
120
|
+
files:
|
121
|
+
- Gemfile
|
122
|
+
- History.txt
|
123
|
+
- LICENSE
|
124
|
+
- README.md
|
125
|
+
- Rakefile
|
126
|
+
- bin/trinidad
|
127
|
+
- lib/rack/handler/trinidad.rb
|
128
|
+
- lib/trinidad.rb
|
129
|
+
- lib/trinidad/command_line_parser.rb
|
130
|
+
- lib/trinidad/configuration.rb
|
131
|
+
- lib/trinidad/extensions.rb
|
132
|
+
- lib/trinidad/helpers.rb
|
133
|
+
- lib/trinidad/lifecycle/base.rb
|
134
|
+
- lib/trinidad/lifecycle/host.rb
|
135
|
+
- lib/trinidad/lifecycle/host/restart_reload.rb
|
136
|
+
- lib/trinidad/lifecycle/host/rolling_reload.rb
|
137
|
+
- lib/trinidad/lifecycle/web_app/default.rb
|
138
|
+
- lib/trinidad/lifecycle/web_app/shared.rb
|
139
|
+
- lib/trinidad/lifecycle/web_app/war.rb
|
140
|
+
- lib/trinidad/logging.rb
|
141
|
+
- lib/trinidad/server.rb
|
142
|
+
- lib/trinidad/version.rb
|
143
|
+
- lib/trinidad/web_app.rb
|
144
|
+
- rakelib/tomcat.rake
|
145
|
+
- trinidad.gemspec
|
137
146
|
homepage: http://github.com/trinidad/trinidad
|
138
147
|
licenses: []
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
148
|
+
post_install_message:
|
149
|
+
rdoc_options:
|
150
|
+
- "--charset=UTF-8"
|
151
|
+
require_paths:
|
152
|
+
- lib
|
153
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - ">="
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
segments:
|
158
|
+
- 0
|
159
|
+
hash: 2
|
160
|
+
version: !binary |-
|
161
|
+
MA==
|
146
162
|
none: false
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
version: "0"
|
154
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - !binary |-
|
166
|
+
Pg==
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: 1.3.1
|
155
169
|
none: false
|
156
|
-
requirements:
|
157
|
-
- - ">="
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
hash: 2
|
160
|
-
segments:
|
161
|
-
- 0
|
162
|
-
version: "0"
|
163
170
|
requirements: []
|
164
|
-
|
165
|
-
rubyforge_project:
|
171
|
+
rubyforge_project:
|
166
172
|
rubygems_version: 1.8.24
|
167
|
-
signing_key:
|
173
|
+
signing_key:
|
168
174
|
specification_version: 3
|
169
175
|
summary: Web server for Rails/Rack applications built upon JRuby::Rack and Apache Tomcat
|
170
176
|
test_files: []
|
171
|
-
|