passenger 2.2.5 → 2.2.6
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of passenger might be problematic. Click here for more details.
- data/NEWS +31 -1
- data/bin/passenger-install-apache2-module +7 -1
- data/bin/passenger-install-nginx-module +1 -1
- data/bin/passenger-memory-stats +3 -3
- data/doc/Users guide Apache.html +112 -13
- data/doc/Users guide Apache.txt +70 -9
- data/doc/Users guide Nginx.html +1 -1
- data/doc/cxxapi/Bucket_8h-source.html +1 -1
- data/doc/cxxapi/Configuration_8h-source.html +1 -1
- data/doc/cxxapi/DirectoryMapper_8h-source.html +7 -7
- data/doc/cxxapi/Hooks_8h-source.html +1 -1
- data/doc/cxxapi/annotated.html +1 -1
- data/doc/cxxapi/classHooks-members.html +1 -1
- data/doc/cxxapi/classHooks.html +1 -1
- data/doc/cxxapi/classPassenger_1_1DirectoryMapper-members.html +1 -1
- data/doc/cxxapi/classPassenger_1_1DirectoryMapper.html +1 -1
- data/doc/cxxapi/classes.html +1 -1
- data/doc/cxxapi/definitions_8h-source.html +1 -1
- data/doc/cxxapi/files.html +1 -1
- data/doc/cxxapi/functions.html +1 -1
- data/doc/cxxapi/functions_func.html +1 -1
- data/doc/cxxapi/graph_legend.html +1 -1
- data/doc/cxxapi/group__Configuration.html +1 -1
- data/doc/cxxapi/group__Core.html +1 -1
- data/doc/cxxapi/group__Hooks.html +1 -1
- data/doc/cxxapi/group__Support.html +1 -1
- data/doc/cxxapi/main.html +1 -1
- data/doc/cxxapi/modules.html +1 -1
- data/doc/rdoc/classes/ConditionVariable.html +59 -59
- data/doc/rdoc/classes/Exception.html +11 -11
- data/doc/rdoc/classes/GC.html +4 -4
- data/doc/rdoc/classes/IO.html +14 -14
- data/doc/rdoc/classes/PhusionPassenger.html +13 -13
- data/doc/rdoc/classes/PhusionPassenger/AbstractInstaller.html +8 -8
- data/doc/rdoc/classes/PhusionPassenger/AbstractRequestHandler.html +26 -26
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer.html +98 -98
- data/doc/rdoc/classes/PhusionPassenger/AbstractServerCollection.html +61 -61
- data/doc/rdoc/classes/PhusionPassenger/AdminTools.html +8 -8
- data/doc/rdoc/classes/PhusionPassenger/AdminTools/ControlProcess.html +32 -32
- data/doc/rdoc/classes/PhusionPassenger/Application.html +14 -14
- data/doc/rdoc/classes/PhusionPassenger/ConsoleTextTemplate.html +12 -12
- data/doc/rdoc/classes/PhusionPassenger/FrameworkInitError.html +4 -4
- data/doc/rdoc/classes/PhusionPassenger/HTMLTemplate.html +12 -12
- data/doc/rdoc/classes/PhusionPassenger/InitializationError.html +5 -5
- data/doc/rdoc/classes/PhusionPassenger/MessageChannel.html +42 -42
- data/doc/rdoc/classes/PhusionPassenger/NativeSupport.html +24 -24
- data/doc/rdoc/classes/PhusionPassenger/Rack/ApplicationSpawner.html +8 -8
- data/doc/rdoc/classes/PhusionPassenger/Rack/RequestHandler.html +8 -8
- data/doc/rdoc/classes/PhusionPassenger/Railz/ApplicationSpawner.html +62 -66
- data/doc/rdoc/classes/PhusionPassenger/Railz/CGIFixed.html +23 -23
- data/doc/rdoc/classes/PhusionPassenger/Railz/FrameworkSpawner.html +30 -30
- data/doc/rdoc/classes/PhusionPassenger/Railz/RequestHandler.html +8 -8
- data/doc/rdoc/classes/PhusionPassenger/SpawnManager.html +23 -23
- data/doc/rdoc/classes/PhusionPassenger/UnknownError.html +4 -4
- data/doc/rdoc/classes/PhusionPassenger/Utils.html +384 -384
- data/doc/rdoc/classes/PhusionPassenger/Utils/PseudoIO.html +36 -36
- data/doc/rdoc/classes/PhusionPassenger/VersionNotFound.html +4 -4
- data/doc/rdoc/classes/PhusionPassenger/WSGI/ApplicationSpawner.html +7 -7
- data/doc/rdoc/classes/PlatformInfo.html +234 -200
- data/doc/rdoc/classes/RakeExtensions.html +4 -4
- data/doc/rdoc/classes/Signal.html +27 -27
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/DEVELOPERS_TXT.html +1 -1
- data/doc/rdoc/files/ext/phusion_passenger/native_support_c.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/abstract_installer_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/abstract_request_handler_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/abstract_server_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/admin_tools/control_process_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/application_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/constants_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/dependencies_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/message_channel_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/platform_info_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/rack/application_spawner_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/rack/request_handler_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/railz/application_spawner_rb.html +1 -3
- data/doc/rdoc/files/lib/phusion_passenger/railz/framework_spawner_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/spawn_manager_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/utils_rb.html +10 -9
- data/doc/rdoc/files/lib/phusion_passenger/wsgi/application_spawner_rb.html +1 -1
- data/doc/rdoc/fr_method_index.html +148 -147
- data/ext/apache2/DirectoryMapper.h +6 -6
- data/ext/common/Utils.cpp +31 -5
- data/ext/common/Version.h +1 -1
- data/ext/nginx/Configuration.c +4 -8
- data/ext/nginx/Configuration.h +2 -2
- data/ext/nginx/ContentHandler.c +11 -7
- data/ext/oxt/thread.hpp +12 -11
- data/lib/phusion_passenger/constants.rb +1 -1
- data/lib/phusion_passenger/dependencies.rb +40 -25
- data/lib/phusion_passenger/platform_info.rb +28 -11
- data/lib/phusion_passenger/railz/application_spawner.rb +3 -7
- data/lib/phusion_passenger/templates/apache2/deployment_example.txt.erb +7 -4
- data/lib/phusion_passenger/utils.rb +1 -0
- data/test/integration_tests/apache2_tests.rb +16 -0
- data/test/integration_tests/nginx_tests.rb +46 -0
- data/test/stub/MessageServer.dSYM/Contents/Info.plist +25 -0
- data/test/stub/MessageServer.dSYM/Contents/Resources/DWARF/MessageServer +0 -0
- data/test/stub/wsgi/passenger_wsgi.pyc +0 -0
- metadata +4 -2
@@ -170,20 +170,20 @@ public:
|
|
170
170
|
}
|
171
171
|
|
172
172
|
UPDATE_TRACE_POINT();
|
173
|
-
if (
|
174
|
-
&&
|
173
|
+
if (shouldAutoDetectRack()
|
174
|
+
&& verifyRackDir(config->getAppRoot(ap_document_root(r)), cstat, throttleRate)) {
|
175
175
|
baseURIKnown = true;
|
176
176
|
baseURI = "/";
|
177
|
-
appType =
|
177
|
+
appType = RACK;
|
178
178
|
return baseURI;
|
179
179
|
}
|
180
180
|
|
181
181
|
UPDATE_TRACE_POINT();
|
182
|
-
if (
|
183
|
-
&&
|
182
|
+
if (shouldAutoDetectRails()
|
183
|
+
&& verifyRailsDir(config->getAppRoot(ap_document_root(r)), cstat, throttleRate)) {
|
184
184
|
baseURIKnown = true;
|
185
185
|
baseURI = "/";
|
186
|
-
appType =
|
186
|
+
appType = RAILS;
|
187
187
|
return baseURI;
|
188
188
|
}
|
189
189
|
|
data/ext/common/Utils.cpp
CHANGED
@@ -348,6 +348,31 @@ setPassengerTempDir(const string &dir) {
|
|
348
348
|
passengerTempDir = dir;
|
349
349
|
}
|
350
350
|
|
351
|
+
/* Creates a non-writable FIFO file in order to prevent /tmp cleaners from removing
|
352
|
+
* passenger temp dir subdirectories. See http://code.google.com/p/phusion-passenger/issues/detail?id=365
|
353
|
+
* for details.
|
354
|
+
*/
|
355
|
+
static void
|
356
|
+
createNonWritableFifo(const string &filename) {
|
357
|
+
int ret, e;
|
358
|
+
|
359
|
+
do {
|
360
|
+
ret = mkfifo(filename.c_str(), 0);
|
361
|
+
} while (ret == -1 && errno == EINTR);
|
362
|
+
if (ret == -1 && errno != EEXIST) {
|
363
|
+
e = errno;
|
364
|
+
throw FileSystemException("Cannot create FIFO file " + filename, e, filename);
|
365
|
+
}
|
366
|
+
|
367
|
+
do {
|
368
|
+
ret = chmod(filename.c_str(), 0);
|
369
|
+
} while (ret == -1 && errno == EINTR);
|
370
|
+
if (ret == -1) {
|
371
|
+
e = errno;
|
372
|
+
throw FileSystemException("Cannot set permissions on file " + filename, e, filename);
|
373
|
+
}
|
374
|
+
}
|
375
|
+
|
351
376
|
void
|
352
377
|
createPassengerTempDir(const string &parentDir, bool userSwitching,
|
353
378
|
const string &lowestUser, uid_t workerUid, gid_t workerGid) {
|
@@ -364,6 +389,7 @@ createPassengerTempDir(const string &parentDir, bool userSwitching,
|
|
364
389
|
* whether a user may access that specific subdirectory.
|
365
390
|
*/
|
366
391
|
makeDirTree(tmpDir, "u=wxs,g=x,o=x");
|
392
|
+
createNonWritableFifo(tmpDir + "/.guard");
|
367
393
|
|
368
394
|
/* We want this upload buffer directory to be only accessible by the web server's
|
369
395
|
* worker processs.
|
@@ -377,6 +403,7 @@ createPassengerTempDir(const string &parentDir, bool userSwitching,
|
|
377
403
|
} else {
|
378
404
|
makeDirTree(tmpDir + "/webserver_private", "u=wxs,g=,o=");
|
379
405
|
}
|
406
|
+
createNonWritableFifo(tmpDir + "/webserver_private/.guard");
|
380
407
|
|
381
408
|
/* If the web server is running as root (i.e. user switching is possible to begin with)
|
382
409
|
* but user switching is off...
|
@@ -393,6 +420,7 @@ createPassengerTempDir(const string &parentDir, bool userSwitching,
|
|
393
420
|
*/
|
394
421
|
makeDirTree(tmpDir + "/info", "u=rwxs,g=,o=");
|
395
422
|
}
|
423
|
+
createNonWritableFifo(tmpDir + "/info/.guard");
|
396
424
|
|
397
425
|
if (geteuid() == 0) {
|
398
426
|
if (userSwitching) {
|
@@ -403,6 +431,7 @@ createPassengerTempDir(const string &parentDir, bool userSwitching,
|
|
403
431
|
} else {
|
404
432
|
makeDirTree(tmpDir + "/master", "u=wxs,g=,o=");
|
405
433
|
}
|
434
|
+
createNonWritableFifo(tmpDir + "/master/.guard");
|
406
435
|
|
407
436
|
if (geteuid() == 0) {
|
408
437
|
if (userSwitching) {
|
@@ -436,6 +465,7 @@ createPassengerTempDir(const string &parentDir, bool userSwitching,
|
|
436
465
|
*/
|
437
466
|
makeDirTree(tmpDir + "/backends", "u=wxs,g=,o=");
|
438
467
|
}
|
468
|
+
createNonWritableFifo(tmpDir + "/backends/.guard");
|
439
469
|
}
|
440
470
|
|
441
471
|
void
|
@@ -579,11 +609,7 @@ createUnixServer(const char *filename, unsigned int backlogSize, bool autoDelete
|
|
579
609
|
}
|
580
610
|
|
581
611
|
if (backlogSize == 0) {
|
582
|
-
|
583
|
-
backlogSize = SOMAXCONN;
|
584
|
-
#else
|
585
|
-
backlogSize = 128;
|
586
|
-
#endif
|
612
|
+
backlogSize = 1024;
|
587
613
|
}
|
588
614
|
try {
|
589
615
|
ret = syscalls::listen(fd, backlogSize);
|
data/ext/common/Version.h
CHANGED
data/ext/nginx/Configuration.c
CHANGED
@@ -153,8 +153,8 @@ passenger_create_loc_conf(ngx_conf_t *cf)
|
|
153
153
|
conf->spawn_method.data = NULL;
|
154
154
|
conf->spawn_method.len = 0;
|
155
155
|
conf->base_uris = NGX_CONF_UNSET_PTR;
|
156
|
-
conf->framework_spawner_idle_time =
|
157
|
-
conf->app_spawner_idle_time =
|
156
|
+
conf->framework_spawner_idle_time = NGX_CONF_UNSET;
|
157
|
+
conf->app_spawner_idle_time = NGX_CONF_UNSET;
|
158
158
|
|
159
159
|
conf->upstream.store = NGX_CONF_UNSET;
|
160
160
|
conf->upstream.store_access = NGX_CONF_UNSET_UINT;
|
@@ -232,12 +232,8 @@ passenger_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
232
232
|
ngx_conf_merge_value(conf->use_global_queue, prev->use_global_queue, 0);
|
233
233
|
ngx_conf_merge_str_value(conf->environment, prev->environment, "production");
|
234
234
|
ngx_conf_merge_str_value(conf->spawn_method, prev->spawn_method, "smart-lv2");
|
235
|
-
|
236
|
-
|
237
|
-
}
|
238
|
-
if (conf->app_spawner_idle_time == -1 && prev->app_spawner_idle_time != -1) {
|
239
|
-
conf->app_spawner_idle_time = prev->app_spawner_idle_time;
|
240
|
-
}
|
235
|
+
ngx_conf_merge_value(conf->framework_spawner_idle_time, prev->framework_spawner_idle_time, (ngx_int_t) -1);
|
236
|
+
ngx_conf_merge_value(conf->app_spawner_idle_time, prev->app_spawner_idle_time, (ngx_int_t) -1);
|
241
237
|
|
242
238
|
if (prev->base_uris != NGX_CONF_UNSET_PTR) {
|
243
239
|
if (conf->base_uris == NGX_CONF_UNSET_PTR) {
|
data/ext/nginx/Configuration.h
CHANGED
@@ -43,8 +43,8 @@ typedef struct {
|
|
43
43
|
ngx_flag_t use_global_queue;
|
44
44
|
ngx_str_t environment;
|
45
45
|
ngx_str_t spawn_method;
|
46
|
-
|
47
|
-
|
46
|
+
ngx_int_t framework_spawner_idle_time;
|
47
|
+
ngx_int_t app_spawner_idle_time;
|
48
48
|
ngx_array_t *base_uris;
|
49
49
|
} passenger_loc_conf_t;
|
50
50
|
|
data/ext/nginx/ContentHandler.c
CHANGED
@@ -91,18 +91,18 @@ detect_application_type(const ngx_str_t *public_dir) {
|
|
91
91
|
|
92
92
|
ngx_memzero(filename, sizeof(filename));
|
93
93
|
ngx_snprintf(filename, sizeof(filename), "%s/%s",
|
94
|
-
public_dir->data, "../config
|
94
|
+
public_dir->data, "../config.ru");
|
95
95
|
if (file_exists(filename, 1)) {
|
96
|
-
return
|
96
|
+
return AP_RACK;
|
97
97
|
}
|
98
98
|
|
99
99
|
ngx_memzero(filename, sizeof(filename));
|
100
100
|
ngx_snprintf(filename, sizeof(filename), "%s/%s",
|
101
|
-
public_dir->data, "../config.
|
101
|
+
public_dir->data, "../config/environment.rb");
|
102
102
|
if (file_exists(filename, 1)) {
|
103
|
-
return
|
103
|
+
return AP_RAILS;
|
104
104
|
}
|
105
|
-
|
105
|
+
|
106
106
|
ngx_memzero(filename, sizeof(filename));
|
107
107
|
ngx_snprintf(filename, sizeof(filename), "%s/%s",
|
108
108
|
public_dir->data, "../passenger_wsgi.py");
|
@@ -325,14 +325,18 @@ create_request(ngx_http_request_t *r)
|
|
325
325
|
|
326
326
|
end = ngx_snprintf(framework_spawner_idle_time_string,
|
327
327
|
sizeof(framework_spawner_idle_time_string) - 1,
|
328
|
-
"%d",
|
328
|
+
"%d",
|
329
|
+
(slcf->framework_spawner_idle_time == (ngx_int_t) -1) ?
|
330
|
+
-1 : slcf->framework_spawner_idle_time);
|
329
331
|
*end = '\0';
|
330
332
|
len += sizeof("PASSENGER_FRAMEWORK_SPAWNER_IDLE_TIME") +
|
331
333
|
ngx_strlen(framework_spawner_idle_time_string) + 1;
|
332
334
|
|
333
335
|
end = ngx_snprintf(app_spawner_idle_time_string,
|
334
336
|
sizeof(app_spawner_idle_time_string) - 1,
|
335
|
-
"%d",
|
337
|
+
"%d",
|
338
|
+
(slcf->app_spawner_idle_time == (ngx_int_t) -1) ?
|
339
|
+
-1 : slcf->app_spawner_idle_time);
|
336
340
|
*end = '\0';
|
337
341
|
len += sizeof("PASSENGER_APP_SPAWNER_IDLE_TIME") +
|
338
342
|
ngx_strlen(app_spawner_idle_time_string) + 1;
|
data/ext/oxt/thread.hpp
CHANGED
@@ -108,15 +108,6 @@ private:
|
|
108
108
|
}
|
109
109
|
|
110
110
|
public:
|
111
|
-
/**
|
112
|
-
* The platform's minimum stack size, in bytes.
|
113
|
-
*/
|
114
|
-
#if defined(PTHREAD_STACK_MIN)
|
115
|
-
static const unsigned int MIN_STACK_SIZE = PTHREAD_STACK_MIN;
|
116
|
-
#else
|
117
|
-
static const unsigned int MIN_STACK_SIZE = 1024 * 128;
|
118
|
-
#endif
|
119
|
-
|
120
111
|
/**
|
121
112
|
* Create a new thread.
|
122
113
|
*
|
@@ -139,8 +130,18 @@ public:
|
|
139
130
|
initialize_data(name);
|
140
131
|
|
141
132
|
set_thread_main_function(boost::bind(thread_main, func, data));
|
142
|
-
|
143
|
-
|
133
|
+
|
134
|
+
unsigned long min_stack_size;
|
135
|
+
#ifdef PTHREAD_STACK_MIN
|
136
|
+
// PTHREAD_STACK_MIN may not be a constant macro so we need
|
137
|
+
// to evaluate it dynamically.
|
138
|
+
min_stack_size = PTHREAD_STACK_MIN;
|
139
|
+
#else
|
140
|
+
// Assume minimum stack size is 128 KB.
|
141
|
+
min_stack_size = 128 * 1024;
|
142
|
+
#endif
|
143
|
+
if (stack_size < min_stack_size) {
|
144
|
+
stack_size = min_stack_size;
|
144
145
|
}
|
145
146
|
start_thread(stack_size);
|
146
147
|
}
|
@@ -24,7 +24,7 @@
|
|
24
24
|
module PhusionPassenger
|
25
25
|
# Phusion Passenger version number.
|
26
26
|
# Don't forget to edit ext/common/Version.h too.
|
27
|
-
VERSION_STRING = '2.2.
|
27
|
+
VERSION_STRING = '2.2.6'
|
28
28
|
|
29
29
|
DEFAULT_FRAMEWORK_SPAWNER_MAX_IDLE_TIME = 30 * 60
|
30
30
|
DEFAULT_APP_SPAWNER_MAX_IDLE_TIME = 10 * 60
|
@@ -112,12 +112,14 @@ module Dependencies # :nodoc: all
|
|
112
112
|
end
|
113
113
|
end
|
114
114
|
if RUBY_PLATFORM =~ /linux/
|
115
|
-
|
116
|
-
|
115
|
+
tags = PlatformInfo.linux_distro_tags
|
116
|
+
if tags.include?(:debian)
|
117
117
|
dep.install_command = "apt-get install build-essential"
|
118
|
-
|
118
|
+
elsif tags.include?(:mandriva)
|
119
|
+
dep.install_command = "urpmi gcc-c++"
|
120
|
+
elsif tags.include?(:redhat)
|
119
121
|
dep.install_command = "yum install gcc-c++"
|
120
|
-
|
122
|
+
elsif tags.include?(:gentoo)
|
121
123
|
dep.install_command = "emerge -av gcc"
|
122
124
|
end
|
123
125
|
elsif RUBY_PLATFORM =~ /darwin/
|
@@ -142,12 +144,14 @@ module Dependencies # :nodoc: all
|
|
142
144
|
end
|
143
145
|
end
|
144
146
|
if RUBY_PLATFORM =~ /linux/
|
145
|
-
|
146
|
-
|
147
|
+
tags = PlatformInfo.linux_distro_tags
|
148
|
+
if tags.include?(:debian)
|
147
149
|
dep.install_command = "apt-get install ruby1.8-dev"
|
148
|
-
|
150
|
+
elsif tags.include?(:mandriva)
|
151
|
+
dep.install_command = "urpmi urpmi ruby-RubyGems"
|
152
|
+
elsif tags.include?(:redhat)
|
149
153
|
dep.install_command = "yum install ruby-devel"
|
150
|
-
|
154
|
+
elsif tags.include?(:gentoo)
|
151
155
|
dep.install_command = "emerge -av ruby"
|
152
156
|
end
|
153
157
|
elsif RUBY_PLATFORM =~ /freebsd/
|
@@ -218,12 +222,14 @@ module Dependencies # :nodoc: all
|
|
218
222
|
end
|
219
223
|
end
|
220
224
|
if RUBY_PLATFORM =~ /linux/
|
221
|
-
|
222
|
-
|
225
|
+
tags = PlatformInfo.linux_distro_tags
|
226
|
+
if tags.include?(:debian)
|
223
227
|
dep.install_command = "apt-get install apache2-mpm-prefork"
|
224
|
-
|
228
|
+
elsif tags.include?(:mandriva)
|
229
|
+
dep.install_command = "urpmi apache"
|
230
|
+
elsif tags.include?(:redhat)
|
225
231
|
dep.install_command = "yum install httpd"
|
226
|
-
|
232
|
+
elsif tags.include?(:gentoo)
|
227
233
|
dep.install_command = "emerge -av apache"
|
228
234
|
end
|
229
235
|
elsif RUBY_PLATFORM =~ /freebsd/
|
@@ -243,14 +249,17 @@ module Dependencies # :nodoc: all
|
|
243
249
|
end
|
244
250
|
end
|
245
251
|
if RUBY_PLATFORM =~ /linux/
|
246
|
-
|
247
|
-
|
252
|
+
tags = PlatformInfo.linux_distro_tags
|
253
|
+
if tags.include?(:debian)
|
248
254
|
dep.install_command = "apt-get install apache2-prefork-dev"
|
249
255
|
dep.provides = [Apache2]
|
250
|
-
|
256
|
+
elsif tags.include?(:mandriva)
|
257
|
+
dep.install_command = "urpmi apache-devel"
|
258
|
+
dep.provides = [Apache2]
|
259
|
+
elsif tags.include?(:redhat)
|
251
260
|
dep.install_command = "yum install httpd-devel"
|
252
261
|
dep.provides = [Apache2]
|
253
|
-
|
262
|
+
elsif tags.include?(:gentoo)
|
254
263
|
dep.install_command = "emerge -av apache"
|
255
264
|
dep.provides = [Apache2]
|
256
265
|
end
|
@@ -270,12 +279,14 @@ module Dependencies # :nodoc: all
|
|
270
279
|
end
|
271
280
|
end
|
272
281
|
if RUBY_PLATFORM =~ /linux/
|
273
|
-
|
274
|
-
|
282
|
+
tags = PlatformInfo.linux_distro_tags
|
283
|
+
if tags.include?(:debian)
|
275
284
|
dep.install_command = "apt-get install libapr1-dev"
|
276
|
-
|
285
|
+
elsif tags.include?(:mandriva)
|
286
|
+
dep.install_command = "urpmi libapr-devel"
|
287
|
+
elsif tags.include?(:redhat)
|
277
288
|
dep.install_command = "yum install apr-devel"
|
278
|
-
|
289
|
+
elsif tags.include?(:gentoo)
|
279
290
|
dep.install_command = "emerge -av apr"
|
280
291
|
end
|
281
292
|
elsif RUBY_PLATFORM =~ /darwin/
|
@@ -297,9 +308,11 @@ module Dependencies # :nodoc: all
|
|
297
308
|
end
|
298
309
|
end
|
299
310
|
if RUBY_PLATFORM =~ /linux/
|
300
|
-
|
301
|
-
|
311
|
+
tags = PlatformInfo.linux_distro_tags
|
312
|
+
if tags.include?(:debian)
|
302
313
|
dep.install_command = "apt-get install libaprutil1-dev"
|
314
|
+
elsif tags.include?(:mandriva)
|
315
|
+
dep.install_command = "urpmi libapr-util-devel"
|
303
316
|
end
|
304
317
|
elsif RUBY_PLATFORM =~ /darwin/
|
305
318
|
dep.install_instructions = "Please install Apache from MacPorts, which will " <<
|
@@ -364,10 +377,12 @@ module Dependencies # :nodoc: all
|
|
364
377
|
end
|
365
378
|
end
|
366
379
|
if RUBY_PLATFORM =~ /linux/
|
367
|
-
|
368
|
-
|
380
|
+
tags = PlatformInfo.linux_distro_tags
|
381
|
+
if tags.include?(:debian)
|
369
382
|
dep.install_command = "apt-get install zlib1g-dev"
|
370
|
-
|
383
|
+
elsif tags.include?(:mandriva)
|
384
|
+
dep.install_command = "urpmi zlib1-devel"
|
385
|
+
elsif tags.include?(:redhat)
|
371
386
|
dep.install_command = "yum install zlib-devel"
|
372
387
|
end
|
373
388
|
end
|
@@ -397,6 +397,8 @@ public
|
|
397
397
|
options = apxs2_flags.split
|
398
398
|
options.reject! { |f| f =~ /^\-x/ }
|
399
399
|
options.reject! { |f| f =~ /^\-Xa/ }
|
400
|
+
options.reject! { |f| f =~ /^\-fast/ }
|
401
|
+
options.reject! { |f| f =~ /^\-mt/ }
|
400
402
|
apxs2_flags = options.join(' ')
|
401
403
|
end
|
402
404
|
|
@@ -501,33 +503,48 @@ public
|
|
501
503
|
|
502
504
|
# An identifier for the current Linux distribution. nil if the operating system is not Linux.
|
503
505
|
def self.linux_distro
|
506
|
+
tags = linux_distro_tags
|
507
|
+
if tags
|
508
|
+
return tags.first
|
509
|
+
else
|
510
|
+
return nil
|
511
|
+
end
|
512
|
+
end
|
513
|
+
|
514
|
+
# Autodetects the current Linux distribution and return a number of identifier tags.
|
515
|
+
# The first tag identifies the distribution while the other tags indicate which
|
516
|
+
# distributions it is likely compatible with.
|
517
|
+
# Returns nil if the operating system is not Linux.
|
518
|
+
def self.linux_distro_tags
|
504
519
|
if RUBY_PLATFORM !~ /linux/
|
505
520
|
return nil
|
506
521
|
end
|
507
522
|
lsb_release = read_file("/etc/lsb-release")
|
508
523
|
if lsb_release =~ /Ubuntu/
|
509
|
-
return :ubuntu
|
524
|
+
return [:ubuntu, :debian]
|
510
525
|
elsif File.exist?("/etc/debian_version")
|
511
|
-
return :debian
|
526
|
+
return [:debian]
|
512
527
|
elsif File.exist?("/etc/redhat-release")
|
513
528
|
redhat_release = read_file("/etc/redhat-release")
|
514
529
|
if redhat_release =~ /CentOS/
|
515
|
-
return :centos
|
516
|
-
elsif redhat_release =~ /Fedora/
|
517
|
-
return :fedora
|
530
|
+
return [:centos, :redhat]
|
531
|
+
elsif redhat_release =~ /Fedora/
|
532
|
+
return [:fedora, :redhat]
|
533
|
+
elsif redhat_release =~ /Mandriva/
|
534
|
+
return [:mandriva, :redhat]
|
518
535
|
else
|
519
536
|
# On official RHEL distros, the content is in the form of
|
520
537
|
# "Red Hat Enterprise Linux Server release 5.1 (Tikanga)"
|
521
|
-
return :rhel
|
538
|
+
return [:rhel, :redhat]
|
522
539
|
end
|
523
540
|
elsif File.exist?("/etc/suse-release")
|
524
|
-
return :suse
|
541
|
+
return [:suse]
|
525
542
|
elsif File.exist?("/etc/gentoo-release")
|
526
|
-
return :gentoo
|
543
|
+
return [:gentoo]
|
527
544
|
else
|
528
|
-
return :unknown
|
545
|
+
return [:unknown]
|
529
546
|
end
|
530
|
-
# TODO: Slackware
|
547
|
+
# TODO: Slackware
|
531
548
|
end
|
532
|
-
memoize :
|
549
|
+
memoize :linux_distro_tags
|
533
550
|
end
|
@@ -169,12 +169,8 @@ class ApplicationSpawner < AbstractServer
|
|
169
169
|
if @lower_privilege
|
170
170
|
lower_privilege('config/environment.rb', @lowest_user)
|
171
171
|
end
|
172
|
-
|
173
|
-
|
174
|
-
# which normally does: require File.dirname(__FILE__) + "/../config/environment"
|
175
|
-
# thus avoiding the possibility of including the same file twice.
|
176
|
-
require 'public/../config/environment'
|
177
|
-
|
172
|
+
|
173
|
+
require File.expand_path('config/environment')
|
178
174
|
require 'dispatcher'
|
179
175
|
end
|
180
176
|
if success
|
@@ -298,7 +294,7 @@ private
|
|
298
294
|
end
|
299
295
|
end
|
300
296
|
if File.exist?('config/preinitializer.rb')
|
301
|
-
require 'config/preinitializer'
|
297
|
+
require File.expand_path('config/preinitializer')
|
302
298
|
end
|
303
299
|
require File.expand_path('config/environment')
|
304
300
|
if ActionController::Base.page_cache_directory.blank?
|