Class: AppEngine::Rack::RackApplication
- Inherits:
-
Object
- Object
- AppEngine::Rack::RackApplication
- Defined in:
- lib/appengine-rack.rb
Instance Attribute Summary collapse
-
#application ⇒ Object
(also: #id)
Returns the value of attribute application.
-
#environment_variables ⇒ Object
readonly
Returns the value of attribute environment_variables.
-
#inbound_services ⇒ Object
Returns the value of attribute inbound_services.
-
#precompilation_enabled ⇒ Object
Returns the value of attribute precompilation_enabled.
-
#public_root ⇒ Object
Returns the value of attribute public_root.
-
#resource_files ⇒ Object
readonly
Returns the value of attribute resource_files.
-
#sessions_enabled ⇒ Object
writeonly
Sets the attribute sessions_enabled.
-
#ssl_enabled ⇒ Object
writeonly
Sets the attribute ssl_enabled.
-
#static_files ⇒ Object
readonly
Returns the value of attribute static_files.
-
#system_properties ⇒ Object
readonly
Returns the value of attribute system_properties.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #configure(options = {}) ⇒ Object
-
#initialize ⇒ RackApplication
constructor
A new instance of RackApplication.
- #precompilation_enabled? ⇒ Boolean
- #sessions_enabled? ⇒ Boolean
- #ssl_enabled? ⇒ Boolean
- #to_xml ⇒ Object
Constructor Details
#initialize ⇒ RackApplication
Returns a new instance of RackApplication.
168 169 170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/appengine-rack.rb', line 168 def initialize @version = '1' @system_properties = PropertyMap[ 'os.arch' => '', 'jruby.jit.threshold' => 99, 'jruby.native.enabled' => false, 'jruby.management.enabled' => false, 'jruby.rack.input.rewindable' => false ] @environment_variables = EnvVarMap.new @static_files = Resources.new @resource_files = Resources.new @public_root = '/public' @inbound_services = [] end |
Instance Attribute Details
#application ⇒ Object Also known as: id
Returns the value of attribute application.
163 164 165 |
# File 'lib/appengine-rack.rb', line 163 def application @application end |
#environment_variables ⇒ Object (readonly)
Returns the value of attribute environment_variables.
165 166 167 |
# File 'lib/appengine-rack.rb', line 165 def environment_variables @environment_variables end |
#inbound_services ⇒ Object
Returns the value of attribute inbound_services.
163 164 165 |
# File 'lib/appengine-rack.rb', line 163 def inbound_services @inbound_services end |
#precompilation_enabled ⇒ Object
Returns the value of attribute precompilation_enabled.
163 164 165 |
# File 'lib/appengine-rack.rb', line 163 def precompilation_enabled @precompilation_enabled end |
#public_root ⇒ Object
Returns the value of attribute public_root.
164 165 166 |
# File 'lib/appengine-rack.rb', line 164 def public_root @public_root end |
#resource_files ⇒ Object (readonly)
Returns the value of attribute resource_files.
164 165 166 |
# File 'lib/appengine-rack.rb', line 164 def resource_files @resource_files end |
#sessions_enabled=(value) ⇒ Object (writeonly)
Sets the attribute sessions_enabled
166 167 168 |
# File 'lib/appengine-rack.rb', line 166 def sessions_enabled=(value) @sessions_enabled = value end |
#ssl_enabled=(value) ⇒ Object (writeonly)
Sets the attribute ssl_enabled
166 167 168 |
# File 'lib/appengine-rack.rb', line 166 def ssl_enabled=(value) @ssl_enabled = value end |
#static_files ⇒ Object (readonly)
Returns the value of attribute static_files.
164 165 166 |
# File 'lib/appengine-rack.rb', line 164 def static_files @static_files end |
#system_properties ⇒ Object (readonly)
Returns the value of attribute system_properties.
165 166 167 |
# File 'lib/appengine-rack.rb', line 165 def system_properties @system_properties end |
#version ⇒ Object
Returns the value of attribute version.
164 165 166 |
# File 'lib/appengine-rack.rb', line 164 def version @version end |
Instance Method Details
#configure(options = {}) ⇒ Object
206 207 208 209 210 211 |
# File 'lib/appengine-rack.rb', line 206 def configure(={}) [:system_properties, :environment_variables].each do |key| self.send(key).merge!(.delete(key)) if [key] end .each { |k,v| self.send("#{k}=", v) } end |
#precompilation_enabled? ⇒ Boolean
192 193 194 |
# File 'lib/appengine-rack.rb', line 192 def precompilation_enabled? @precompilation_enabled end |
#sessions_enabled? ⇒ Boolean
184 185 186 |
# File 'lib/appengine-rack.rb', line 184 def sessions_enabled? @sessions_enabled end |
#ssl_enabled? ⇒ Boolean
188 189 190 |
# File 'lib/appengine-rack.rb', line 188 def ssl_enabled? @ssl_enabled end |
#to_xml ⇒ Object
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
# File 'lib/appengine-rack.rb', line 213 def to_xml require 'rexml/document' xml = REXML::Document.new.add_element('appengine-web-app') xml.add_attribute('xmlns','http://appengine.google.com/ns/1.0') xml.add_element('application').add_text(application) xml.add_element('version').add_text(version) xml.add_element('public-root').add_text(@public_root) if @public_root static_files.append_to(xml, 'static-files') resource_files.append_to(xml, 'resource-files') system_properties.append_to(xml) environment_variables.append_to(xml) if sessions_enabled? xml.add_element('sessions-enabled').add_text('true') end if ssl_enabled? xml.add_element('ssl-enabled').add_text('true') end if precompilation_enabled? xml.add_element('precompilation-enabled').add_text('true') end unless @inbound_services.empty? services = xml.add_element('inbound-services') @inbound_services.each do |service| services.add_element('service').add_text(service.to_s) end end return xml end |