doc/rdoc/classes/PhusionPassenger/SpawnManager.html in passenger-2.1.3 vs doc/rdoc/classes/PhusionPassenger/SpawnManager.html in passenger-2.2.0

- 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#M000125">AbstractServer#start_synchronously</a>. +href="AbstractServer.html#M000127">AbstractServer#start_synchronously</a>. Starting asynchronously has not been tested. Don&#8216;t forget to call <a -href="SpawnManager.html#M000118">cleanup</a> after the server&#8216;s main +href="SpawnManager.html#M000115">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="#M000118">cleanup</a></li> - <li><a href="#M000115">new</a></li> - <li><a href="#M000117">reload</a></li> - <li><a href="#M000116">spawn_application</a></li> + <li><a href="#M000115">cleanup</a></li> + <li><a href="#M000112">new</a></li> + <li><a href="#M000114">reload</a></li> + <li><a href="#M000113">spawn_application</a></li> </ul> <div class="sectiontitle">Included Modules</div> <ul> <li><a href="Utils.html">Utils</a></li> @@ -132,142 +132,136 @@ <div class="sectiontitle">Public Class methods</div> <div class="method"> <div class="title"> - <a name="M000115"></a><b>new</b>() + <a name="M000112"></a><b>new</b>() </div> <div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('M000115_source')" id="l_M000115_source">show source</a> ]</p> - <div id="M000115_source" class="dyn-source"> + <p class="source-link">[ <a href="javascript:toggleSource('M000112_source')" id="l_M000112_source">show source</a> ]</p> + <div id="M000112_source" class="dyn-source"> <pre> - <span class="ruby-comment cmt"># File lib/phusion_passenger/spawn_manager.rb, line 55</span> -55: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> -56: <span class="ruby-keyword kw">super</span>() -57: <span class="ruby-ivar">@spawners</span> = <span class="ruby-constant">AbstractServerCollection</span>.<span class="ruby-identifier">new</span> -58: <span class="ruby-identifier">define_message_handler</span>(<span class="ruby-identifier">:spawn_application</span>, <span class="ruby-identifier">:handle_spawn_application</span>) -59: <span class="ruby-identifier">define_message_handler</span>(<span class="ruby-identifier">:reload</span>, <span class="ruby-identifier">:handle_reload</span>) -60: <span class="ruby-identifier">define_signal_handler</span>(<span class="ruby-value str">'SIGHUP'</span>, <span class="ruby-identifier">:reload</span>) -61: -62: <span class="ruby-comment cmt"># Start garbage collector in order to free up some existing</span> -63: <span class="ruby-comment cmt"># heap slots. This prevents the heap from growing unnecessarily</span> -64: <span class="ruby-comment cmt"># during the startup phase.</span> -65: <span class="ruby-constant">GC</span>.<span class="ruby-identifier">start</span> -66: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">GC</span>.<span class="ruby-identifier">copy_on_write_friendly?</span> -67: <span class="ruby-comment cmt"># Preload libraries for copy-on-write semantics.</span> -68: <span class="ruby-identifier">require</span> <span class="ruby-value str">'base64'</span> -69: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/application'</span> -70: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/railz/framework_spawner'</span> -71: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/railz/application_spawner'</span> -72: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/rack/application_spawner'</span> -73: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/html_template'</span> -74: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/platform_info'</span> -75: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/exceptions'</span> -76: -77: <span class="ruby-comment cmt"># Commonly used libraries.</span> -78: [<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> -79: <span class="ruby-keyword kw">begin</span> -80: <span class="ruby-identifier">require</span> <span class="ruby-identifier">lib</span> -81: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">LoadError</span> -82: <span class="ruby-comment cmt"># Do nothing; ignore if not present.</span> -83: <span class="ruby-keyword kw">end</span> -84: <span class="ruby-keyword kw">end</span> -85: <span class="ruby-keyword kw">end</span> -86: <span class="ruby-keyword kw">end</span> + <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> </pre> </div> </div> </div> <div class="sectiontitle">Public Instance methods</div> <div class="method"> <div class="title"> - <a name="M000118"></a><b>cleanup</b>() + <a name="M000115"></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('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('M000115_source')" id="l_M000115_source">show source</a> ]</p> + <div id="M000115_source" class="dyn-source"> <pre> - <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> + <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> </pre> </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000117"></a><b>reload</b>(app_root = nil) + <a name="M000114"></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#M000117">reload</a> the code for an application, -such as after deploying a <a href="SpawnManager.html#M000115">new</a> +href="SpawnManager.html#M000114">reload</a> the code for an application, +such as after deploying a <a href="SpawnManager.html#M000112">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('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('M000114_source')" id="l_M000114_source">show source</a> ]</p> + <div id="M000114_source" class="dyn-source"> <pre> - <span class="ruby-comment cmt"># File lib/phusion_passenger/spawn_manager.rb, line 182</span> -182: <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>) -183: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">app_root</span> -184: <span class="ruby-keyword kw">begin</span> -185: <span class="ruby-identifier">app_root</span> = <span class="ruby-identifier">normalize_path</span>(<span class="ruby-identifier">app_root</span>) -186: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">InvalidPath</span> -187: <span class="ruby-keyword kw">end</span> -188: <span class="ruby-keyword kw">end</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> + <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> </pre> </div> </div> </div> <div class="method"> <div class="title"> - <a name="M000116"></a><b>spawn_application</b>(options) + <a name="M000113"></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 @@ -292,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#M000126">AbstractServer#stop</a>, then <a -href="AbstractServer.html#M000124">AbstractServer#start</a>. +href="AbstractServer.html#M000128">AbstractServer#stop</a>, then <a +href="AbstractServer.html#M000126">AbstractServer#start</a>. </li> <li>Reload the application by calling <a -href="SpawnManager.html#M000117">reload</a> with the correct app_root +href="SpawnManager.html#M000114">reload</a> with the correct app_root argument. </li> </ul> <p> @@ -358,45 +352,45 @@ </li> </ul> </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('M000113_source')" id="l_M000113_source">show source</a> ]</p> + <div id="M000113_source" class="dyn-source"> <pre> - <span class="ruby-comment cmt"># File lib/phusion_passenger/spawn_manager.rb, line 136</span> -136: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">spawn_application</span>(<span class="ruby-identifier">options</span>) -137: <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>] -138: <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> -139: <span class="ruby-keyword kw">end</span> -140: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">sanitize_spawn_options</span>(<span class="ruby-identifier">options</span>) -141: -142: <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> -143: <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>) -144: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/application'</span> -145: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/railz/framework_spawner'</span> -146: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/railz/application_spawner'</span> -147: <span class="ruby-keyword kw">end</span> -148: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">spawn_rails_application</span>(<span class="ruby-identifier">options</span>) -149: <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> -150: <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>) -151: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/rack/application_spawner'</span> + <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-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">ApplicationSpawner</span>.<span class="ruby-identifier">spawn_application</span>( -154: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_root&quot;</span>], <span class="ruby-identifier">options</span> -155: ) -156: <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> -157: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/wsgi/application_spawner'</span> -158: <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>( -159: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_root&quot;</span>], -160: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;lower_privilege&quot;</span>], -161: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;lowest_user&quot;</span>], -162: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;environment&quot;</span>] -163: ) -164: <span class="ruby-keyword kw">else</span> -165: <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> -166: <span class="ruby-keyword kw">end</span> -167: <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> </pre> </div> </div> </div> </div> \ No newline at end of file