Use sdoc to generate application code documentation

This commit is contained in:
Dmitriy Zaporozhets 2012-12-30 14:43:00 +02:00
parent d075df56d3
commit 96d49bf04c
589 changed files with 75674 additions and 99966 deletions

View file

@ -0,0 +1,305 @@
<?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>Gitlab::Satellite::Action</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>
Gitlab::Satellite::Action
<span class="parent">&lt;
Object
</span>
</h1>
<ul class="files">
<li><a href="../../../files/lib/gitlab/satellite/action_rb.html">lib/gitlab/satellite/action.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<!-- Method ref -->
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>I</dt>
<dd>
<ul>
<li>
<a href="#method-i-in_locked_and_timed_satellite">in_locked_and_timed_satellite</a>
</li>
</ul>
</dd>
<dt>N</dt>
<dd>
<ul>
<li>
<a href="#method-c-new">new</a>
</li>
</ul>
</dd>
<dt>P</dt>
<dd>
<ul>
<li>
<a href="#method-i-prepare_satellite-21">prepare_satellite!</a>
</li>
</ul>
</dd>
</dl>
<!-- Section constants -->
<div class="sectiontitle">Constants</div>
<table border='0' cellpadding='5'>
<tr valign='top'>
<td class="attr-name">DEFAULT_OPTIONS</td>
<td>=</td>
<td class="attr-value">{ git_timeout: 30.seconds }</td>
</tr>
<tr valign='top'>
<td>&nbsp;</td>
<td colspan="2" class="attr-desc"></td>
</tr>
</table>
<!-- 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'>options</td>
<td class='attr-desc'></td>
</tr>
<tr valign='top'>
<td class='attr-rw'>
[RW]
</td>
<td class='attr-name'>project</td>
<td class='attr-desc'></td>
</tr>
<tr valign='top'>
<td class='attr-rw'>
[RW]
</td>
<td class='attr-name'>user</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-new">
<b>new</b>(user, project, options = {})
<a href="../../../classes/Gitlab/Satellite/Action.html#method-c-new" name="method-c-new" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-c-new_source')" id="l_method-c-new_source">show</a>
</p>
<div id="method-c-new_source" class="dyn-source">
<pre><span class="ruby-comment"># File lib/gitlab/satellite/action.rb, line 8</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">initialize</span>(<span class="ruby-identifier">user</span>, <span class="ruby-identifier">project</span>, <span class="ruby-identifier">options</span> = {})
<span class="ruby-ivar">@options</span> = <span class="ruby-constant">DEFAULT_OPTIONS</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>)
<span class="ruby-ivar">@project</span> = <span class="ruby-identifier">project</span>
<span class="ruby-ivar">@user</span> = <span class="ruby-identifier">user</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="sectiontitle">Instance Protected methods</div>
<div class="method">
<div class="title method-title" id="method-i-in_locked_and_timed_satellite">
<b>in_locked_and_timed_satellite</b>()
<a href="../../../classes/Gitlab/Satellite/Action.html#method-i-in_locked_and_timed_satellite" name="method-i-in_locked_and_timed_satellite" class="permalink">Link</a>
</div>
<div class="description">
<ul><li>
<p>Sets a 30s timeout for Git</p>
</li><li>
<p>Locks the satellite repo</p>
</li><li>
<p>Yields the prepared satellite repo</p>
</li></ul>
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-in_locked_and_timed_satellite_source')" id="l_method-i-in_locked_and_timed_satellite_source">show</a>
</p>
<div id="method-i-in_locked_and_timed_satellite_source" class="dyn-source">
<pre><span class="ruby-comment"># File lib/gitlab/satellite/action.rb, line 19</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">in_locked_and_timed_satellite</span>
<span class="ruby-constant">Grit</span><span class="ruby-operator">::</span><span class="ruby-constant">Git</span>.<span class="ruby-identifier">with_timeout</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:git_timeout</span>]) <span class="ruby-keyword">do</span>
<span class="ruby-identifier">project</span>.<span class="ruby-identifier">satellite</span>.<span class="ruby-identifier">lock</span> <span class="ruby-keyword">do</span>
<span class="ruby-keyword">return</span> <span class="ruby-keyword">yield</span> <span class="ruby-identifier">project</span>.<span class="ruby-identifier">satellite</span>.<span class="ruby-identifier">repo</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOMEM</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ex</span>
<span class="ruby-constant">Gitlab</span><span class="ruby-operator">::</span><span class="ruby-constant">GitLogger</span>.<span class="ruby-identifier">error</span>(<span class="ruby-identifier">ex</span>.<span class="ruby-identifier">message</span>)
<span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span>
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">Grit</span><span class="ruby-operator">::</span><span class="ruby-constant">Git</span><span class="ruby-operator">::</span><span class="ruby-constant">GitTimeout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ex</span>
<span class="ruby-constant">Gitlab</span><span class="ruby-operator">::</span><span class="ruby-constant">GitLogger</span>.<span class="ruby-identifier">error</span>(<span class="ruby-identifier">ex</span>.<span class="ruby-identifier">message</span>)
<span class="ruby-keyword">return</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-prepare_satellite-21">
<b>prepare_satellite!</b>(repo)
<a href="../../../classes/Gitlab/Satellite/Action.html#method-i-prepare_satellite-21" name="method-i-prepare_satellite-21" class="permalink">Link</a>
</div>
<div class="description">
<ul><li>
<p>Clears the satellite</p>
</li><li>
<p>Updates the satellite from <a href="../Gitolite.html">Gitolite</a></p>
</li><li>
<p>Sets up Git variables for the user</p>
</li></ul>
<p>Note: use this within <a
href="Action.html#method-i-in_locked_and_timed_satellite">in_locked_and_timed_satellite</a></p>
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-prepare_satellite-21_source')" id="l_method-i-prepare_satellite-21_source">show</a>
</p>
<div id="method-i-prepare_satellite-21_source" class="dyn-source">
<pre><span class="ruby-comment"># File lib/gitlab/satellite/action.rb, line 38</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">prepare_satellite!</span>(<span class="ruby-identifier">repo</span>)
<span class="ruby-identifier">project</span>.<span class="ruby-identifier">satellite</span>.<span class="ruby-identifier">clear_and_update!</span>
<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">git</span>.<span class="ruby-identifier">config</span>({}, <span class="ruby-string">&quot;user.name&quot;</span>, <span class="ruby-identifier">user</span>.<span class="ruby-identifier">name</span>)
<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">git</span>.<span class="ruby-identifier">config</span>({}, <span class="ruby-string">&quot;user.email&quot;</span>, <span class="ruby-identifier">user</span>.<span class="ruby-identifier">email</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,284 @@
<?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>Gitlab::Satellite::EditFileAction</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>
Gitlab::Satellite::EditFileAction
<span class="parent">&lt;
Action
</span>
</h1>
<ul class="files">
<li><a href="../../../files/lib/gitlab/satellite/edit_file_action_rb.html">lib/gitlab/satellite/edit_file_action.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="description">
<p>GitLab server-side file update and commit</p>
</div>
<!-- Method ref -->
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>C</dt>
<dd>
<ul>
<li>
<a href="#method-i-can_edit-3F">can_edit?</a>,
</li>
<li>
<a href="#method-i-commit-21">commit!</a>
</li>
</ul>
</dd>
<dt>N</dt>
<dd>
<ul>
<li>
<a href="#method-c-new">new</a>
</li>
</ul>
</dd>
</dl>
<!-- 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'>file_path</td>
<td class='attr-desc'></td>
</tr>
<tr valign='top'>
<td class='attr-rw'>
[RW]
</td>
<td class='attr-name'>ref</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-new">
<b>new</b>(user, project, ref, file_path)
<a href="../../../classes/Gitlab/Satellite/EditFileAction.html#method-c-new" name="method-c-new" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-c-new_source')" id="l_method-c-new_source">show</a>
</p>
<div id="method-c-new_source" class="dyn-source">
<pre><span class="ruby-comment"># File lib/gitlab/satellite/edit_file_action.rb, line 7</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">initialize</span>(<span class="ruby-identifier">user</span>, <span class="ruby-identifier">project</span>, <span class="ruby-identifier">ref</span>, <span class="ruby-identifier">file_path</span>)
<span class="ruby-keyword">super</span> <span class="ruby-identifier">user</span>, <span class="ruby-identifier">project</span>, <span class="ruby-identifier">git_timeout</span><span class="ruby-operator">:</span> <span class="ruby-number">10</span>.<span class="ruby-identifier">seconds</span>
<span class="ruby-ivar">@file_path</span> = <span class="ruby-identifier">file_path</span>
<span class="ruby-ivar">@ref</span> = <span class="ruby-identifier">ref</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-commit-21">
<b>commit!</b>(content, commit_message, last_commit)
<a href="../../../classes/Gitlab/Satellite/EditFileAction.html#method-i-commit-21" name="method-i-commit-21" class="permalink">Link</a>
</div>
<div class="description">
<p>Updates the files content and creates a new commit for it</p>
<p>Returns false if the ref has been updated while editing the file Returns
false if commiting the change fails Returns false if pushing from the
satellite to <a href="../Gitolite.html">Gitolite</a> failed or was rejected
Returns true otherwise</p>
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-commit-21_source')" id="l_method-i-commit-21_source">show</a>
</p>
<div id="method-i-commit-21_source" class="dyn-source">
<pre><span class="ruby-comment"># File lib/gitlab/satellite/edit_file_action.rb, line 19</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">commit!</span>(<span class="ruby-identifier">content</span>, <span class="ruby-identifier">commit_message</span>, <span class="ruby-identifier">last_commit</span>)
<span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">can_edit?</span>(<span class="ruby-identifier">last_commit</span>)
<span class="ruby-identifier">in_locked_and_timed_satellite</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">repo</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">prepare_satellite!</span>(<span class="ruby-identifier">repo</span>)
<span class="ruby-comment"># create target branch in satellite at the corresponding commit from Gitolite</span>
<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">git</span>.<span class="ruby-identifier">checkout</span>({<span class="ruby-identifier">raise</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>, <span class="ruby-identifier">timeout</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>, <span class="ruby-identifier">b</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>}, <span class="ruby-identifier">ref</span>, <span class="ruby-node">&quot;origin/#{ref}&quot;</span>)
<span class="ruby-comment"># update the file in the satellite's working dir</span>
<span class="ruby-identifier">file_path_in_satellite</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">working_dir</span>, <span class="ruby-identifier">file_path</span>)
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">file_path_in_satellite</span>, <span class="ruby-string">'w'</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">content</span>) }
<span class="ruby-comment"># commit the changes</span>
<span class="ruby-comment"># will raise CommandFailed when commit fails</span>
<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">git</span>.<span class="ruby-identifier">commit</span>(<span class="ruby-identifier">raise</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>, <span class="ruby-identifier">timeout</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>, <span class="ruby-identifier">a</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>, <span class="ruby-identifier">m</span><span class="ruby-operator">:</span> <span class="ruby-identifier">commit_message</span>)
<span class="ruby-comment"># push commit back to Gitolite</span>
<span class="ruby-comment"># will raise CommandFailed when push fails</span>
<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">git</span>.<span class="ruby-identifier">push</span>({<span class="ruby-identifier">raise</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>, <span class="ruby-identifier">timeout</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>}, <span class="ruby-value">:origin</span>, <span class="ruby-identifier">ref</span>)
<span class="ruby-comment"># everything worked</span>
<span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">Grit</span><span class="ruby-operator">::</span><span class="ruby-constant">Git</span><span class="ruby-operator">::</span><span class="ruby-constant">CommandFailed</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ex</span>
<span class="ruby-constant">Gitlab</span><span class="ruby-operator">::</span><span class="ruby-constant">GitLogger</span>.<span class="ruby-identifier">error</span>(<span class="ruby-identifier">ex</span>.<span class="ruby-identifier">message</span>)
<span class="ruby-keyword">false</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="sectiontitle">Instance Protected methods</div>
<div class="method">
<div class="title method-title" id="method-i-can_edit-3F">
<b>can_edit?</b>(last_commit)
<a href="../../../classes/Gitlab/Satellite/EditFileAction.html#method-i-can_edit-3F" name="method-i-can_edit-3F" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-can_edit-3F_source')" id="l_method-i-can_edit-3F_source">show</a>
</p>
<div id="method-i-can_edit-3F_source" class="dyn-source">
<pre><span class="ruby-comment"># File lib/gitlab/satellite/edit_file_action.rb, line 51</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">can_edit?</span>(<span class="ruby-identifier">last_commit</span>)
<span class="ruby-identifier">current_last_commit</span> = <span class="ruby-ivar">@project</span>.<span class="ruby-identifier">last_commit_for</span>(<span class="ruby-identifier">ref</span>, <span class="ruby-identifier">file_path</span>).<span class="ruby-identifier">sha</span>
<span class="ruby-identifier">last_commit</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">current_last_commit</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,274 @@
<?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>Gitlab::Satellite::MergeAction</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>
Gitlab::Satellite::MergeAction
<span class="parent">&lt;
Action
</span>
</h1>
<ul class="files">
<li><a href="../../../files/lib/gitlab/satellite/merge_action_rb.html">lib/gitlab/satellite/merge_action.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="description">
<p>GitLab server-side merge</p>
</div>
<!-- Method ref -->
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>C</dt>
<dd>
<ul>
<li>
<a href="#method-i-can_be_merged-3F">can_be_merged?</a>
</li>
</ul>
</dd>
<dt>M</dt>
<dd>
<ul>
<li>
<a href="#method-i-merge-21">merge!</a>
</li>
</ul>
</dd>
<dt>N</dt>
<dd>
<ul>
<li>
<a href="#method-c-new">new</a>
</li>
</ul>
</dd>
</dl>
<!-- 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'>merge_request</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-new">
<b>new</b>(user, merge_request)
<a href="../../../classes/Gitlab/Satellite/MergeAction.html#method-c-new" name="method-c-new" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-c-new_source')" id="l_method-c-new_source">show</a>
</p>
<div id="method-c-new_source" class="dyn-source">
<pre><span class="ruby-comment"># File lib/gitlab/satellite/merge_action.rb, line 7</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">initialize</span>(<span class="ruby-identifier">user</span>, <span class="ruby-identifier">merge_request</span>)
<span class="ruby-keyword">super</span> <span class="ruby-identifier">user</span>, <span class="ruby-identifier">merge_request</span>.<span class="ruby-identifier">project</span>
<span class="ruby-ivar">@merge_request</span> = <span class="ruby-identifier">merge_request</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-can_be_merged-3F">
<b>can_be_merged?</b>()
<a href="../../../classes/Gitlab/Satellite/MergeAction.html#method-i-can_be_merged-3F" name="method-i-can_be_merged-3F" class="permalink">Link</a>
</div>
<div class="description">
<p>Checks if a merge request can be executed without user interaction</p>
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-can_be_merged-3F_source')" id="l_method-i-can_be_merged-3F_source">show</a>
</p>
<div id="method-i-can_be_merged-3F_source" class="dyn-source">
<pre><span class="ruby-comment"># File lib/gitlab/satellite/merge_action.rb, line 13</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">can_be_merged?</span>
<span class="ruby-identifier">in_locked_and_timed_satellite</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">merge_repo</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">merge_in_satellite!</span>(<span class="ruby-identifier">merge_repo</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-merge-21">
<b>merge!</b>()
<a href="../../../classes/Gitlab/Satellite/MergeAction.html#method-i-merge-21" name="method-i-merge-21" class="permalink">Link</a>
</div>
<div class="description">
<p>Merges the source branch into the target branch in the satellite and pushes
it back to <a href="../Gitolite.html">Gitolite</a>. It also removes the
source branch if requested in the merge request.</p>
<p>Returns false if the merge produced conflicts Returns false if pushing from
the satellite to <a href="../Gitolite.html">Gitolite</a> failed or was
rejected Returns true otherwise</p>
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-merge-21_source')" id="l_method-i-merge-21_source">show</a>
</p>
<div id="method-i-merge-21_source" class="dyn-source">
<pre><span class="ruby-comment"># File lib/gitlab/satellite/merge_action.rb, line 26</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">merge!</span>
<span class="ruby-identifier">in_locked_and_timed_satellite</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">merge_repo</span><span class="ruby-operator">|</span>
<span class="ruby-keyword">if</span> <span class="ruby-identifier">merge_in_satellite!</span>(<span class="ruby-identifier">merge_repo</span>)
<span class="ruby-comment"># push merge back to Gitolite</span>
<span class="ruby-comment"># will raise CommandFailed when push fails</span>
<span class="ruby-identifier">merge_repo</span>.<span class="ruby-identifier">git</span>.<span class="ruby-identifier">push</span>({<span class="ruby-identifier">raise</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>, <span class="ruby-identifier">timeout</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>}, <span class="ruby-value">:origin</span>, <span class="ruby-identifier">merge_request</span>.<span class="ruby-identifier">target_branch</span>)
<span class="ruby-comment"># remove source branch</span>
<span class="ruby-keyword">if</span> <span class="ruby-identifier">merge_request</span>.<span class="ruby-identifier">should_remove_source_branch</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">project</span>.<span class="ruby-identifier">root_ref?</span>(<span class="ruby-identifier">merge_request</span>.<span class="ruby-identifier">source_branch</span>)
<span class="ruby-comment"># will raise CommandFailed when push fails</span>
<span class="ruby-identifier">merge_repo</span>.<span class="ruby-identifier">git</span>.<span class="ruby-identifier">push</span>({<span class="ruby-identifier">raise</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>, <span class="ruby-identifier">timeout</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>}, <span class="ruby-value">:origin</span>, <span class="ruby-node">&quot;:#{merge_request.source_branch}&quot;</span>)
<span class="ruby-keyword">end</span>
<span class="ruby-comment"># merge, push and branch removal successful</span>
<span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">Grit</span><span class="ruby-operator">::</span><span class="ruby-constant">Git</span><span class="ruby-operator">::</span><span class="ruby-constant">CommandFailed</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ex</span>
<span class="ruby-constant">Gitlab</span><span class="ruby-operator">::</span><span class="ruby-constant">GitLogger</span>.<span class="ruby-identifier">error</span>(<span class="ruby-identifier">ex</span>.<span class="ruby-identifier">message</span>)
<span class="ruby-keyword">false</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,506 @@
<?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>Gitlab::Satellite::Satellite</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>
Gitlab::Satellite::Satellite
<span class="parent">&lt;
Object
</span>
</h1>
<ul class="files">
<li><a href="../../../files/lib/gitlab/satellite/satellite_rb.html">lib/gitlab/satellite/satellite.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<!-- Method ref -->
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>C</dt>
<dd>
<ul>
<li>
<a href="#method-i-clear_and_update-21">clear_and_update!</a>,
</li>
<li>
<a href="#method-i-create">create</a>
</li>
</ul>
</dd>
<dt>E</dt>
<dd>
<ul>
<li>
<a href="#method-i-exists-3F">exists?</a>
</li>
</ul>
</dd>
<dt>L</dt>
<dd>
<ul>
<li>
<a href="#method-i-lock">lock</a>,
</li>
<li>
<a href="#method-i-lock_file">lock_file</a>
</li>
</ul>
</dd>
<dt>N</dt>
<dd>
<ul>
<li>
<a href="#method-c-new">new</a>
</li>
</ul>
</dd>
<dt>P</dt>
<dd>
<ul>
<li>
<a href="#method-i-path">path</a>
</li>
</ul>
</dd>
<dt>R</dt>
<dd>
<ul>
<li>
<a href="#method-i-repo">repo</a>
</li>
</ul>
</dd>
</dl>
<!-- Section constants -->
<div class="sectiontitle">Constants</div>
<table border='0' cellpadding='5'>
<tr valign='top'>
<td class="attr-name">PARKING_BRANCH</td>
<td>=</td>
<td class="attr-value">&quot;__parking_branch&quot;</td>
</tr>
<tr valign='top'>
<td>&nbsp;</td>
<td colspan="2" class="attr-desc"></td>
</tr>
</table>
<!-- 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'>project</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-new">
<b>new</b>(project)
<a href="../../../classes/Gitlab/Satellite/Satellite.html#method-c-new" name="method-c-new" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-c-new_source')" id="l_method-c-new_source">show</a>
</p>
<div id="method-c-new_source" class="dyn-source">
<pre><span class="ruby-comment"># File lib/gitlab/satellite/satellite.rb, line 8</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">initialize</span>(<span class="ruby-identifier">project</span>)
<span class="ruby-ivar">@project</span> = <span class="ruby-identifier">project</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-clear_and_update-21">
<b>clear_and_update!</b>()
<a href="../../../classes/Gitlab/Satellite/Satellite.html#method-i-clear_and_update-21" name="method-i-clear_and_update-21" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-clear_and_update-21_source')" id="l_method-i-clear_and_update-21_source">show</a>
</p>
<div id="method-i-clear_and_update-21_source" class="dyn-source">
<pre><span class="ruby-comment"># File lib/gitlab/satellite/satellite.rb, line 12</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">clear_and_update!</span>
<span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;Satellite doesn't exist&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">exists?</span>
<span class="ruby-identifier">delete_heads!</span>
<span class="ruby-identifier">clear_working_dir!</span>
<span class="ruby-identifier">update_from_source!</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-create">
<b>create</b>()
<a href="../../../classes/Gitlab/Satellite/Satellite.html#method-i-create" name="method-i-create" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-create_source')" id="l_method-i-create_source">show</a>
</p>
<div id="method-i-create_source" class="dyn-source">
<pre><span class="ruby-comment"># File lib/gitlab/satellite/satellite.rb, line 20</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">create</span>
<span class="ruby-identifier">create_cmd</span> = <span class="ruby-node">&quot;git clone #{project.url_to_repo} #{path}&quot;</span>
<span class="ruby-keyword">if</span> <span class="ruby-identifier">system</span>(<span class="ruby-identifier">create_cmd</span>)
<span class="ruby-keyword">true</span>
<span class="ruby-keyword">else</span>
<span class="ruby-constant">Gitlab</span><span class="ruby-operator">::</span><span class="ruby-constant">GitLogger</span>.<span class="ruby-identifier">error</span>(<span class="ruby-node">&quot;Failed to create satellite for #{project.name_with_namespace}&quot;</span>)
<span class="ruby-keyword">false</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-exists-3F">
<b>exists?</b>()
<a href="../../../classes/Gitlab/Satellite/Satellite.html#method-i-exists-3F" name="method-i-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-exists-3F_source')" id="l_method-i-exists-3F_source">show</a>
</p>
<div id="method-i-exists-3F_source" class="dyn-source">
<pre><span class="ruby-comment"># File lib/gitlab/satellite/satellite.rb, line 30</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">exists?</span>
<span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</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-lock">
<b>lock</b>()
<a href="../../../classes/Gitlab/Satellite/Satellite.html#method-i-lock" name="method-i-lock" class="permalink">Link</a>
</div>
<div class="description">
<ul><li>
<p>Locks the satellite</p>
</li><li>
<p>Changes the current directory to the satellites working dir</p>
</li><li>
<p>Yields</p>
</li></ul>
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-lock_source')" id="l_method-i-lock_source">show</a>
</p>
<div id="method-i-lock_source" class="dyn-source">
<pre><span class="ruby-comment"># File lib/gitlab/satellite/satellite.rb, line 37</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">lock</span>
<span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;Satellite doesn't exist&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">exists?</span>
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">lock_file</span>, <span class="ruby-string">&quot;w+&quot;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">f</span>.<span class="ruby-identifier">flock</span>(<span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-constant">LOCK_EX</span>)
<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">chdir</span>(<span class="ruby-identifier">path</span>) <span class="ruby-keyword">do</span>
<span class="ruby-keyword">return</span> <span class="ruby-keyword">yield</span>
<span class="ruby-keyword">end</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-lock_file">
<b>lock_file</b>()
<a href="../../../classes/Gitlab/Satellite/Satellite.html#method-i-lock_file" name="method-i-lock_file" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-lock_file_source')" id="l_method-i-lock_file_source">show</a>
</p>
<div id="method-i-lock_file_source" class="dyn-source">
<pre><span class="ruby-comment"># File lib/gitlab/satellite/satellite.rb, line 49</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">lock_file</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-node">&quot;satellite_#{project.id}.lock&quot;</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-path">
<b>path</b>()
<a href="../../../classes/Gitlab/Satellite/Satellite.html#method-i-path" name="method-i-path" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-path_source')" id="l_method-i-path_source">show</a>
</p>
<div id="method-i-path_source" class="dyn-source">
<pre><span class="ruby-comment"># File lib/gitlab/satellite/satellite.rb, line 53</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">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;repo_satellites&quot;</span>, <span class="ruby-identifier">project</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-repo">
<b>repo</b>()
<a href="../../../classes/Gitlab/Satellite/Satellite.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 lib/gitlab/satellite/satellite.rb, line 57</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">repo</span>
<span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;Satellite doesn't exist&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">exists?</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</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>