# File lib/openshift-origin-controller/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)
    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
    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