We got nominated! Help us out and vote for GitHub as Best Bootstrapped Startup of 2008. (You can vote once a day.) [ hide ]

public
Description: Phusion Passenger (mod_rails)
Homepage: http://www.modrails.com/
Clone URL: git://github.com/FooBarWidget/passenger.git
Click here to lend your support to: passenger and make a donation at www.pledgie.com !
Begin implementing autoloading support for better startup time.
Hongli Lai (Phusion) (author)
Thu May 08 03:21:56 -0700 2008
commit  0d948bcc4538806c2db5fc7515711c8d2e212f57
tree    39147540c06d6498c34410ae2032051f9696ba2c
parent  35cd99e99a36bfa8677f80370050917dd3f82c36
...
17
18
19
20
21
 
22
23
24
...
27
28
29
 
30
31
32
...
17
18
19
 
 
20
21
22
23
...
26
27
28
29
30
31
32
0
@@ -17,8 +17,7 @@
0
 
0
 require 'pathname'
0
 $LOAD_PATH.unshift(File.expand_path("#{File.dirname(__FILE__)}/../lib"))
0
-require 'passenger/spawn_manager'
0
-require 'passenger/utils'
0
+require 'passenger/passenger'
0
 
0
 begin
0
   STDOUT.sync = true
0
@@ -27,6 +26,7 @@ begin
0
   if GC.respond_to?(:copy_on_write_friendly=)
0
     GC.copy_on_write_friendly = true
0
   end
0
+
0
   spawn_manager = Passenger::SpawnManager.new
0
   input = IO.new(Passenger::SpawnManager::DEFAULT_INPUT_FD)
0
   spawn_manager.start_synchronously(input)
...
16
17
18
19
20
 
21
22
23
...
16
17
18
 
 
19
20
21
22
0
@@ -16,8 +16,7 @@
0
 
0
 require 'socket'
0
 require 'timeout'
0
-require 'passenger/message_channel'
0
-require 'passenger/utils'
0
+require 'passenger/passenger'
0
 module Passenger
0
 
0
 # An abstract base class for a server, with the following properties:
...
15
16
17
18
 
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
...
15
16
17
 
18
19
20
 
 
 
 
 
 
 
 
 
 
 
 
 
21
22
23
0
@@ -15,22 +15,9 @@
0
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
0
 
0
 require 'rubygems'
0
-require 'passenger/utils'
0
+require 'passenger/passenger'
0
 module Passenger
0
 
0
-# Indicates that there is no Ruby on Rails version installed that satisfies
0
-# a given Ruby on Rails Gem version specification.
0
-class VersionNotFound < StandardError
0
- attr_reader :gem_version_spec
0
-
0
- # - +message+: The exception message.
0
- # - +gem_version_spec+: The Ruby on Rails Gem version specification that caused this error.
0
- def initialize(message, gem_version_spec)
0
- super(message)
0
- @gem_version_spec = gem_version_spec
0
- end
0
-end
0
-
0
 # Represents a single Ruby on Rails application instance.
0
 class Application
0
   # The root directory of this application, i.e. the directory that contains
...
17
18
19
20
21
22
23
 
24
25
26
...
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
...
17
18
19
 
 
 
 
20
21
22
23
...
33
34
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
37
38
0
@@ -17,10 +17,7 @@
0
 require 'rubygems'
0
 require 'socket'
0
 require 'etc'
0
-require 'passenger/abstract_server'
0
-require 'passenger/application'
0
-require 'passenger/utils'
0
-require 'passenger/request_handler'
0
+require 'passenger/passenger'
0
 
0
 begin
0
   # Preload MySQL if possible. We want to preload it and we need
0
@@ -36,30 +33,6 @@ end
0
 
0
 module Passenger
0
 
0
-# An abstract base class for AppInitError and FrameworkInitError. This represents
0
-# the failure when initializing something.
0
-class InitializationError < StandardError
0
- # The exception that caused initialization to fail. This may be nil.
0
- attr_accessor :child_exception
0
-
0
- # Create a new InitializationError. +message+ is the error message,
0
- # and +child_exception+ is the exception that caused initialization
0
- # to fail.
0
- def initialize(message, child_exception = nil)
0
- super(message)
0
- @child_exception = child_exception
0
- end
0
-end
0
-
0
-# Raised when ApplicationSpawner, FrameworkSpawner or SpawnManager was unable
0
-# spawn a Ruby on Rails application, because the application either threw an
0
-# exception or called exit.
0
-#
0
-# If the +child_exception+ attribute is nil, then it means that the application
0
-# called exit.
0
-class AppInitError < InitializationError
0
-end
0
-
0
 # This class is capable of spawns instances of a single Ruby on Rails application.
0
 # It does so by preloading as much of the application's code as possible, then creating
0
 # instances of the application using what is already preloaded. This makes it spawning
...
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
...
17
18
19
 
 
 
20
21
22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
24
25
0
@@ -17,28 +17,9 @@
0
 require 'rubygems'
0
 require 'socket'
0
 require 'pathname'
0
-require 'passenger/abstract_server'
0
-require 'passenger/application_spawner'
0
-require 'passenger/utils'
0
+require 'passenger/passenger'
0
 module Passenger
0
 
0
-# Raised when FrameworkSpawner or SpawnManager was unable to load a version of
0
-# the Ruby on Rails framework. The +child_exception+ attribute is guaranteed
0
-# non-nil.
0
-class FrameworkInitError < InitializationError
0
- attr_reader :vendor
0
- attr_reader :version
0
-
0
- def initialize(message, child_exception, options)
0
- super(message, child_exception)
0
- if options[:vendor]
0
- @vendor = options[:vendor]
0
- else
0
- @version = options[:version]
0
- end
0
- end
0
-end
0
-
0
 # This class is capable of spawning Ruby on Rails application instances
0
 # quickly. This is done by preloading the Ruby on Rails framework into memory,
0
 # before spawning the application instances.
...
14
15
16
17
18
19
20
...
14
15
16
 
17
18
19
0
@@ -14,7 +14,6 @@
0
 # with this program; if not, write to the Free Software Foundation, Inc.,
0
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
0
 
0
-require 'passenger/utils'
0
 module Passenger
0
 
0
 # This class provides convenience methods for:
...
16
17
18
19
20
21
 
22
23
24
...
16
17
18
 
 
 
19
20
21
22
0
@@ -16,9 +16,7 @@
0
 
0
 require 'socket'
0
 require 'base64'
0
-require 'passenger/message_channel'
0
-require 'passenger/cgi_fixed'
0
-require 'passenger/utils'
0
+require 'passenger/passenger'
0
 module Passenger
0
 
0
 # The request handler's job is to process incoming HTTP requests using the
...
14
15
16
17
18
19
20
21
22
23
 
24
25
26
...
84
85
86
 
 
 
87
88
89
...
14
15
16
 
 
 
 
 
 
 
17
18
19
20
...
78
79
80
81
82
83
84
85
86
0
@@ -14,13 +14,7 @@
0
 # with this program; if not, write to the Free Software Foundation, Inc.,
0
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
0
 
0
-require 'passenger/abstract_server'
0
-require 'passenger/framework_spawner'
0
-require 'passenger/application'
0
-require 'passenger/message_channel'
0
-require 'passenger/html_template'
0
-require 'passenger/utils'
0
-require 'passenger/platform_info'
0
+require 'passenger/passenger'
0
 module Passenger
0
 
0
 # This class is capable of spawning Ruby on Rails application instances.
0
@@ -84,6 +78,9 @@ class SpawnManager < AbstractServer
0
   # - AppInitError: The application raised an exception or called exit() during startup.
0
   def spawn_application(app_root, lower_privilege = true, lowest_user = "nobody",
0
    environment = "production", spawn_method = "smart")
0
+ if GC.copy_on_write_friendly?
0
+ Passenger.load_all_classes!
0
+ end
0
     if spawn_method == "smart"
0
       framework_version = Application.detect_framework_version(app_root)
0
       if framework_version == :vendor
...
20
21
22
23
 
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
...
20
21
22
 
23
24
25
26
 
 
 
 
 
 
 
 
 
 
27
28
29
0
@@ -20,20 +20,10 @@ require 'etc'
0
 require 'thread'
0
 require 'fastthread'
0
 require 'timeout'
0
-require File.expand_path("#{File.dirname(__FILE__)}/../../ext/passenger/native_support.so")
0
+require 'passenger/passenger'
0
 
0
 module Passenger
0
 
0
-class UnknownError < StandardError
0
- attr_accessor :real_class_name
0
-
0
- def initialize(message, class_name, backtrace)
0
- super("#{message} (#{class_name})")
0
- set_backtrace(backtrace)
0
- @real_class_name = class_name
0
- end
0
-end
0
-
0
 # Utility functions.
0
 module Utils
0
 protected
...
1
2
3
4
5
6
...
1
2
 
3
4
5
0
@@ -1,6 +1,5 @@
0
 require 'support/config'
0
 require 'support/test_helper'
0
-require 'passenger/application_spawner'
0
 
0
 require 'minimal_spawner_spec'
0
 require 'spawn_server_spec'
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 $LOAD_PATH << File.expand_path("#{File.dirname(__FILE__)}/../../lib")
0
 require 'yaml'
0
+require 'passenger/passenger'
0
+
0
 begin
0
   CONFIG = YAML::load_file('config.yml')
0
 rescue Errno::ENOENT

Comments

    No one has commented yet.