gitlabhq/doc/code/classes/Repository.html

1737 lines
65 KiB
HTML
Raw Normal View History

<?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>Repository</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">Module</span>
Repository
</h1>
<ul class="files">
<li><a href="../files/app/roles/repository_rb.html">app/roles/repository.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<!-- Method ref -->
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>A</dt>
<dd>
<ul>
<li>
<a href="#method-i-archive_repo">archive_repo</a>
</li>
</ul>
</dd>
<dt>B</dt>
<dd>
<ul>
<li>
<a href="#method-i-branch_names">branch_names</a>,
</li>
<li>
<a href="#method-i-branches">branches</a>
</li>
</ul>
</dd>
<dt>C</dt>
<dd>
<ul>
<li>
<a href="#method-i-commit">commit</a>,
</li>
<li>
<a href="#method-i-commits">commits</a>,
</li>
<li>
<a href="#method-i-commits_between">commits_between</a>,
</li>
<li>
<a href="#method-i-commits_since">commits_since</a>,
</li>
<li>
<a href="#method-i-commits_with_refs">commits_with_refs</a>
</li>
</ul>
</dd>
<dt>D</dt>
<dd>
<ul>
<li>
<a href="#method-i-destroy_repository">destroy_repository</a>,
</li>
<li>
<a href="#method-i-discover_default_branch">discover_default_branch</a>
</li>
</ul>
</dd>
<dt>E</dt>
<dd>
<ul>
<li>
<a href="#method-i-empty_repo-3F">empty_repo?</a>
</li>
</ul>
</dd>
<dt>F</dt>
<dd>
<ul>
<li>
<a href="#method-i-fresh_commits">fresh_commits</a>
</li>
</ul>
</dd>
<dt>H</dt>
<dd>
<ul>
<li>
<a href="#method-i-has_commits-3F">has_commits?</a>,
</li>
<li>
<a href="#method-i-has_post_receive_file-3F">has_post_receive_file?</a>,
</li>
<li>
<a href="#method-i-heads">heads</a>,
</li>
<li>
<a href="#method-i-hook_file">hook_file</a>,
</li>
<li>
<a href="#method-i-http_url_to_repo">http_url_to_repo</a>
</li>
</ul>
</dd>
<dt>L</dt>
<dd>
<ul>
<li>
<a href="#method-i-last_commit_for">last_commit_for</a>
</li>
</ul>
</dd>
<dt>N</dt>
<dd>
<ul>
<li>
<a href="#method-i-namespace_dir">namespace_dir</a>
</li>
</ul>
</dd>
<dt>O</dt>
<dd>
<ul>
<li>
<a href="#method-i-open_branches">open_branches</a>
</li>
</ul>
</dd>
<dt>P</dt>
<dd>
<ul>
<li>
<a href="#method-i-path_to_repo">path_to_repo</a>,
</li>
<li>
<a href="#method-i-protected_branch-3F">protected_branch?</a>
</li>
</ul>
</dd>
<dt>R</dt>
<dd>
<ul>
<li>
<a href="#method-i-ref_names">ref_names</a>,
</li>
<li>
<a href="#method-i-repo">repo</a>,
</li>
<li>
<a href="#method-i-repo_exists-3F">repo_exists?</a>,
</li>
<li>
<a href="#method-i-root_ref">root_ref</a>,
</li>
<li>
<a href="#method-i-root_ref-3F">root_ref?</a>
</li>
</ul>
</dd>
<dt>S</dt>
<dd>
<ul>
<li>
<a href="#method-i-satellite">satellite</a>,
</li>
<li>
<a href="#method-i-ssh_url_to_repo">ssh_url_to_repo</a>
</li>
</ul>
</dd>
<dt>T</dt>
<dd>
<ul>
<li>
<a href="#method-i-tag_names">tag_names</a>,
</li>
<li>
<a href="#method-i-tags">tags</a>,
</li>
<li>
<a href="#method-i-tree">tree</a>
</li>
</ul>
</dd>
<dt>U</dt>
<dd>
<ul>
<li>
<a href="#method-i-update_repository">update_repository</a>,
</li>
<li>
<a href="#method-i-url_to_repo">url_to_repo</a>
</li>
</ul>
</dd>
<dt>V</dt>
<dd>
<ul>
<li>
<a href="#method-i-valid_hook_file">valid_hook_file</a>,
</li>
<li>
<a href="#method-i-valid_post_receive_file-3F">valid_post_receive_file?</a>,
</li>
<li>
<a href="#method-i-valid_repo-3F">valid_repo?</a>
</li>
</ul>
</dd>
</dl>
<!-- Includes -->
<div class="sectiontitle">Included Modules</div>
<ul>
<li>
<a href="GitHost.html">
GitHost
</a>
</li>
</ul>
<!-- Methods -->
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title method-title" id="method-i-archive_repo">
<b>archive_repo</b>(ref)
<a href="../classes/Repository.html#method-i-archive_repo" name="method-i-archive_repo" class="permalink">Link</a>
</div>
<div class="description">
<p>Archive <a href="Project.html">Project</a> to .tar.gz</p>
<p>Already packed repo archives stored at
app_root/tmp/repositories/project_name/project_name-commit-id.tag.gz</p>
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-archive_repo_source')" id="l_method-i-archive_repo_source">show</a>
</p>
<div id="method-i-archive_repo_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 175</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">archive_repo</span>(<span class="ruby-identifier">ref</span>)
<span class="ruby-identifier">ref</span> = <span class="ruby-identifier">ref</span> <span class="ruby-operator">||</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">root_ref</span>
<span class="ruby-identifier">commit</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">commit</span>(<span class="ruby-identifier">ref</span>)
<span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">commit</span>
<span class="ruby-comment"># Build file path</span>
<span class="ruby-identifier">file_name</span> = <span class="ruby-keyword">self</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">commit</span>.<span class="ruby-identifier">id</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot;.tar.gz&quot;</span>
<span class="ruby-identifier">storage_path</span> = <span class="ruby-constant">Rails</span>.<span class="ruby-identifier">root</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;tmp&quot;</span>, <span class="ruby-string">&quot;repositories&quot;</span>, <span class="ruby-keyword">self</span>.<span class="ruby-identifier">path_with_namespace</span>)
<span class="ruby-identifier">file_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">storage_path</span>, <span class="ruby-identifier">file_name</span>)
<span class="ruby-comment"># Put files into a directory before archiving</span>
<span class="ruby-identifier">prefix</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">path</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot;/&quot;</span>
<span class="ruby-comment"># Create file if not exists</span>
<span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">file_path</span>)
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkdir_p</span> <span class="ruby-identifier">storage_path</span>
<span class="ruby-identifier">file</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">archive_to_file</span>(<span class="ruby-identifier">ref</span>, <span class="ruby-identifier">prefix</span>, <span class="ruby-identifier">file_path</span>)
<span class="ruby-keyword">end</span>
<span class="ruby-identifier">file_path</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-branch_names">
<b>branch_names</b>()
<a href="../classes/Repository.html#method-i-branch_names" name="method-i-branch_names" class="permalink">Link</a>
</div>
<div class="description">
<p>Returns an Array of branch names</p>
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-branch_names_source')" id="l_method-i-branch_names_source">show</a>
</p>
<div id="method-i-branch_names_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 67</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">branch_names</span>
<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">branches</span>.<span class="ruby-identifier">collect</span>(&amp;<span class="ruby-value">:name</span>).<span class="ruby-identifier">sort</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-branches">
<b>branches</b>()
<a href="../classes/Repository.html#method-i-branches" name="method-i-branches" class="permalink">Link</a>
</div>
<div class="description">
<p>Returns an Array of Branches</p>
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-branches_source')" id="l_method-i-branches_source">show</a>
</p>
<div id="method-i-branches_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 72</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">branches</span>
<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">branches</span>.<span class="ruby-identifier">sort_by</span>(&amp;<span class="ruby-value">:name</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-commit">
<b>commit</b>(commit_id = nil)
<a href="../classes/Repository.html#method-i-commit" name="method-i-commit" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-commit_source')" id="l_method-i-commit_source">show</a>
</p>
<div id="method-i-commit_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 15</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">commit</span>(<span class="ruby-identifier">commit_id</span> = <span class="ruby-keyword">nil</span>)
<span class="ruby-constant">Commit</span>.<span class="ruby-identifier">find_or_first</span>(<span class="ruby-identifier">repo</span>, <span class="ruby-identifier">commit_id</span>, <span class="ruby-identifier">root_ref</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-commits">
<b>commits</b>(ref, path = nil, limit = nil, offset = nil)
<a href="../classes/Repository.html#method-i-commits" name="method-i-commits" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-commits_source')" id="l_method-i-commits_source">show</a>
</p>
<div id="method-i-commits_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 31</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">commits</span>(<span class="ruby-identifier">ref</span>, <span class="ruby-identifier">path</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">limit</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">offset</span> = <span class="ruby-keyword">nil</span>)
<span class="ruby-constant">Commit</span>.<span class="ruby-identifier">commits</span>(<span class="ruby-identifier">repo</span>, <span class="ruby-identifier">ref</span>, <span class="ruby-identifier">path</span>, <span class="ruby-identifier">limit</span>, <span class="ruby-identifier">offset</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-commits_between">
<b>commits_between</b>(from, to)
<a href="../classes/Repository.html#method-i-commits_between" name="method-i-commits_between" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-commits_between_source')" id="l_method-i-commits_between_source">show</a>
</p>
<div id="method-i-commits_between_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 39</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">commits_between</span>(<span class="ruby-identifier">from</span>, <span class="ruby-identifier">to</span>)
<span class="ruby-constant">Commit</span>.<span class="ruby-identifier">commits_between</span>(<span class="ruby-identifier">repo</span>, <span class="ruby-identifier">from</span>, <span class="ruby-identifier">to</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-commits_since">
<b>commits_since</b>(date)
<a href="../classes/Repository.html#method-i-commits_since" name="method-i-commits_since" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-commits_since_source')" id="l_method-i-commits_since_source">show</a>
</p>
<div id="method-i-commits_since_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 27</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">commits_since</span>(<span class="ruby-identifier">date</span>)
<span class="ruby-constant">Commit</span>.<span class="ruby-identifier">commits_since</span>(<span class="ruby-identifier">repo</span>, <span class="ruby-identifier">date</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-commits_with_refs">
<b>commits_with_refs</b>(n = 20)
<a href="../classes/Repository.html#method-i-commits_with_refs" name="method-i-commits_with_refs" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-commits_with_refs_source')" id="l_method-i-commits_with_refs_source">show</a>
</p>
<div id="method-i-commits_with_refs_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 23</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">commits_with_refs</span>(<span class="ruby-identifier">n</span> = <span class="ruby-number">20</span>)
<span class="ruby-constant">Commit</span>.<span class="ruby-identifier">commits_with_refs</span>(<span class="ruby-identifier">repo</span>, <span class="ruby-identifier">n</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-destroy_repository">
<b>destroy_repository</b>()
<a href="../classes/Repository.html#method-i-destroy_repository" name="method-i-destroy_repository" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-destroy_repository_source')" id="l_method-i-destroy_repository_source">show</a>
</p>
<div id="method-i-destroy_repository_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 111</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">destroy_repository</span>
<span class="ruby-identifier">git_host</span>.<span class="ruby-identifier">remove_repository</span>(<span class="ruby-keyword">self</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-discover_default_branch">
<b>discover_default_branch</b>()
<a href="../classes/Repository.html#method-i-discover_default_branch" name="method-i-discover_default_branch" class="permalink">Link</a>
</div>
<div class="description">
<p>Discovers the default branch based on the repositorys available branches</p>
<ul><li>
<p>If no branches are present, returns nil</p>
</li><li>
<p>If one branch is present, returns its name</p>
</li><li>
<p>If two or more branches are present, returns the one that has a name
matching <a href="Repository.html#method-i-root_ref">#root_ref</a>
(default_branch or master if default_branch is nil)</p>
</li></ul>
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-discover_default_branch_source')" id="l_method-i-discover_default_branch_source">show</a>
</p>
<div id="method-i-discover_default_branch_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 146</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">discover_default_branch</span>
<span class="ruby-keyword">if</span> <span class="ruby-identifier">branch_names</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-number">0</span>
<span class="ruby-keyword">nil</span>
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">branch_names</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-number">1</span>
<span class="ruby-identifier">branch_names</span>.<span class="ruby-identifier">first</span>
<span class="ruby-keyword">else</span>
<span class="ruby-identifier">branch_names</span>.<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">v</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">root_ref</span> }.<span class="ruby-identifier">first</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-empty_repo-3F">
<b>empty_repo?</b>()
<a href="../classes/Repository.html#method-i-empty_repo-3F" name="method-i-empty_repo-3F" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-empty_repo-3F_source')" id="l_method-i-empty_repo-3F_source">show</a>
</p>
<div id="method-i-empty_repo-3F_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 11</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">empty_repo?</span>
<span class="ruby-operator">!</span><span class="ruby-identifier">repo_exists?</span> <span class="ruby-operator">||</span> <span class="ruby-operator">!</span><span class="ruby-identifier">has_commits?</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-fresh_commits">
<b>fresh_commits</b>(n = 10)
<a href="../classes/Repository.html#method-i-fresh_commits" name="method-i-fresh_commits" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-fresh_commits_source')" id="l_method-i-fresh_commits_source">show</a>
</p>
<div id="method-i-fresh_commits_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 19</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">fresh_commits</span>(<span class="ruby-identifier">n</span> = <span class="ruby-number">10</span>)
<span class="ruby-constant">Commit</span>.<span class="ruby-identifier">fresh_commits</span>(<span class="ruby-identifier">repo</span>, <span class="ruby-identifier">n</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-has_commits-3F">
<b>has_commits?</b>()
<a href="../classes/Repository.html#method-i-has_commits-3F" name="method-i-has_commits-3F" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-has_commits-3F_source')" id="l_method-i-has_commits-3F_source">show</a>
</p>
<div id="method-i-has_commits-3F_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 156</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">has_commits?</span>
<span class="ruby-operator">!</span><span class="ruby-operator">!</span><span class="ruby-identifier">commit</span>
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">Grit</span><span class="ruby-operator">::</span><span class="ruby-constant">NoSuchPathError</span>
<span class="ruby-keyword">false</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-has_post_receive_file-3F">
<b>has_post_receive_file?</b>()
<a href="../classes/Repository.html#method-i-has_post_receive_file-3F" name="method-i-has_post_receive_file-3F" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-has_post_receive_file-3F_source')" id="l_method-i-has_post_receive_file-3F_source">show</a>
</p>
<div id="method-i-has_post_receive_file-3F_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 47</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">has_post_receive_file?</span>
<span class="ruby-operator">!</span><span class="ruby-operator">!</span><span class="ruby-identifier">hook_file</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-heads">
<b>heads</b>()
<a href="../classes/Repository.html#method-i-heads" name="method-i-heads" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-heads_source')" id="l_method-i-heads_source">show</a>
</p>
<div id="method-i-heads_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 121</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">heads</span>
<span class="ruby-ivar">@heads</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">repo</span>.<span class="ruby-identifier">heads</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-hook_file">
<b>hook_file</b>()
<a href="../classes/Repository.html#method-i-hook_file" name="method-i-hook_file" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-hook_file_source')" id="l_method-i-hook_file_source">show</a>
</p>
<div id="method-i-hook_file_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 59</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">hook_file</span>
<span class="ruby-ivar">@hook_file</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">begin</span>
<span class="ruby-identifier">hook_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">path_to_repo</span>, <span class="ruby-string">'hooks'</span>, <span class="ruby-string">'post-receive'</span>)
<span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">hook_path</span>) <span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">hook_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-http_url_to_repo">
<b>http_url_to_repo</b>()
<a href="../classes/Repository.html#method-i-http_url_to_repo" name="method-i-http_url_to_repo" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-http_url_to_repo_source')" id="l_method-i-http_url_to_repo_source">show</a>
</p>
<div id="method-i-http_url_to_repo_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 201</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">http_url_to_repo</span>
<span class="ruby-identifier">http_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-string">&quot;/&quot;</span>, <span class="ruby-identifier">path_with_namespace</span>, <span class="ruby-string">&quot;.git&quot;</span>].<span class="ruby-identifier">join</span>(<span class="ruby-string">''</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-last_commit_for">
<b>last_commit_for</b>(ref, path = nil)
<a href="../classes/Repository.html#method-i-last_commit_for" name="method-i-last_commit_for" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-last_commit_for_source')" id="l_method-i-last_commit_for_source">show</a>
</p>
<div id="method-i-last_commit_for_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 35</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">last_commit_for</span>(<span class="ruby-identifier">ref</span>, <span class="ruby-identifier">path</span> = <span class="ruby-keyword">nil</span>)
<span class="ruby-identifier">commits</span>(<span class="ruby-identifier">ref</span>, <span class="ruby-identifier">path</span>, <span class="ruby-number">1</span>).<span class="ruby-identifier">first</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-namespace_dir">
<b>namespace_dir</b>()
<a href="../classes/Repository.html#method-i-namespace_dir" name="method-i-namespace_dir" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-namespace_dir_source')" id="l_method-i-namespace_dir_source">show</a>
</p>
<div id="method-i-namespace_dir_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 103</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">namespace_dir</span>
<span class="ruby-identifier">namespace</span>.<span class="ruby-identifier">try</span>(<span class="ruby-value">:path</span>) <span class="ruby-operator">||</span> <span class="ruby-string">''</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-open_branches">
<b>open_branches</b>()
<a href="../classes/Repository.html#method-i-open_branches" name="method-i-open_branches" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-open_branches_source')" id="l_method-i-open_branches_source">show</a>
</p>
<div id="method-i-open_branches_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 131</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">open_branches</span>
<span class="ruby-keyword">if</span> <span class="ruby-identifier">protected_branches</span>.<span class="ruby-identifier">empty?</span>
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">heads</span>
<span class="ruby-keyword">else</span>
<span class="ruby-identifier">pnames</span> = <span class="ruby-identifier">protected_branches</span>.<span class="ruby-identifier">map</span>(&amp;<span class="ruby-value">:name</span>)
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">heads</span>.<span class="ruby-identifier">reject</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">h</span><span class="ruby-operator">|</span> <span class="ruby-identifier">pnames</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">h</span>.<span class="ruby-identifier">name</span>) }
<span class="ruby-keyword">end</span>.<span class="ruby-identifier">sort_by</span>(&amp;<span class="ruby-value">:name</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-path_to_repo">
<b>path_to_repo</b>()
<a href="../classes/Repository.html#method-i-path_to_repo" name="method-i-path_to_repo" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-path_to_repo_source')" id="l_method-i-path_to_repo_source">show</a>
</p>
<div id="method-i-path_to_repo_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 99</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">path_to_repo</span>
<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">Gitlab</span>.<span class="ruby-identifier">config</span>.<span class="ruby-identifier">gitolite</span>.<span class="ruby-identifier">repos_path</span>, <span class="ruby-node">&quot;#{path_with_namespace}.git&quot;</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-protected_branch-3F">
<b>protected_branch?</b>(branch_name)
<a href="../classes/Repository.html#method-i-protected_branch-3F" name="method-i-protected_branch-3F" class="permalink">Link</a>
</div>
<div class="description">
<p>Check if current branch name is marked as protected in the system</p>
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-protected_branch-3F_source')" id="l_method-i-protected_branch-3F_source">show</a>
</p>
<div id="method-i-protected_branch-3F_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 206</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">protected_branch?</span> <span class="ruby-identifier">branch_name</span>
<span class="ruby-identifier">protected_branches</span>.<span class="ruby-identifier">map</span>(&amp;<span class="ruby-value">:name</span>).<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">branch_name</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-ref_names">
<b>ref_names</b>()
<a href="../classes/Repository.html#method-i-ref_names" name="method-i-ref_names" class="permalink">Link</a>
</div>
<div class="description">
<p>Returns an Array of branch and tag names</p>
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-ref_names_source')" id="l_method-i-ref_names_source">show</a>
</p>
<div id="method-i-ref_names_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 87</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">ref_names</span>
[<span class="ruby-identifier">branch_names</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">tag_names</span>].<span class="ruby-identifier">flatten</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-repo">
<b>repo</b>()
<a href="../classes/Repository.html#method-i-repo" name="method-i-repo" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-repo_source')" id="l_method-i-repo_source">show</a>
</p>
<div id="method-i-repo_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 91</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">repo</span>
<span class="ruby-ivar">@repo</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Grit</span><span class="ruby-operator">::</span><span class="ruby-constant">Repo</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">path_to_repo</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-repo_exists-3F">
<b>repo_exists?</b>()
<a href="../classes/Repository.html#method-i-repo_exists-3F" name="method-i-repo_exists-3F" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-repo_exists-3F_source')" id="l_method-i-repo_exists-3F_source">show</a>
</p>
<div id="method-i-repo_exists-3F_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 115</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">repo_exists?</span>
<span class="ruby-ivar">@repo_exists</span> <span class="ruby-operator">||=</span> (<span class="ruby-identifier">repo</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">repo</span>.<span class="ruby-identifier">branches</span>.<span class="ruby-identifier">empty?</span>)
<span class="ruby-keyword">rescue</span>
<span class="ruby-ivar">@repo_exists</span> = <span class="ruby-keyword">false</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-root_ref">
<b>root_ref</b>()
<a href="../classes/Repository.html#method-i-root_ref" name="method-i-root_ref" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-root_ref_source')" id="l_method-i-root_ref_source">show</a>
</p>
<div id="method-i-root_ref_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 162</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">root_ref</span>
<span class="ruby-identifier">default_branch</span> <span class="ruby-operator">||</span> <span class="ruby-string">&quot;master&quot;</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-root_ref-3F">
<b>root_ref?</b>(branch)
<a href="../classes/Repository.html#method-i-root_ref-3F" name="method-i-root_ref-3F" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-root_ref-3F_source')" id="l_method-i-root_ref-3F_source">show</a>
</p>
<div id="method-i-root_ref-3F_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 166</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">root_ref?</span>(<span class="ruby-identifier">branch</span>)
<span class="ruby-identifier">root_ref</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">branch</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-satellite">
<b>satellite</b>()
<a href="../classes/Repository.html#method-i-satellite" name="method-i-satellite" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-satellite_source')" id="l_method-i-satellite_source">show</a>
</p>
<div id="method-i-satellite_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 43</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">satellite</span>
<span class="ruby-ivar">@satellite</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Gitlab</span><span class="ruby-operator">::</span><span class="ruby-constant">Satellite</span><span class="ruby-operator">::</span><span class="ruby-constant">Satellite</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-ssh_url_to_repo">
<b>ssh_url_to_repo</b>()
<a href="../classes/Repository.html#method-i-ssh_url_to_repo" name="method-i-ssh_url_to_repo" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-ssh_url_to_repo_source')" id="l_method-i-ssh_url_to_repo_source">show</a>
</p>
<div id="method-i-ssh_url_to_repo_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 197</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">ssh_url_to_repo</span>
<span class="ruby-identifier">url_to_repo</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-tag_names">
<b>tag_names</b>()
<a href="../classes/Repository.html#method-i-tag_names" name="method-i-tag_names" class="permalink">Link</a>
</div>
<div class="description">
<p>Returns an Array of tag names</p>
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-tag_names_source')" id="l_method-i-tag_names_source">show</a>
</p>
<div id="method-i-tag_names_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 77</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">tag_names</span>
<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">tags</span>.<span class="ruby-identifier">collect</span>(&amp;<span class="ruby-value">:name</span>).<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">reverse</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-tags">
<b>tags</b>()
<a href="../classes/Repository.html#method-i-tags" name="method-i-tags" class="permalink">Link</a>
</div>
<div class="description">
<p>Returns an Array of Tags</p>
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-tags_source')" id="l_method-i-tags_source">show</a>
</p>
<div id="method-i-tags_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 82</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">tags</span>
<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">tags</span>.<span class="ruby-identifier">sort_by</span>(&amp;<span class="ruby-value">:name</span>).<span class="ruby-identifier">reverse</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-tree">
<b>tree</b>(fcommit, path = nil)
<a href="../classes/Repository.html#method-i-tree" name="method-i-tree" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-tree_source')" id="l_method-i-tree_source">show</a>
</p>
<div id="method-i-tree_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 125</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">tree</span>(<span class="ruby-identifier">fcommit</span>, <span class="ruby-identifier">path</span> = <span class="ruby-keyword">nil</span>)
<span class="ruby-identifier">fcommit</span> = <span class="ruby-identifier">commit</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">fcommit</span> <span class="ruby-operator">==</span> <span class="ruby-value">:head</span>
<span class="ruby-identifier">tree</span> = <span class="ruby-identifier">fcommit</span>.<span class="ruby-identifier">tree</span>
<span class="ruby-identifier">path</span> <span class="ruby-operator">?</span> (<span class="ruby-identifier">tree</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">path</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">tree</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-update_repository">
<b>update_repository</b>()
<a href="../classes/Repository.html#method-i-update_repository" name="method-i-update_repository" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-update_repository_source')" id="l_method-i-update_repository_source">show</a>
</p>
<div id="method-i-update_repository_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 107</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">update_repository</span>
<span class="ruby-identifier">git_host</span>.<span class="ruby-identifier">update_repository</span>(<span class="ruby-keyword">self</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-url_to_repo">
<b>url_to_repo</b>()
<a href="../classes/Repository.html#method-i-url_to_repo" name="method-i-url_to_repo" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-url_to_repo_source')" id="l_method-i-url_to_repo_source">show</a>
</p>
<div id="method-i-url_to_repo_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 95</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">url_to_repo</span>
<span class="ruby-identifier">git_host</span>.<span class="ruby-identifier">url_to_repo</span>(<span class="ruby-identifier">path_with_namespace</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-valid_hook_file">
<b>valid_hook_file</b>()
<a href="../classes/Repository.html#method-i-valid_hook_file" name="method-i-valid_hook_file" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-valid_hook_file_source')" id="l_method-i-valid_hook_file_source">show</a>
</p>
<div id="method-i-valid_hook_file_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 55</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">valid_hook_file</span>
<span class="ruby-ivar">@valid_hook_file</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-constant">Rails</span>.<span class="ruby-identifier">root</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">'lib'</span>, <span class="ruby-string">'hooks'</span>, <span class="ruby-string">'post-receive'</span>))
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-valid_post_receive_file-3F">
<b>valid_post_receive_file?</b>()
<a href="../classes/Repository.html#method-i-valid_post_receive_file-3F" name="method-i-valid_post_receive_file-3F" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-valid_post_receive_file-3F_source')" id="l_method-i-valid_post_receive_file-3F_source">show</a>
</p>
<div id="method-i-valid_post_receive_file-3F_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 51</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">valid_post_receive_file?</span>
<span class="ruby-identifier">valid_hook_file</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">hook_file</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-valid_repo-3F">
<b>valid_repo?</b>()
<a href="../classes/Repository.html#method-i-valid_repo-3F" name="method-i-valid_repo-3F" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-valid_repo-3F_source')" id="l_method-i-valid_repo-3F_source">show</a>
</p>
<div id="method-i-valid_repo-3F_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/roles/repository.rb, line 4</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">valid_repo?</span>
<span class="ruby-identifier">repo</span>
<span class="ruby-keyword">rescue</span>
<span class="ruby-identifier">errors</span>.<span class="ruby-identifier">add</span>(<span class="ruby-value">:path</span>, <span class="ruby-string">&quot;Invalid repository path&quot;</span>)
<span class="ruby-keyword">false</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>