From 1ea0dd0ffc37232d27f4fa1350af6ebb3b5439f2 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 25 Oct 2012 11:59:41 +0300 Subject: App docs --- doc/app/Project.html | 1202 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1202 insertions(+) create mode 100644 doc/app/Project.html (limited to 'doc/app/Project.html') diff --git a/doc/app/Project.html b/doc/app/Project.html new file mode 100644 index 00000000000..55868ef1838 --- /dev/null +++ b/doc/app/Project.html @@ -0,0 +1,1202 @@ + + + + + + +class Project - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Project

+ +
+ +
+ + + + +
+ + + + + + + + +
+

Attributes

+ + +
+
+ error_code[RW] +
+ +
+ + + +
+
+ +
+ + + + +
+

Public Class Methods

+ + +
+ +
+ access_options() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 85
+def access_options
+  UsersProject.access_roles
+end
+
+ +
+ + + + +
+ + +
+ +
+ active() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 52
+def active
+  joins(:issues, :notes, :merge_requests).order("issues.created_at, notes.created_at, merge_requests.created_at DESC")
+end
+
+ +
+ + + + +
+ + +
+ +
+ create_by_user(params, user) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 60
+def create_by_user(params, user)
+  project = Project.new params
+
+  Project.transaction do
+    project.owner = user
+    project.save!
+
+    # Add user as project master
+    project.users_projects.create!(project_access: UsersProject::MASTER, user: user)
+
+    # when project saved no team member exist so
+    # project repository should be updated after first user add
+    project.update_repository
+  end
+
+  project
+rescue Gitlab::Gitolite::AccessDenied => ex
+  project.error_code = :gitolite
+  project
+rescue => ex
+  project.error_code = :db
+  project.errors.add(:base, "Can't save project. Please try again later")
+  project
+end
+
+ +
+ + + + +
+ + + + + +
+ +
+

Public Instance Methods

+ + +
+ +
+ build_commit_note(commit) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 124
+def build_commit_note(commit)
+  notes.new(noteable_id: commit.id, noteable_type: "Commit")
+end
+
+ +
+ + + + +
+ + +
+ +
+ check_limit() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 98
+def check_limit
+  unless owner.can_create_project?
+    errors[:base] << ("Your own projects limit is #{owner.projects_limit}! Please contact administrator to increase it")
+  end
+rescue
+  errors[:base] << ("Can't check your ability to create project")
+end
+
+ +
+ + + + +
+ + +
+ +
+ commit_line_notes(commit) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 132
+def commit_line_notes(commit)
+  notes.where(noteable_id: commit.id, noteable_type: "Commit").where("line_code IS NOT NULL")
+end
+
+ +
+ + + + +
+ + +
+ +
+ commit_notes(commit) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 128
+def commit_notes(commit)
+  notes.where(noteable_id: commit.id, noteable_type: "Commit", line_code: nil)
+end
+
+ +
+ + + + +
+ + +
+ +
+ common_notes() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 120
+def common_notes
+  notes.where(noteable_type: ["", nil]).inc_author_project
+end
+
+ +
+ + + + +
+ + +
+ +
+ git_error?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 90
+def git_error?
+  error_code == :gitolite
+end
+
+ +
+ + + + +
+ + +
+ +
+ issues_labels() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 160
+def issues_labels
+  issues.tag_counts_on(:labels)
+end
+
+ +
+ + + + +
+ + +
+ +
+ last_activity() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 144
+def last_activity
+  last_event
+end
+
+ +
+ + + + +
+ + +
+ +
+ last_activity_date() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 148
+def last_activity_date
+  last_event.try(:created_at) || updated_at
+end
+
+ +
+ + + + +
+ + +
+ +
+ private?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 140
+def private?
+  private_flag
+end
+
+ +
+ + + + +
+ + +
+ +
+ project_id() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 156
+def project_id
+  self.id
+end
+
+ +
+ + + + +
+ + +
+ +
+ public?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 136
+def public?
+  !private_flag
+end
+
+ +
+ + + + +
+ + +
+ +
+ repo_name() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 106
+def repo_name
+  if path == "gitolite-admin"
+    errors.add(:path, " like 'gitolite-admin' is not allowed")
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ saved?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 94
+def saved?
+  id && valid?
+end
+
+ +
+ + + + +
+ + +
+ +
+ to_param() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 112
+def to_param
+  code
+end
+
+ +
+ + + + +
+ + +
+ +
+ web_url() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 116
+def web_url
+  [Gitlab.config.url, code].join("/")
+end
+
+ +
+ + + + +
+ + +
+ +
+ wiki_notes() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 152
+def wiki_notes
+  Note.where(noteable_id: wikis.pluck(:id), noteable_type: 'Wiki', project_id: self.id)
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + -- cgit v1.2.1