<?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">< 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> </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">></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">></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">"user.name"</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">"user.email"</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>