From 96d49bf04ce77c975fe500f4d961e4a1ffed4c26 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Sun, 30 Dec 2012 14:43:00 +0200 Subject: Use sdoc to generate application code documentation --- doc/code/classes/Project.html | 1392 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1392 insertions(+) create mode 100644 doc/code/classes/Project.html (limited to 'doc/code/classes/Project.html') diff --git a/doc/code/classes/Project.html b/doc/code/classes/Project.html new file mode 100644 index 00000000000..004285485a1 --- /dev/null +++ b/doc/code/classes/Project.html @@ -0,0 +1,1392 @@ + + + + + Project + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + +
Methods
+
+ +
A
+
+ +
+ +
B
+
+ +
+ +
C
+
+ +
+ +
F
+
+ +
+ +
G
+
+ +
+ +
I
+
+ +
+ +
L
+
+ +
+ +
P
+
+ +
+ +
R
+
+ +
+ +
S
+
+ +
+ +
T
+
+ +
+ +
W
+
+ +
+ +
+ + + + +
Included Modules
+ + + + + + + + + + + + + + + + +
Attributes
+ + + + + + + + +
+ [RW] + error_code
+ + + + + +
Class Public methods
+ +
+
+ + access_options() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 163
+def access_options
+  UsersProject.access_roles
+end
+
+
+ +
+ +
+
+ + active() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 96
+def active
+  joins(:issues, :notes, :merge_requests).order("issues.created_at, notes.created_at, merge_requests.created_at DESC")
+end
+
+
+ +
+ +
+
+ + authorized_for(user) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 91
+def authorized_for user
+  projects = includes(:users_projects, :namespace)
+  projects = projects.where("users_projects.user_id = :user_id or projects.owner_id = :user_id or namespaces.owner_id = :user_id", user_id: user.id)
+end
+
+
+ +
+ +
+
+ + create_by_user(params, user) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 114
+def create_by_user(params, user)
+  namespace_id = params.delete(:namespace_id)
+
+  project = Project.new params
+
+  Project.transaction do
+
+    # Parametrize path for project
+    #
+    # Ex.
+    #  'GitLab HQ'.parameterize => "gitlab-hq"
+    #
+    project.path = project.name.dup.parameterize
+
+    project.owner = user
+
+    # Apply namespace if user has access to it
+    # else fallback to user namespace
+    if namespace_id != Namespace.global_id
+      project.namespace_id = user.namespace_id
+
+      if namespace_id
+        group = Group.find_by_id(namespace_id)
+        if user.can? :manage_group, group
+          project.namespace_id = namespace_id
+        end
+      end
+    end
+
+    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
+
+
+ +
+ +
+
+ + find_with_namespace(id) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 104
+def find_with_namespace(id)
+  if id.include?("/")
+    id = id.split("/")
+    namespace_id = Namespace.find_by_path(id.first).id
+    where(namespace_id: namespace_id).find_by_path(id.second)
+  else
+    where(path: id, namespace_id: nil).last
+  end
+end
+
+
+ +
+ +
+ + + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 100
+def search query
+  where("projects.name LIKE :query OR projects.path LIKE :query", query: "%#{query}%")
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + build_commit_note(commit) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 208
+def build_commit_note(commit)
+  notes.new(commit_id: commit.id, noteable_type: "Commit")
+end
+
+
+ +
+ +
+
+ + check_limit() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 176
+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
+
+
+ +
+ +
+
+ + code() + + +
+ + +
+

For compatibility with old code

+
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 253
+def code
+  path
+end
+
+
+ +
+ +
+
+ + commit_line_notes(commit) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 216
+def commit_line_notes(commit)
+  notes.where(commit_id: commit.id, noteable_type: "Commit").where("line_code IS NOT NULL")
+end
+
+
+ +
+ +
+
+ + commit_notes(commit) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 212
+def commit_notes(commit)
+  notes.where(commit_id: commit.id, noteable_type: "Commit", line_code: nil)
+end
+
+
+ +
+ +
+
+ + common_notes() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 204
+def common_notes
+  notes.where(noteable_type: ["", nil]).inc_author_project
+end
+
+
+ +
+ +
+
+ + git_error?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 168
+def git_error?
+  error_code == :gitolite
+end
+
+
+ +
+ +
+
+ + gitlab_ci?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 248
+def gitlab_ci?
+  gitlab_ci_service && gitlab_ci_service.active
+end
+
+
+ +
+ +
+
+ + issues_labels() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 240
+def issues_labels
+  issues.tag_counts_on(:labels)
+end
+
+
+ +
+ +
+
+ + items_for(entity) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 257
+def items_for entity
+  case entity
+  when 'issue' then
+    issues
+  when 'merge_request' then
+    merge_requests
+  end
+end
+
+
+ +
+ +
+
+ + last_activity() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 228
+def last_activity
+  last_event
+end
+
+
+ +
+ +
+
+ + last_activity_date() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 232
+def last_activity_date
+  last_event.try(:created_at) || updated_at
+end
+
+
+ +
+ +
+
+ + private?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 224
+def private?
+  private_flag
+end
+
+
+ +
+ +
+
+ + project_id() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 236
+def project_id
+  self.id
+end
+
+
+ +
+ +
+
+ + public?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 220
+def public?
+  !private_flag
+end
+
+
+ +
+ +
+
+ + repo_name() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 184
+def repo_name
+  denied_paths = %w(gitolite-admin admin dashboard groups help profile projects search)
+
+  if denied_paths.include?(path)
+    errors.add(:path, "like #{path} is not allowed")
+  end
+end
+
+
+ +
+ +
+
+ + saved?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 172
+def saved?
+  id && valid?
+end
+
+
+ +
+ +
+
+ + send_move_instructions() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 266
+def send_move_instructions
+  self.users_projects.each do |member|
+    Notify.project_was_moved_email(member.id).deliver
+  end
+end
+
+
+ +
+ +
+
+ + services() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 244
+def services
+  [gitlab_ci_service].compact
+end
+
+
+ +
+ +
+
+ + to_param() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 192
+def to_param
+  if namespace
+    namespace.path + "/" + path
+  else
+    path
+  end
+end
+
+
+ +
+ +
+
+ + web_url() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 200
+def web_url
+  [Gitlab.config.gitlab.url, path_with_namespace].join("/")
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file -- cgit v1.2.1