gitlabhq/doc/code/classes/Project.html
2012-12-30 14:43:00 +02:00

1392 lines
No EOL
51 KiB
HTML

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Project</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/github.css" type="text/css" media="screen" />
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Class</span>
Project
<span class="parent">&lt;
ActiveRecord::Base
</span>
</h1>
<ul class="files">
<li><a href="../files/app/models/project_rb.html">app/models/project.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<!-- Namespace -->
<div class="sectiontitle">Namespace</div>
<ul>
<li>
<span class="type">CLASS</span>
<a href="Project/TransferError.html">Project::TransferError</a>
</li>
</ul>
<!-- Method ref -->
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>A</dt>
<dd>
<ul>
<li>
<a href="#method-c-access_options">access_options</a>,
</li>
<li>
<a href="#method-c-active">active</a>,
</li>
<li>
<a href="#method-c-authorized_for">authorized_for</a>
</li>
</ul>
</dd>
<dt>B</dt>
<dd>
<ul>
<li>
<a href="#method-i-build_commit_note">build_commit_note</a>
</li>
</ul>
</dd>
<dt>C</dt>
<dd>
<ul>
<li>
<a href="#method-i-check_limit">check_limit</a>,
</li>
<li>
<a href="#method-i-code">code</a>,
</li>
<li>
<a href="#method-i-commit_line_notes">commit_line_notes</a>,
</li>
<li>
<a href="#method-i-commit_notes">commit_notes</a>,
</li>
<li>
<a href="#method-i-common_notes">common_notes</a>,
</li>
<li>
<a href="#method-c-create_by_user">create_by_user</a>
</li>
</ul>
</dd>
<dt>F</dt>
<dd>
<ul>
<li>
<a href="#method-c-find_with_namespace">find_with_namespace</a>
</li>
</ul>
</dd>
<dt>G</dt>
<dd>
<ul>
<li>
<a href="#method-i-git_error-3F">git_error?</a>,
</li>
<li>
<a href="#method-i-gitlab_ci-3F">gitlab_ci?</a>
</li>
</ul>
</dd>
<dt>I</dt>
<dd>
<ul>
<li>
<a href="#method-i-issues_labels">issues_labels</a>,
</li>
<li>
<a href="#method-i-items_for">items_for</a>
</li>
</ul>
</dd>
<dt>L</dt>
<dd>
<ul>
<li>
<a href="#method-i-last_activity">last_activity</a>,
</li>
<li>
<a href="#method-i-last_activity_date">last_activity_date</a>
</li>
</ul>
</dd>
<dt>P</dt>
<dd>
<ul>
<li>
<a href="#method-i-private-3F">private?</a>,
</li>
<li>
<a href="#method-i-project_id">project_id</a>,
</li>
<li>
<a href="#method-i-public-3F">public?</a>
</li>
</ul>
</dd>
<dt>R</dt>
<dd>
<ul>
<li>
<a href="#method-i-repo_name">repo_name</a>
</li>
</ul>
</dd>
<dt>S</dt>
<dd>
<ul>
<li>
<a href="#method-i-saved-3F">saved?</a>,
</li>
<li>
<a href="#method-c-search">search</a>,
</li>
<li>
<a href="#method-i-send_move_instructions">send_move_instructions</a>,
</li>
<li>
<a href="#method-i-services">services</a>
</li>
</ul>
</dd>
<dt>T</dt>
<dd>
<ul>
<li>
<a href="#method-i-to_param">to_param</a>
</li>
</ul>
</dd>
<dt>W</dt>
<dd>
<ul>
<li>
<a href="#method-i-web_url">web_url</a>
</li>
</ul>
</dd>
</dl>
<!-- Includes -->
<div class="sectiontitle">Included Modules</div>
<ul>
<li>
<a href="Repository.html">
Repository
</a>
</li>
<li>
<a href="PushObserver.html">
PushObserver
</a>
</li>
<li>
<a href="Authority.html">
Authority
</a>
</li>
<li>
<a href="Team.html">
Team
</a>
</li>
<li>
<a href="NamespacedProject.html">
NamespacedProject
</a>
</li>
</ul>
<!-- Section attributes -->
<div class="sectiontitle">Attributes</div>
<table border='0' cellpadding='5'>
<tr valign='top'>
<td class='attr-rw'>
[RW]
</td>
<td class='attr-name'>error_code</td>
<td class='attr-desc'></td>
</tr>
</table>
<!-- Methods -->
<div class="sectiontitle">Class Public methods</div>
<div class="method">
<div class="title method-title" id="method-c-access_options">
<b>access_options</b>()
<a href="../classes/Project.html#method-c-access_options" name="method-c-access_options" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-c-access_options_source')" id="l_method-c-access_options_source">show</a>
</p>
<div id="method-c-access_options_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/models/project.rb, line 163</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">access_options</span>
<span class="ruby-constant">UsersProject</span>.<span class="ruby-identifier">access_roles</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-c-active">
<b>active</b>()
<a href="../classes/Project.html#method-c-active" name="method-c-active" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-c-active_source')" id="l_method-c-active_source">show</a>
</p>
<div id="method-c-active_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/models/project.rb, line 96</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">active</span>
<span class="ruby-identifier">joins</span>(<span class="ruby-value">:issues</span>, <span class="ruby-value">:notes</span>, <span class="ruby-value">:merge_requests</span>).<span class="ruby-identifier">order</span>(<span class="ruby-string">&quot;issues.created_at, notes.created_at, merge_requests.created_at DESC&quot;</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-c-authorized_for">
<b>authorized_for</b>(user)
<a href="../classes/Project.html#method-c-authorized_for" name="method-c-authorized_for" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-c-authorized_for_source')" id="l_method-c-authorized_for_source">show</a>
</p>
<div id="method-c-authorized_for_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/models/project.rb, line 91</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">authorized_for</span> <span class="ruby-identifier">user</span>
<span class="ruby-identifier">projects</span> = <span class="ruby-identifier">includes</span>(<span class="ruby-value">:users_projects</span>, <span class="ruby-value">:namespace</span>)
<span class="ruby-identifier">projects</span> = <span class="ruby-identifier">projects</span>.<span class="ruby-identifier">where</span>(<span class="ruby-string">&quot;users_projects.user_id = :user_id or projects.owner_id = :user_id or namespaces.owner_id = :user_id&quot;</span>, <span class="ruby-identifier">user_id</span><span class="ruby-operator">:</span> <span class="ruby-identifier">user</span>.<span class="ruby-identifier">id</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-c-create_by_user">
<b>create_by_user</b>(params, user)
<a href="../classes/Project.html#method-c-create_by_user" name="method-c-create_by_user" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-c-create_by_user_source')" id="l_method-c-create_by_user_source">show</a>
</p>
<div id="method-c-create_by_user_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/models/project.rb, line 114</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">create_by_user</span>(<span class="ruby-identifier">params</span>, <span class="ruby-identifier">user</span>)
<span class="ruby-identifier">namespace_id</span> = <span class="ruby-identifier">params</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:namespace_id</span>)
<span class="ruby-identifier">project</span> = <span class="ruby-constant">Project</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">params</span>
<span class="ruby-constant">Project</span>.<span class="ruby-identifier">transaction</span> <span class="ruby-keyword">do</span>
<span class="ruby-comment"># Parametrize path for project</span>
<span class="ruby-comment">#</span>
<span class="ruby-comment"># Ex.</span>
<span class="ruby-comment"># 'GitLab HQ'.parameterize =&gt; &quot;gitlab-hq&quot;</span>
<span class="ruby-comment">#</span>
<span class="ruby-identifier">project</span>.<span class="ruby-identifier">path</span> = <span class="ruby-identifier">project</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">parameterize</span>
<span class="ruby-identifier">project</span>.<span class="ruby-identifier">owner</span> = <span class="ruby-identifier">user</span>
<span class="ruby-comment"># Apply namespace if user has access to it</span>
<span class="ruby-comment"># else fallback to user namespace</span>
<span class="ruby-keyword">if</span> <span class="ruby-identifier">namespace_id</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">Namespace</span>.<span class="ruby-identifier">global_id</span>
<span class="ruby-identifier">project</span>.<span class="ruby-identifier">namespace_id</span> = <span class="ruby-identifier">user</span>.<span class="ruby-identifier">namespace_id</span>
<span class="ruby-keyword">if</span> <span class="ruby-identifier">namespace_id</span>
<span class="ruby-identifier">group</span> = <span class="ruby-constant">Group</span>.<span class="ruby-identifier">find_by_id</span>(<span class="ruby-identifier">namespace_id</span>)
<span class="ruby-keyword">if</span> <span class="ruby-identifier">user</span>.<span class="ruby-identifier">can?</span> <span class="ruby-value">:manage_group</span>, <span class="ruby-identifier">group</span>
<span class="ruby-identifier">project</span>.<span class="ruby-identifier">namespace_id</span> = <span class="ruby-identifier">namespace_id</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
<span class="ruby-identifier">project</span>.<span class="ruby-identifier">save!</span>
<span class="ruby-comment"># Add user as project master</span>
<span class="ruby-identifier">project</span>.<span class="ruby-identifier">users_projects</span>.<span class="ruby-identifier">create!</span>(<span class="ruby-identifier">project_access</span><span class="ruby-operator">:</span> <span class="ruby-constant">UsersProject</span><span class="ruby-operator">::</span><span class="ruby-constant">MASTER</span>, <span class="ruby-identifier">user</span><span class="ruby-operator">:</span> <span class="ruby-identifier">user</span>)
<span class="ruby-comment"># when project saved no team member exist so</span>
<span class="ruby-comment"># project repository should be updated after first user add</span>
<span class="ruby-identifier">project</span>.<span class="ruby-identifier">update_repository</span>
<span class="ruby-keyword">end</span>
<span class="ruby-identifier">project</span>
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">Gitlab</span><span class="ruby-operator">::</span><span class="ruby-constant">Gitolite</span><span class="ruby-operator">::</span><span class="ruby-constant">AccessDenied</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ex</span>
<span class="ruby-identifier">project</span>.<span class="ruby-identifier">error_code</span> = <span class="ruby-value">:gitolite</span>
<span class="ruby-identifier">project</span>
<span class="ruby-keyword">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ex</span>
<span class="ruby-identifier">project</span>.<span class="ruby-identifier">error_code</span> = <span class="ruby-value">:db</span>
<span class="ruby-identifier">project</span>.<span class="ruby-identifier">errors</span>.<span class="ruby-identifier">add</span>(<span class="ruby-value">:base</span>, <span class="ruby-string">&quot;Can't save project. Please try again later&quot;</span>)
<span class="ruby-identifier">project</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-c-find_with_namespace">
<b>find_with_namespace</b>(id)
<a href="../classes/Project.html#method-c-find_with_namespace" name="method-c-find_with_namespace" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-c-find_with_namespace_source')" id="l_method-c-find_with_namespace_source">show</a>
</p>
<div id="method-c-find_with_namespace_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/models/project.rb, line 104</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">find_with_namespace</span>(<span class="ruby-identifier">id</span>)
<span class="ruby-keyword">if</span> <span class="ruby-identifier">id</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-string">&quot;/&quot;</span>)
<span class="ruby-identifier">id</span> = <span class="ruby-identifier">id</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&quot;/&quot;</span>)
<span class="ruby-identifier">namespace_id</span> = <span class="ruby-constant">Namespace</span>.<span class="ruby-identifier">find_by_path</span>(<span class="ruby-identifier">id</span>.<span class="ruby-identifier">first</span>).<span class="ruby-identifier">id</span>
<span class="ruby-identifier">where</span>(<span class="ruby-identifier">namespace_id</span><span class="ruby-operator">:</span> <span class="ruby-identifier">namespace_id</span>).<span class="ruby-identifier">find_by_path</span>(<span class="ruby-identifier">id</span>.<span class="ruby-identifier">second</span>)
<span class="ruby-keyword">else</span>
<span class="ruby-identifier">where</span>(<span class="ruby-identifier">path</span><span class="ruby-operator">:</span> <span class="ruby-identifier">id</span>, <span class="ruby-identifier">namespace_id</span><span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>).<span class="ruby-identifier">last</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-c-search">
<b>search</b>(query)
<a href="../classes/Project.html#method-c-search" name="method-c-search" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-c-search_source')" id="l_method-c-search_source">show</a>
</p>
<div id="method-c-search_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/models/project.rb, line 100</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">search</span> <span class="ruby-identifier">query</span>
<span class="ruby-identifier">where</span>(<span class="ruby-string">&quot;projects.name LIKE :query OR projects.path LIKE :query&quot;</span>, <span class="ruby-identifier">query</span><span class="ruby-operator">:</span> <span class="ruby-node">&quot;%#{query}%&quot;</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title method-title" id="method-i-build_commit_note">
<b>build_commit_note</b>(commit)
<a href="../classes/Project.html#method-i-build_commit_note" name="method-i-build_commit_note" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-build_commit_note_source')" id="l_method-i-build_commit_note_source">show</a>
</p>
<div id="method-i-build_commit_note_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/models/project.rb, line 208</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">build_commit_note</span>(<span class="ruby-identifier">commit</span>)
<span class="ruby-identifier">notes</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">commit_id</span><span class="ruby-operator">:</span> <span class="ruby-identifier">commit</span>.<span class="ruby-identifier">id</span>, <span class="ruby-identifier">noteable_type</span><span class="ruby-operator">:</span> <span class="ruby-string">&quot;Commit&quot;</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-check_limit">
<b>check_limit</b>()
<a href="../classes/Project.html#method-i-check_limit" name="method-i-check_limit" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-check_limit_source')" id="l_method-i-check_limit_source">show</a>
</p>
<div id="method-i-check_limit_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/models/project.rb, line 176</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">check_limit</span>
<span class="ruby-keyword">unless</span> <span class="ruby-identifier">owner</span>.<span class="ruby-identifier">can_create_project?</span>
<span class="ruby-identifier">errors</span>[<span class="ruby-value">:base</span>] <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-node">&quot;Your own projects limit is #{owner.projects_limit}! Please contact administrator to increase it&quot;</span>)
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">rescue</span>
<span class="ruby-identifier">errors</span>[<span class="ruby-value">:base</span>] <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-string">&quot;Can't check your ability to create project&quot;</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-code">
<b>code</b>()
<a href="../classes/Project.html#method-i-code" name="method-i-code" class="permalink">Link</a>
</div>
<div class="description">
<p>For compatibility with old code</p>
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-code_source')" id="l_method-i-code_source">show</a>
</p>
<div id="method-i-code_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/models/project.rb, line 253</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">code</span>
<span class="ruby-identifier">path</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-commit_line_notes">
<b>commit_line_notes</b>(commit)
<a href="../classes/Project.html#method-i-commit_line_notes" name="method-i-commit_line_notes" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-commit_line_notes_source')" id="l_method-i-commit_line_notes_source">show</a>
</p>
<div id="method-i-commit_line_notes_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/models/project.rb, line 216</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">commit_line_notes</span>(<span class="ruby-identifier">commit</span>)
<span class="ruby-identifier">notes</span>.<span class="ruby-identifier">where</span>(<span class="ruby-identifier">commit_id</span><span class="ruby-operator">:</span> <span class="ruby-identifier">commit</span>.<span class="ruby-identifier">id</span>, <span class="ruby-identifier">noteable_type</span><span class="ruby-operator">:</span> <span class="ruby-string">&quot;Commit&quot;</span>).<span class="ruby-identifier">where</span>(<span class="ruby-string">&quot;line_code IS NOT NULL&quot;</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-commit_notes">
<b>commit_notes</b>(commit)
<a href="../classes/Project.html#method-i-commit_notes" name="method-i-commit_notes" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-commit_notes_source')" id="l_method-i-commit_notes_source">show</a>
</p>
<div id="method-i-commit_notes_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/models/project.rb, line 212</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">commit_notes</span>(<span class="ruby-identifier">commit</span>)
<span class="ruby-identifier">notes</span>.<span class="ruby-identifier">where</span>(<span class="ruby-identifier">commit_id</span><span class="ruby-operator">:</span> <span class="ruby-identifier">commit</span>.<span class="ruby-identifier">id</span>, <span class="ruby-identifier">noteable_type</span><span class="ruby-operator">:</span> <span class="ruby-string">&quot;Commit&quot;</span>, <span class="ruby-identifier">line_code</span><span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-common_notes">
<b>common_notes</b>()
<a href="../classes/Project.html#method-i-common_notes" name="method-i-common_notes" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-common_notes_source')" id="l_method-i-common_notes_source">show</a>
</p>
<div id="method-i-common_notes_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/models/project.rb, line 204</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">common_notes</span>
<span class="ruby-identifier">notes</span>.<span class="ruby-identifier">where</span>(<span class="ruby-identifier">noteable_type</span><span class="ruby-operator">:</span> [<span class="ruby-string">&quot;&quot;</span>, <span class="ruby-keyword">nil</span>]).<span class="ruby-identifier">inc_author_project</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-git_error-3F">
<b>git_error?</b>()
<a href="../classes/Project.html#method-i-git_error-3F" name="method-i-git_error-3F" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-git_error-3F_source')" id="l_method-i-git_error-3F_source">show</a>
</p>
<div id="method-i-git_error-3F_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/models/project.rb, line 168</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">git_error?</span>
<span class="ruby-identifier">error_code</span> <span class="ruby-operator">==</span> <span class="ruby-value">:gitolite</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-gitlab_ci-3F">
<b>gitlab_ci?</b>()
<a href="../classes/Project.html#method-i-gitlab_ci-3F" name="method-i-gitlab_ci-3F" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-gitlab_ci-3F_source')" id="l_method-i-gitlab_ci-3F_source">show</a>
</p>
<div id="method-i-gitlab_ci-3F_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/models/project.rb, line 248</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">gitlab_ci?</span>
<span class="ruby-identifier">gitlab_ci_service</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">gitlab_ci_service</span>.<span class="ruby-identifier">active</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-issues_labels">
<b>issues_labels</b>()
<a href="../classes/Project.html#method-i-issues_labels" name="method-i-issues_labels" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-issues_labels_source')" id="l_method-i-issues_labels_source">show</a>
</p>
<div id="method-i-issues_labels_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/models/project.rb, line 240</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">issues_labels</span>
<span class="ruby-identifier">issues</span>.<span class="ruby-identifier">tag_counts_on</span>(<span class="ruby-value">:labels</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-items_for">
<b>items_for</b>(entity)
<a href="../classes/Project.html#method-i-items_for" name="method-i-items_for" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-items_for_source')" id="l_method-i-items_for_source">show</a>
</p>
<div id="method-i-items_for_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/models/project.rb, line 257</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">items_for</span> <span class="ruby-identifier">entity</span>
<span class="ruby-keyword">case</span> <span class="ruby-identifier">entity</span>
<span class="ruby-keyword">when</span> <span class="ruby-string">'issue'</span> <span class="ruby-keyword">then</span>
<span class="ruby-identifier">issues</span>
<span class="ruby-keyword">when</span> <span class="ruby-string">'merge_request'</span> <span class="ruby-keyword">then</span>
<span class="ruby-identifier">merge_requests</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-last_activity">
<b>last_activity</b>()
<a href="../classes/Project.html#method-i-last_activity" name="method-i-last_activity" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-last_activity_source')" id="l_method-i-last_activity_source">show</a>
</p>
<div id="method-i-last_activity_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/models/project.rb, line 228</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">last_activity</span>
<span class="ruby-identifier">last_event</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-last_activity_date">
<b>last_activity_date</b>()
<a href="../classes/Project.html#method-i-last_activity_date" name="method-i-last_activity_date" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-last_activity_date_source')" id="l_method-i-last_activity_date_source">show</a>
</p>
<div id="method-i-last_activity_date_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/models/project.rb, line 232</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">last_activity_date</span>
<span class="ruby-identifier">last_event</span>.<span class="ruby-identifier">try</span>(<span class="ruby-value">:created_at</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">updated_at</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-private-3F">
<b>private?</b>()
<a href="../classes/Project.html#method-i-private-3F" name="method-i-private-3F" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-private-3F_source')" id="l_method-i-private-3F_source">show</a>
</p>
<div id="method-i-private-3F_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/models/project.rb, line 224</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">private?</span>
<span class="ruby-identifier">private_flag</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-project_id">
<b>project_id</b>()
<a href="../classes/Project.html#method-i-project_id" name="method-i-project_id" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-project_id_source')" id="l_method-i-project_id_source">show</a>
</p>
<div id="method-i-project_id_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/models/project.rb, line 236</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">project_id</span>
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">id</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-public-3F">
<b>public?</b>()
<a href="../classes/Project.html#method-i-public-3F" name="method-i-public-3F" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-public-3F_source')" id="l_method-i-public-3F_source">show</a>
</p>
<div id="method-i-public-3F_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/models/project.rb, line 220</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">public?</span>
<span class="ruby-operator">!</span><span class="ruby-identifier">private_flag</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-repo_name">
<b>repo_name</b>()
<a href="../classes/Project.html#method-i-repo_name" name="method-i-repo_name" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-repo_name_source')" id="l_method-i-repo_name_source">show</a>
</p>
<div id="method-i-repo_name_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/models/project.rb, line 184</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">repo_name</span>
<span class="ruby-identifier">denied_paths</span> = <span class="ruby-node">%w(gitolite-admin admin dashboard groups help profile projects search)</span>
<span class="ruby-keyword">if</span> <span class="ruby-identifier">denied_paths</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">path</span>)
<span class="ruby-identifier">errors</span>.<span class="ruby-identifier">add</span>(<span class="ruby-value">:path</span>, <span class="ruby-node">&quot;like #{path} is not allowed&quot;</span>)
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-saved-3F">
<b>saved?</b>()
<a href="../classes/Project.html#method-i-saved-3F" name="method-i-saved-3F" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-saved-3F_source')" id="l_method-i-saved-3F_source">show</a>
</p>
<div id="method-i-saved-3F_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/models/project.rb, line 172</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">saved?</span>
<span class="ruby-identifier">id</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">valid?</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-send_move_instructions">
<b>send_move_instructions</b>()
<a href="../classes/Project.html#method-i-send_move_instructions" name="method-i-send_move_instructions" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-send_move_instructions_source')" id="l_method-i-send_move_instructions_source">show</a>
</p>
<div id="method-i-send_move_instructions_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/models/project.rb, line 266</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">send_move_instructions</span>
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">users_projects</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">member</span><span class="ruby-operator">|</span>
<span class="ruby-constant">Notify</span>.<span class="ruby-identifier">project_was_moved_email</span>(<span class="ruby-identifier">member</span>.<span class="ruby-identifier">id</span>).<span class="ruby-identifier">deliver</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-services">
<b>services</b>()
<a href="../classes/Project.html#method-i-services" name="method-i-services" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-services_source')" id="l_method-i-services_source">show</a>
</p>
<div id="method-i-services_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/models/project.rb, line 244</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">services</span>
[<span class="ruby-identifier">gitlab_ci_service</span>].<span class="ruby-identifier">compact</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-to_param">
<b>to_param</b>()
<a href="../classes/Project.html#method-i-to_param" name="method-i-to_param" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-to_param_source')" id="l_method-i-to_param_source">show</a>
</p>
<div id="method-i-to_param_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/models/project.rb, line 192</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">to_param</span>
<span class="ruby-keyword">if</span> <span class="ruby-identifier">namespace</span>
<span class="ruby-identifier">namespace</span>.<span class="ruby-identifier">path</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot;/&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">path</span>
<span class="ruby-keyword">else</span>
<span class="ruby-identifier">path</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-web_url">
<b>web_url</b>()
<a href="../classes/Project.html#method-i-web_url" name="method-i-web_url" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-web_url_source')" id="l_method-i-web_url_source">show</a>
</p>
<div id="method-i-web_url_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/models/project.rb, line 200</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">web_url</span>
[<span class="ruby-constant">Gitlab</span>.<span class="ruby-identifier">config</span>.<span class="ruby-identifier">gitlab</span>.<span class="ruby-identifier">url</span>, <span class="ruby-identifier">path_with_namespace</span>].<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;/&quot;</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>