trinidad 0.9.10 → 0.9.11

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.
data/History.txt CHANGED
@@ -1,3 +1,11 @@
1
+ == 0.9.11 (2010-10-20)
2
+
3
+ * configure applications base directory to run several applications into the same container
4
+
5
+ == 0.9.10 (2010-10-02)
6
+
7
+ * configure logging as expected by rails applications
8
+
1
9
  == 0.9.9 (2010-09-29)
2
10
 
3
11
  * set tomcat's server address properly
data/README.rdoc CHANGED
@@ -48,6 +48,8 @@ Trinidad allows you to configure some parameters when the server is started from
48
48
  * -t, --threadsafe => shortcut to work in threadsafe mode. Setting jruby_min_runtimes and jruby_max_runtimes to 1 in the configuration file the server behaves as the same way.
49
49
  * -l, --load EXTENSION_NAME => load an extension to use its command line options.
50
50
  * --address HOST => set the server host.
51
+ * -g, --log LEVEL => set the log level, default INFO.
52
+ * --apps APPS_BASE_DIRECTORY => set the applications base directory.
51
53
 
52
54
  The server can also be configured from a yaml file. If a file is not especified, the server tries to load the file <em>config/trinidad.yml</em>. Within this file you can add other options like jruby.min.runtimes(:jruby_min_runtimes) or jruby.max.runtimes(:jruby_max_runtimes).
53
55
 
@@ -63,10 +65,11 @@ Other advanced options can be found in the wiki: http://wiki.github.com/calavera
63
65
  From the version 0.8.0 Trinidad allows to extend the server with more Tomcat features, here there is a list with the current available extensions:
64
66
 
65
67
  * Database connection pooling: http://github.com/calavera/trinidad-dbpool
66
- * Daemon, run Trinidad as a daemon: http://github.com/calavera/trinidad_daemon_extension
68
+ * Daemon, run Trinidad as a daemon: http://github.com/calavera/trinidad_daemon_extension and http://github.com/calavera/trinidad_daemon
67
69
  * Hot deploy, do hot deploys monitorizing a temporal file, ala Passenger: http://github.com/calavera/trinidad_hotdeploy_extension
68
70
  * Sandbox, management console and REST api: http://github.com/calavera/trinidad_sandbox_extension
69
71
  * Logging, enhance the Trinidad's logging system: http://github.com/calavera/trinidad_logging_extension
72
+ * Lifecycle, application and server lifecycle management: http://github.com/calavera/trinidad_lifecycle_extension
70
73
 
71
74
  You can find further information on how to write your own extension in the wiki: http://wiki.github.com/calavera/trinidad/extensions
72
75
 
@@ -47,28 +47,28 @@ module Trinidad
47
47
  default_options[:web_app_dir] = v
48
48
  end
49
49
 
50
- opts.on('-e', '--env ENVIRONMENT', 'Rails environment',
51
- "default: #{default_options[:environment]}") do |v|
50
+ opts.on('-e', '--env ENVIRONMENT', 'Rails environment',
51
+ "default: #{default_options[:environment]}") do |v|
52
52
  default_options[:environment] = v
53
53
  end
54
54
 
55
- opts.on('-p', '--port PORT', 'Port to bind to',
56
- "default: #{default_options[:port]}") do |v|
55
+ opts.on('-p', '--port PORT', 'Port to bind to',
56
+ "default: #{default_options[:port]}") do |v|
57
57
  default_options[:port] = v
58
58
  end
59
59
 
60
- opts.on('-c', '--context CONTEXT_PATH', 'The application context path',
61
- "default: #{default_options[:context_path]}") do |v|
60
+ opts.on('-c', '--context CONTEXT_PATH', 'The application context path',
61
+ "default: #{default_options[:context_path]}") do |v|
62
62
  default_options[:context_path] = v
63
63
  end
64
64
 
65
- opts.on('--lib', '--jars LIBS_DIR', 'Directory containing jars used by the application',
66
- "default: #{default_options[:libs_dir]}") do |v|
65
+ opts.on('--lib', '--jars LIBS_DIR', 'Directory containing jars used by the application',
66
+ "default: #{default_options[:libs_dir]}") do |v|
67
67
  default_options[:libs_dir] = v
68
68
  end
69
69
 
70
- opts.on('--classes', '--classes CLASSES_DIR', 'Directory containing classes used by the application',
71
- "default: #{default_options[:classes_dir]}") do |v|
70
+ opts.on('--classes', '--classes CLASSES_DIR', 'Directory containing classes used by the application',
71
+ "default: #{default_options[:classes_dir]}") do |v|
72
72
  default_options[:classes_dir] = v
73
73
  end
74
74
 
@@ -81,7 +81,7 @@ module Trinidad
81
81
  opts.on('-a', '--ajp [AJP_PORT]', 'Enable ajp connections',
82
82
  "default port: #{default_options[:ajp_port]}") do |v|
83
83
  ajp_port = v.nil? ? default_options.delete(:ajp_port) : v.to_i
84
- default_options[:ajp] = {:port => ajp_port}
84
+ default_options[:ajp] = {:port => ajp_port}
85
85
  end
86
86
 
87
87
  opts.on('-f', '--config [CONFIG_FILE]', 'Configuration file',
@@ -128,6 +128,10 @@ module Trinidad
128
128
  Trinidad::Extensions.configure_options_extensions({name => {}}, opts, default_options)
129
129
  end
130
130
 
131
+ opts.on('--apps', '--apps APPS_BASE_DIR', 'applications base directory') do |path|
132
+ default_options[:apps_base] = path
133
+ end
134
+
131
135
  opts.on('-h', '--help', 'display the help') do
132
136
  puts opts
133
137
  exit
@@ -35,7 +35,7 @@ module Trinidad
35
35
  @tomcat.server.address = @config[:address]
36
36
  @tomcat.port = @config[:port].to_i
37
37
  @tomcat.base_dir = Dir.pwd
38
- @tomcat.host.app_base = Dir.pwd
38
+ @tomcat.host.app_base = @config[:apps_base] || Dir.pwd
39
39
  @tomcat.enable_naming
40
40
 
41
41
  add_http_connector if http_configured?
@@ -46,10 +46,32 @@ module Trinidad
46
46
  end
47
47
 
48
48
  def create_web_apps
49
- @config[:web_apps].each do |name, app_config|
50
- app_config[:context_path] ||= (name.to_s == 'default' ? '/' : "/#{name.to_s}")
51
- app_config[:web_app_dir] ||= Dir.pwd
49
+ if @config[:web_apps]
50
+ @config[:web_apps].each do |name, app_config|
51
+ app_config[:context_path] ||= (name.to_s == 'default' ? '/' : "/#{name.to_s}")
52
+ app_config[:web_app_dir] ||= Dir.pwd
52
53
 
54
+ create_web_app(app_config)
55
+ end
56
+ end
57
+ if @config[:apps_base]
58
+ apps_path = Dir.glob(File.join(@config[:apps_base], '*')).select {|path| !(path =~ /tomcat\.8080$/) }
59
+
60
+ apps_path.each do |path|
61
+ if File.directory?(path)
62
+ name = File.basename(path)
63
+ app_config = {
64
+ :context_path => (name == 'default' ? '/' : "/#{name.to_s}"),
65
+ :web_app_dir => File.expand_path(path)
66
+ }
67
+
68
+ create_web_app(app_config)
69
+ end
70
+ end
71
+ end
72
+ end
73
+
74
+ def create_web_app(app_config)
53
75
  app_context = @tomcat.addWebapp(app_config[:context_path], app_config[:web_app_dir])
54
76
  remove_defaults(app_context)
55
77
 
@@ -58,7 +80,6 @@ module Trinidad
58
80
 
59
81
  Trinidad::Extensions.configure_webapp_extensions(web_app.extensions, @tomcat, app_context)
60
82
  app_context.add_lifecycle_listener(WebAppLifecycleListener.new(web_app))
61
- end
62
83
  end
63
84
 
64
85
  def add_service_connector(options, protocol = nil)
@@ -86,7 +107,7 @@ module Trinidad
86
107
 
87
108
  def add_ssl_connector
88
109
  options = @config[:ssl].merge({
89
- :scheme => 'https',
110
+ :scheme => 'https',
90
111
  :secure => true,
91
112
  :SSLEnabled => 'true'
92
113
  })
@@ -131,12 +152,12 @@ module Trinidad
131
152
  raise "Unable to create keystore folder: " + keystore_file.parent_file.canonical_path
132
153
  end
133
154
 
134
- keytool_args = ["-genkey",
135
- "-alias", "localhost",
136
- "-dname", "CN=localhost, OU=Trinidad, O=Trinidad, C=ES",
155
+ keytool_args = ["-genkey",
156
+ "-alias", "localhost",
157
+ "-dname", "CN=localhost, OU=Trinidad, O=Trinidad, C=ES",
137
158
  "-keyalg", "RSA",
138
- "-validity", "365",
139
- "-storepass", "key",
159
+ "-validity", "365",
160
+ "-storepass", "key",
140
161
  "-keystore", config[:keystoreFile],
141
162
  "-storepass", config[:keystorePass],
142
163
  "-keypass", config[:keystorePass]]
@@ -152,7 +173,7 @@ module Trinidad
152
173
  private
153
174
 
154
175
  def add_default_web_app!(config)
155
- unless (config.has_key?(:web_apps))
176
+ if (!config.has_key?(:web_apps) && !config.has_key?(:apps_base))
156
177
  default_app = {
157
178
  :context_path => config[:context_path] || '/',
158
179
  :web_app_dir => config[:web_app_dir] || Dir.pwd,
@@ -48,7 +48,7 @@ module Trinidad
48
48
  @app_config[:public] || @config[:public] || 'public'
49
49
  end
50
50
 
51
- %w{web_app_dir libs_dir classes_dir default_web_xml environment
51
+ %w{web_app_dir libs_dir classes_dir default_web_xml environment
52
52
  jruby_min_runtimes jruby_max_runtimes rackup log}.each do |method_name|
53
53
  define_method method_name do
54
54
  sym = method_name.to_sym
data/lib/trinidad.rb CHANGED
@@ -22,5 +22,5 @@ require 'trinidad/rackup_web_app'
22
22
 
23
23
 
24
24
  module Trinidad
25
- VERSION = '0.9.10'
25
+ VERSION = '0.9.11'
26
26
  end
metadata CHANGED
@@ -3,141 +3,134 @@ name: trinidad
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
- - 0
7
- - 9
8
- - 10
9
- version: 0.9.10
6
+ - 0
7
+ - 9
8
+ - 11
9
+ version: 0.9.11
10
10
  platform: ruby
11
11
  authors:
12
- - David Calavera
12
+ - David Calavera
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-02 00:00:00 -04:00
17
+ date: 2010-10-20 00:00:00 +02:00
18
18
  default_executable: trinidad
19
19
  dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: trinidad_jars
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
- - 3
31
- - 0
32
- version: 0.3.0
33
- type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: jruby-rack
37
- prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- segments:
44
- - 1
45
- - 0
46
- - 2
47
- version: 1.0.2
48
- type: :runtime
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
51
- name: rspec
52
- prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
54
- none: false
55
- requirements:
56
- - - ">="
57
- - !ruby/object:Gem::Version
58
- segments:
59
- - 0
60
- version: "0"
61
- type: :development
62
- version_requirements: *id003
63
- - !ruby/object:Gem::Dependency
64
- name: mocha
65
- prerelease: false
66
- requirement: &id004 !ruby/object:Gem::Requirement
67
- none: false
68
- requirements:
69
- - - ">="
70
- - !ruby/object:Gem::Version
71
- segments:
72
- - 0
73
- version: "0"
74
- type: :development
75
- version_requirements: *id004
76
- - !ruby/object:Gem::Dependency
77
- name: fakefs
78
- prerelease: false
79
- requirement: &id005 !ruby/object:Gem::Requirement
80
- none: false
81
- requirements:
82
- - - ">="
83
- - !ruby/object:Gem::Version
84
- segments:
85
- - 0
86
- version: "0"
87
- type: :development
88
- version_requirements: *id005
20
+ - !ruby/object:Gem::Dependency
21
+ name: trinidad_jars
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 3
30
+ - 0
31
+ version: 0.3.0
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: jruby-rack
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 1
43
+ - 0
44
+ - 2
45
+ version: 1.0.2
46
+ type: :runtime
47
+ version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
49
+ name: rspec
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ segments:
56
+ - 0
57
+ version: "0"
58
+ type: :development
59
+ version_requirements: *id003
60
+ - !ruby/object:Gem::Dependency
61
+ name: mocha
62
+ prerelease: false
63
+ requirement: &id004 !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ segments:
68
+ - 0
69
+ version: "0"
70
+ type: :development
71
+ version_requirements: *id004
72
+ - !ruby/object:Gem::Dependency
73
+ name: fakefs
74
+ prerelease: false
75
+ requirement: &id005 !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ segments:
80
+ - 0
81
+ version: "0"
82
+ type: :development
83
+ version_requirements: *id005
89
84
  description: Trinidad allows you to run a rails or rackup applications within an embedded Apache Tomcat container
90
85
  email: calavera@apache.org
91
86
  executables:
92
- - trinidad
87
+ - trinidad
93
88
  extensions: []
94
89
 
95
90
  extra_rdoc_files:
96
- - README.rdoc
97
- - LICENSE
91
+ - README.rdoc
92
+ - LICENSE
98
93
  files:
99
- - bin/trinidad
100
- - lib/trinidad.rb
101
- - History.txt
102
- - LICENSE
103
- - README.rdoc
104
- - lib/trinidad/command_line_parser.rb
105
- - lib/trinidad/core_ext.rb
106
- - lib/trinidad/extensions.rb
107
- - lib/trinidad/rackup_web_app.rb
108
- - lib/trinidad/rails_web_app.rb
109
- - lib/trinidad/server.rb
110
- - lib/trinidad/web_app.rb
111
- - lib/trinidad/web_app_lifecycle_listener.rb
94
+ - bin/trinidad
95
+ - lib/trinidad.rb
96
+ - History.txt
97
+ - LICENSE
98
+ - README.rdoc
99
+ - lib/trinidad/command_line_parser.rb
100
+ - lib/trinidad/core_ext.rb
101
+ - lib/trinidad/extensions.rb
102
+ - lib/trinidad/rackup_web_app.rb
103
+ - lib/trinidad/rails_web_app.rb
104
+ - lib/trinidad/server.rb
105
+ - lib/trinidad/web_app.rb
106
+ - lib/trinidad/web_app_lifecycle_listener.rb
112
107
  has_rdoc: true
113
108
  homepage: http://github.com/calavera/trinidad
114
109
  licenses: []
115
110
 
116
111
  post_install_message:
117
112
  rdoc_options:
118
- - --charset=UTF-8
113
+ - --charset=UTF-8
119
114
  require_paths:
120
- - lib
115
+ - lib
121
116
  required_ruby_version: !ruby/object:Gem::Requirement
122
- none: false
123
117
  requirements:
124
- - - ">="
125
- - !ruby/object:Gem::Version
126
- segments:
127
- - 0
128
- version: "0"
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ segments:
121
+ - 0
122
+ version: "0"
129
123
  required_rubygems_version: !ruby/object:Gem::Requirement
130
- none: false
131
124
  requirements:
132
- - - ">="
133
- - !ruby/object:Gem::Version
134
- segments:
135
- - 0
136
- version: "0"
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ segments:
128
+ - 0
129
+ version: "0"
137
130
  requirements: []
138
131
 
139
132
  rubyforge_project: trinidad
140
- rubygems_version: 1.3.7
133
+ rubygems_version: 1.3.6
141
134
  signing_key:
142
135
  specification_version: 2
143
136
  summary: Simple library to run rails applications into an embedded Tomcat