Class: AppEngine::Rack::RackApplication

Inherits:
Object
  • Object
show all
Defined in:
lib/appengine-rack.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRackApplication

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

#applicationObject 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_variablesObject (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_servicesObject

Returns the value of attribute inbound_services.



163
164
165
# File 'lib/appengine-rack.rb', line 163

def inbound_services
  @inbound_services
end

#precompilation_enabledObject

Returns the value of attribute precompilation_enabled.



163
164
165
# File 'lib/appengine-rack.rb', line 163

def precompilation_enabled
  @precompilation_enabled
end

#public_rootObject

Returns the value of attribute public_root.



164
165
166
# File 'lib/appengine-rack.rb', line 164

def public_root
  @public_root
end

#resource_filesObject (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

Parameters:

  • value

    the value to set the attribute sessions_enabled to.



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

Parameters:

  • value

    the value to set the attribute ssl_enabled to.



166
167
168
# File 'lib/appengine-rack.rb', line 166

def ssl_enabled=(value)
  @ssl_enabled = value
end

#static_filesObject (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_propertiesObject (readonly)

Returns the value of attribute system_properties.



165
166
167
# File 'lib/appengine-rack.rb', line 165

def system_properties
  @system_properties
end

#versionObject

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(options={})
  [:system_properties, :environment_variables].each do |key|
    self.send(key).merge!(options.delete(key)) if options[key]
  end
  options.each { |k,v| self.send("#{k}=", v) }
end

#precompilation_enabled?Boolean

Returns:

  • (Boolean)


192
193
194
# File 'lib/appengine-rack.rb', line 192

def precompilation_enabled?
  @precompilation_enabled
end

#sessions_enabled?Boolean

Returns:

  • (Boolean)


184
185
186
# File 'lib/appengine-rack.rb', line 184

def sessions_enabled?
  @sessions_enabled
end

#ssl_enabled?Boolean

Returns:

  • (Boolean)


188
189
190
# File 'lib/appengine-rack.rb', line 188

def ssl_enabled?
  @ssl_enabled
end

#to_xmlObject



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