doc/rdoc/classes/PhusionPassenger/SpawnManager.html in passenger-2.2.4 vs doc/rdoc/classes/PhusionPassenger/SpawnManager.html in passenger-2.2.5

- old
+ new

@@ -83,13 +83,13 @@ fascade for the rest of the spawn manager system. </p> <p> <b>Note</b>: <a href="SpawnManager.html">SpawnManager</a> may only be started synchronously with <a -href="AbstractServer.html#M000131">AbstractServer#start_synchronously</a>. +href="AbstractServer.html#M000135">AbstractServer#start_synchronously</a>. Starting asynchronously has not been tested. Don&#8216;t forget to call <a -href="SpawnManager.html#M000119">cleanup</a> after the server&#8216;s main +href="SpawnManager.html#M000123">cleanup</a> after the server&#8216;s main loop has finished. </p> <h2>Ruby on Rails optimizations</h2> <p> Spawning a Ruby on Rails application is usually slow. But <a @@ -114,14 +114,14 @@ <div class="sectiontitle">Methods</div> <ul> - <li><a href="#M000119">cleanup</a></li> - <li><a href="#M000116">new</a></li> - <li><a href="#M000118">reload</a></li> - <li><a href="#M000117">spawn_application</a></li> + <li><a href="#M000123">cleanup</a></li> + <li><a href="#M000120">new</a></li> + <li><a href="#M000122">reload</a></li> + <li><a href="#M000121">spawn_application</a></li> </ul> <div class="sectiontitle">Included Modules</div> <ul> <li><a href="Utils.html">Utils</a></li> @@ -132,136 +132,136 @@ <div class="sectiontitle">Public Class methods</div> <div class="method"> <div class="title"> - <a name="M000116"></a><b>new</b>() + <a name="M000120"></a><b>new</b>() </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000116_source')" id="l_M000116_source">show source</a> ]</p> - <div id="M000116_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000120_source')" id="l_M000120_source">show source</a> ]</p> + <div id="M000120_source" class="dyn-source"> <pre> - <span class="ruby-comment cmt"># File lib/phusion_passenger/spawn_manager.rb, line 60</span> -60: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> -61: <span class="ruby-keyword kw">super</span>() -62: <span class="ruby-ivar">@spawners</span> = <span class="ruby-constant">AbstractServerCollection</span>.<span class="ruby-identifier">new</span> -63: <span class="ruby-identifier">define_message_handler</span>(<span class="ruby-identifier">:spawn_application</span>, <span class="ruby-identifier">:handle_spawn_application</span>) -64: <span class="ruby-identifier">define_message_handler</span>(<span class="ruby-identifier">:reload</span>, <span class="ruby-identifier">:handle_reload</span>) -65: <span class="ruby-identifier">define_signal_handler</span>(<span class="ruby-value str">'SIGHUP'</span>, <span class="ruby-identifier">:reload</span>) -66: -67: <span class="ruby-comment cmt"># Start garbage collector in order to free up some existing</span> -68: <span class="ruby-comment cmt"># heap slots. This prevents the heap from growing unnecessarily</span> -69: <span class="ruby-comment cmt"># during the startup phase.</span> -70: <span class="ruby-constant">GC</span>.<span class="ruby-identifier">start</span> -71: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">GC</span>.<span class="ruby-identifier">copy_on_write_friendly?</span> -72: <span class="ruby-comment cmt"># Preload libraries for copy-on-write semantics.</span> -73: <span class="ruby-identifier">require</span> <span class="ruby-value str">'base64'</span> -74: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/application'</span> -75: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/railz/framework_spawner'</span> -76: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/railz/application_spawner'</span> -77: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/rack/application_spawner'</span> -78: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/html_template'</span> -79: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/platform_info'</span> -80: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/exceptions'</span> -81: -82: <span class="ruby-comment cmt"># Commonly used libraries.</span> -83: [<span class="ruby-value str">'mysql'</span>, <span class="ruby-value str">'sqlite3'</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">lib</span><span class="ruby-operator">|</span> -84: <span class="ruby-keyword kw">begin</span> -85: <span class="ruby-identifier">require</span> <span class="ruby-identifier">lib</span> -86: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">LoadError</span> -87: <span class="ruby-comment cmt"># Do nothing; ignore if not present.</span> -88: <span class="ruby-keyword kw">end</span> -89: <span class="ruby-keyword kw">end</span> -90: <span class="ruby-keyword kw">end</span> -91: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File lib/phusion_passenger/spawn_manager.rb, line 61</span> +61: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> +62: <span class="ruby-keyword kw">super</span>() +63: <span class="ruby-ivar">@spawners</span> = <span class="ruby-constant">AbstractServerCollection</span>.<span class="ruby-identifier">new</span> +64: <span class="ruby-identifier">define_message_handler</span>(<span class="ruby-identifier">:spawn_application</span>, <span class="ruby-identifier">:handle_spawn_application</span>) +65: <span class="ruby-identifier">define_message_handler</span>(<span class="ruby-identifier">:reload</span>, <span class="ruby-identifier">:handle_reload</span>) +66: <span class="ruby-identifier">define_signal_handler</span>(<span class="ruby-value str">'SIGHUP'</span>, <span class="ruby-identifier">:reload</span>) +67: +68: <span class="ruby-comment cmt"># Start garbage collector in order to free up some existing</span> +69: <span class="ruby-comment cmt"># heap slots. This prevents the heap from growing unnecessarily</span> +70: <span class="ruby-comment cmt"># during the startup phase.</span> +71: <span class="ruby-constant">GC</span>.<span class="ruby-identifier">start</span> +72: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">GC</span>.<span class="ruby-identifier">copy_on_write_friendly?</span> +73: <span class="ruby-comment cmt"># Preload libraries for copy-on-write semantics.</span> +74: <span class="ruby-identifier">require</span> <span class="ruby-value str">'base64'</span> +75: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/application'</span> +76: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/railz/framework_spawner'</span> +77: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/railz/application_spawner'</span> +78: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/rack/application_spawner'</span> +79: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/html_template'</span> +80: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/platform_info'</span> +81: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/exceptions'</span> +82: +83: <span class="ruby-comment cmt"># Commonly used libraries.</span> +84: [<span class="ruby-value str">'mysql'</span>, <span class="ruby-value str">'sqlite3'</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">lib</span><span class="ruby-operator">|</span> +85: <span class="ruby-keyword kw">begin</span> +86: <span class="ruby-identifier">require</span> <span class="ruby-identifier">lib</span> +87: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">LoadError</span> +88: <span class="ruby-comment cmt"># Do nothing; ignore if not present.</span> +89: <span class="ruby-keyword kw">end</span> +90: <span class="ruby-keyword kw">end</span> +91: <span class="ruby-keyword kw">end</span> +92: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> <div class="sectiontitle">Public Instance methods</div> <div class="method"> <div class="title"> - <a name="M000119"></a><b>cleanup</b>() + <a name="M000123"></a><b>cleanup</b>() </div> <div class="description"> <p> Cleanup resources. Should be called when this <a href="SpawnManager.html">SpawnManager</a> is no longer needed. </p> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000119_source')" id="l_M000119_source">show source</a> ]</p> - <div id="M000119_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000123_source')" id="l_M000123_source">show source</a> ]</p> + <div id="M000123_source" class="dyn-source"> <pre> - <span class="ruby-comment cmt"># File lib/phusion_passenger/spawn_manager.rb, line 214</span> -214: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cleanup</span> -215: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">cleanup</span> -216: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File lib/phusion_passenger/spawn_manager.rb, line 215</span> +215: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cleanup</span> +216: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">cleanup</span> +217: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000118"></a><b>reload</b>(app_root = nil) + <a name="M000122"></a><b>reload</b>(app_root = nil) </div> <div class="description"> <p> Remove the cached application instances at the given application root. If nil is specified as application root, then all cached application instances will be removed, no matter the application root. </p> <p> <b>Long description:</b> <a href="Application.html">Application</a> code might be cached in memory. But once it a while, it will be necessary to <a -href="SpawnManager.html#M000118">reload</a> the code for an application, -such as after deploying a <a href="SpawnManager.html#M000116">new</a> +href="SpawnManager.html#M000122">reload</a> the code for an application, +such as after deploying a <a href="SpawnManager.html#M000120">new</a> version of the application. This method makes sure that any cached application code is removed, so that the next time an application instance is spawned, the application code will be freshly loaded into memory. </p> <p> Raises AbstractServer::SpawnError if something went wrong. </p> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000118_source')" id="l_M000118_source">show source</a> ]</p> - <div id="M000118_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000122_source')" id="l_M000122_source">show source</a> ]</p> + <div id="M000122_source" class="dyn-source"> <pre> - <span class="ruby-comment cmt"># File lib/phusion_passenger/spawn_manager.rb, line 187</span> -187: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reload</span>(<span class="ruby-identifier">app_root</span> = <span class="ruby-keyword kw">nil</span>) -188: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span> -189: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">app_root</span> -190: <span class="ruby-comment cmt"># Delete associated ApplicationSpawner.</span> -191: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-node">&quot;app:#{app_root}&quot;</span>) -192: <span class="ruby-keyword kw">else</span> -193: <span class="ruby-comment cmt"># Delete all ApplicationSpawners.</span> -194: <span class="ruby-identifier">keys_to_delete</span> = [] -195: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">each_pair</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">spawner</span><span class="ruby-operator">|</span> -196: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Railz</span><span class="ruby-operator">::</span><span class="ruby-constant">ApplicationSpawner</span>) -197: <span class="ruby-identifier">keys_to_delete</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">key</span> -198: <span class="ruby-keyword kw">end</span> -199: <span class="ruby-keyword kw">end</span> -200: <span class="ruby-identifier">keys_to_delete</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span> -201: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>) -202: <span class="ruby-keyword kw">end</span> -203: <span class="ruby-keyword kw">end</span> -204: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">spawner</span><span class="ruby-operator">|</span> -205: <span class="ruby-comment cmt"># Reload all FrameworkSpawners.</span> -206: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:reload</span>) -207: <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">reload</span>(<span class="ruby-identifier">app_root</span>) -208: <span class="ruby-keyword kw">end</span> -209: <span class="ruby-keyword kw">end</span> -210: <span class="ruby-keyword kw">end</span> -211: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File lib/phusion_passenger/spawn_manager.rb, line 188</span> +188: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reload</span>(<span class="ruby-identifier">app_root</span> = <span class="ruby-keyword kw">nil</span>) +189: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span> +190: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">app_root</span> +191: <span class="ruby-comment cmt"># Delete associated ApplicationSpawner.</span> +192: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-node">&quot;app:#{app_root}&quot;</span>) +193: <span class="ruby-keyword kw">else</span> +194: <span class="ruby-comment cmt"># Delete all ApplicationSpawners.</span> +195: <span class="ruby-identifier">keys_to_delete</span> = [] +196: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">each_pair</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">spawner</span><span class="ruby-operator">|</span> +197: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Railz</span><span class="ruby-operator">::</span><span class="ruby-constant">ApplicationSpawner</span>) +198: <span class="ruby-identifier">keys_to_delete</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">key</span> +199: <span class="ruby-keyword kw">end</span> +200: <span class="ruby-keyword kw">end</span> +201: <span class="ruby-identifier">keys_to_delete</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span> +202: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>) +203: <span class="ruby-keyword kw">end</span> +204: <span class="ruby-keyword kw">end</span> +205: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">spawner</span><span class="ruby-operator">|</span> +206: <span class="ruby-comment cmt"># Reload all FrameworkSpawners.</span> +207: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:reload</span>) +208: <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">reload</span>(<span class="ruby-identifier">app_root</span>) +209: <span class="ruby-keyword kw">end</span> +210: <span class="ruby-keyword kw">end</span> +211: <span class="ruby-keyword kw">end</span> +212: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000117"></a><b>spawn_application</b>(options) + <a name="M000121"></a><b>spawn_application</b>(options) </div> <div class="description"> <p> Spawn an application with the given spawn options. When successful, an <a href="Application.html">Application</a> object will be returned, which @@ -286,16 +286,16 @@ implies that, if you&#8216;ve changed the application&#8216;s code, you must do one of these things: <ul> <li>Restart this <a href="SpawnManager.html">SpawnManager</a> by calling <a -href="AbstractServer.html#M000132">AbstractServer#stop</a>, then <a -href="AbstractServer.html#M000130">AbstractServer#start</a>. +href="AbstractServer.html#M000136">AbstractServer#stop</a>, then <a +href="AbstractServer.html#M000134">AbstractServer#start</a>. </li> <li>Reload the application by calling <a -href="SpawnManager.html#M000118">reload</a> with the correct app_root +href="SpawnManager.html#M000122">reload</a> with the correct app_root argument. </li> </ul> <p> @@ -352,45 +352,45 @@ </li> </ul> </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000117_source')" id="l_M000117_source">show source</a> ]</p> - <div id="M000117_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000121_source')" id="l_M000121_source">show source</a> ]</p> + <div id="M000121_source" class="dyn-source"> <pre> - <span class="ruby-comment cmt"># File lib/phusion_passenger/spawn_manager.rb, line 141</span> -141: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">spawn_application</span>(<span class="ruby-identifier">options</span>) -142: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_root&quot;</span>] -143: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;The 'app_root' option must be given.&quot;</span> -144: <span class="ruby-keyword kw">end</span> -145: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">sanitize_spawn_options</span>(<span class="ruby-identifier">options</span>) -146: -147: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_type&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;rails&quot;</span> -148: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">Railz</span><span class="ruby-operator">::</span><span class="ruby-constant">FrameworkSpawner</span>) -149: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/application'</span> -150: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/railz/framework_spawner'</span> -151: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/railz/application_spawner'</span> -152: <span class="ruby-keyword kw">end</span> -153: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">spawn_rails_application</span>(<span class="ruby-identifier">options</span>) -154: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_type&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;rack&quot;</span> -155: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">ApplicationSpawner</span>) -156: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/rack/application_spawner'</span> -157: <span class="ruby-keyword kw">end</span> -158: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">ApplicationSpawner</span>.<span class="ruby-identifier">spawn_application</span>( -159: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_root&quot;</span>], <span class="ruby-identifier">options</span> -160: ) -161: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_type&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;wsgi&quot;</span> -162: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/wsgi/application_spawner'</span> -163: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">WSGI</span><span class="ruby-operator">::</span><span class="ruby-constant">ApplicationSpawner</span>.<span class="ruby-identifier">spawn_application</span>( -164: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_root&quot;</span>], -165: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;lower_privilege&quot;</span>], -166: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;lowest_user&quot;</span>], -167: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;environment&quot;</span>] -168: ) -169: <span class="ruby-keyword kw">else</span> -170: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;Unknown 'app_type' value '#{options[&quot;app_type&quot;]}'.&quot;</span> -171: <span class="ruby-keyword kw">end</span> -172: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File lib/phusion_passenger/spawn_manager.rb, line 142</span> +142: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">spawn_application</span>(<span class="ruby-identifier">options</span>) +143: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_root&quot;</span>] +144: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;The 'app_root' option must be given.&quot;</span> +145: <span class="ruby-keyword kw">end</span> +146: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">sanitize_spawn_options</span>(<span class="ruby-identifier">options</span>) +147: +148: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_type&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;rails&quot;</span> +149: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">Railz</span><span class="ruby-operator">::</span><span class="ruby-constant">FrameworkSpawner</span>) +150: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/application'</span> +151: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/railz/framework_spawner'</span> +152: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/railz/application_spawner'</span> +153: <span class="ruby-keyword kw">end</span> +154: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">spawn_rails_application</span>(<span class="ruby-identifier">options</span>) +155: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_type&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;rack&quot;</span> +156: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">ApplicationSpawner</span>) +157: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/rack/application_spawner'</span> +158: <span class="ruby-keyword kw">end</span> +159: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">ApplicationSpawner</span>.<span class="ruby-identifier">spawn_application</span>( +160: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_root&quot;</span>], <span class="ruby-identifier">options</span> +161: ) +162: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_type&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;wsgi&quot;</span> +163: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/wsgi/application_spawner'</span> +164: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">WSGI</span><span class="ruby-operator">::</span><span class="ruby-constant">ApplicationSpawner</span>.<span class="ruby-identifier">spawn_application</span>( +165: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_root&quot;</span>], +166: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;lower_privilege&quot;</span>], +167: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;lowest_user&quot;</span>], +168: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;environment&quot;</span>] +169: ) +170: <span class="ruby-keyword kw">else</span> +171: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;Unknown 'app_type' value '#{options[&quot;app_type&quot;]}'.&quot;</span> +172: <span class="ruby-keyword kw">end</span> +173: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> </div> \ No newline at end of file