Method: Application#initialize

Defined in:
app/models/application.rb

#initialize(user = nil, app_name = nil, uuid = nil, node_profile = nil, framework = nil, template = nil, will_scale = false, domain = nil, init_git_url = nil) ⇒ Application

Returns a new instance of Application.

Parameters:

  • user (CloudUser) (defaults to: nil)
  • app_name (String) (defaults to: nil)

    Application name

  • uuid (optional, String) (defaults to: nil)

    Unique identifier for the application

  • node_profile (deprecated, String) (defaults to: nil)

    Node profile for the first application gear

  • framework (deprecated, String) (defaults to: nil)

    Cartridge name to use as the framwwork of the application



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'app/models/application.rb', line 54

def initialize(user=nil, app_name=nil, uuid=nil, node_profile=nil, framework=nil, template=nil, will_scale=false, domain=nil, init_git_url=nil)
  self.user = user
  self.domain = domain
  self.node_profile = node_profile
  self.creation_time = DateTime::now().strftime
  self.uuid = uuid || OpenShift::Model.gen_uuid
  self.scalable = will_scale
  self.ngears = 0
  
  if template.nil?
    if self.scalable
      descriptor_hash = YAML.load(template_scalable_app(app_name, framework))
      from_descriptor(descriptor_hash)
      self.proxy_cartridge = "haproxy-1.4"
    else
      from_descriptor({"Name"=>app_name})
      self.requires_feature = []
      self.requires_feature << framework unless framework.nil? 
    end
    @init_git_url = init_git_url unless init_git_url.nil?
  else
    template_descriptor = YAML.load(template.descriptor_yaml)
    template_descriptor["Name"] = app_name
    if not template_descriptor["Configure-Order"]
      requires_list = template_descriptor["Requires"] || []
      template_descriptor["Configure-Order"] = requires_list
    end
    from_descriptor(template_descriptor)
    @init_git_url = template.git_url
  end
  self.categories -= ["cartridge"]
end