994 lines
42 KiB
HTML
994 lines
42 KiB
HTML
<!DOCTYPE html>
|
|
|
|
<html>
|
|
<head>
|
|
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
|
|
|
<title>class Gitlab::GitoliteConfig - Rails Application Documentation</title>
|
|
|
|
<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
|
|
|
|
<script type="text/javascript">
|
|
var rdoc_rel_prefix = "../";
|
|
</script>
|
|
|
|
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
|
<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
|
|
<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
|
|
<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
|
|
<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
|
|
<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
|
|
|
|
|
|
<body id="top" class="class">
|
|
<nav id="metadata">
|
|
<nav id="home-section" class="section">
|
|
<h3 class="section-header">
|
|
<a href="../index.html">Home</a>
|
|
<a href="../table_of_contents.html#classes">Classes</a>
|
|
<a href="../table_of_contents.html#methods">Methods</a>
|
|
</h3>
|
|
</nav>
|
|
|
|
|
|
<nav id="search-section" class="section project-section" class="initially-hidden">
|
|
<form action="#" method="get" accept-charset="utf-8">
|
|
<h3 class="section-header">
|
|
<input type="text" name="search" placeholder="Search" id="search-field"
|
|
title="Type to search, Up and Down to navigate, Enter to load">
|
|
</h3>
|
|
</form>
|
|
|
|
<ul id="search-results" class="initially-hidden"></ul>
|
|
</nav>
|
|
|
|
|
|
<div id="file-metadata">
|
|
<nav id="file-list-section" class="section">
|
|
<h3 class="section-header">Defined In</h3>
|
|
<ul>
|
|
<li>lib/gitlab/backend/gitolite_config.rb
|
|
</ul>
|
|
</nav>
|
|
|
|
|
|
</div>
|
|
|
|
<div id="class-metadata">
|
|
|
|
<nav id="parent-class-section" class="section">
|
|
<h3 class="section-header">Parent</h3>
|
|
|
|
<p class="link">Object
|
|
|
|
</nav>
|
|
|
|
|
|
<!-- Method Quickref -->
|
|
<nav id="method-list-section" class="section">
|
|
<h3 class="section-header">Methods</h3>
|
|
|
|
<ul class="link-list">
|
|
|
|
<li><a href="#method-i-admin_all_repo">#admin_all_repo</a>
|
|
|
|
<li><a href="#method-i-admin_all_repo-21">#admin_all_repo!</a>
|
|
|
|
<li><a href="#method-i-apply">#apply</a>
|
|
|
|
<li><a href="#method-i-destroy_project">#destroy_project</a>
|
|
|
|
<li><a href="#method-i-destroy_project-21">#destroy_project!</a>
|
|
|
|
<li><a href="#method-i-log">#log</a>
|
|
|
|
<li><a href="#method-i-rm_key">#rm_key</a>
|
|
|
|
<li><a href="#method-i-update_project">#update_project</a>
|
|
|
|
<li><a href="#method-i-update_project-21">#update_project!</a>
|
|
|
|
<li><a href="#method-i-update_project_config">#update_project_config</a>
|
|
|
|
<li><a href="#method-i-update_projects">#update_projects</a>
|
|
|
|
<li><a href="#method-i-write_key">#write_key</a>
|
|
|
|
</ul>
|
|
</nav>
|
|
|
|
</div>
|
|
|
|
<div id="project-metadata">
|
|
<nav id="fileindex-section" class="section project-section">
|
|
<h3 class="section-header">Pages</h3>
|
|
|
|
<ul>
|
|
|
|
<li class="file"><a href="../doc/README_FOR_APP.html">README_FOR_APP</a>
|
|
|
|
</ul>
|
|
</nav>
|
|
|
|
<nav id="classindex-section" class="section project-section">
|
|
<h3 class="section-header">Class and Module Index</h3>
|
|
|
|
<ul class="link-list">
|
|
|
|
<li><a href="../Gitlab.html">Gitlab</a>
|
|
|
|
<li><a href="../Gitlab/API.html">Gitlab::API</a>
|
|
|
|
<li><a href="../Gitlab/APIHelpers.html">Gitlab::APIHelpers</a>
|
|
|
|
<li><a href="../Gitlab/AppLogger.html">Gitlab::AppLogger</a>
|
|
|
|
<li><a href="../Gitlab/Auth.html">Gitlab::Auth</a>
|
|
|
|
<li><a href="../Gitlab/Encode.html">Gitlab::Encode</a>
|
|
|
|
<li><a href="../Gitlab/Entities.html">Gitlab::Entities</a>
|
|
|
|
<li><a href="../Gitlab/Entities/Hook.html">Gitlab::Entities::Hook</a>
|
|
|
|
<li><a href="../Gitlab/Entities/Issue.html">Gitlab::Entities::Issue</a>
|
|
|
|
<li><a href="../Gitlab/Entities/Milestone.html">Gitlab::Entities::Milestone</a>
|
|
|
|
<li><a href="../Gitlab/Entities/Project.html">Gitlab::Entities::Project</a>
|
|
|
|
<li><a href="../Gitlab/Entities/ProjectMember.html">Gitlab::Entities::ProjectMember</a>
|
|
|
|
<li><a href="../Gitlab/Entities/ProjectSnippet.html">Gitlab::Entities::ProjectSnippet</a>
|
|
|
|
<li><a href="../Gitlab/Entities/RepoCommit.html">Gitlab::Entities::RepoCommit</a>
|
|
|
|
<li><a href="../Gitlab/Entities/RepoObject.html">Gitlab::Entities::RepoObject</a>
|
|
|
|
<li><a href="../Gitlab/Entities/SSHKey.html">Gitlab::Entities::SSHKey</a>
|
|
|
|
<li><a href="../Gitlab/Entities/User.html">Gitlab::Entities::User</a>
|
|
|
|
<li><a href="../Gitlab/Entities/UserBasic.html">Gitlab::Entities::UserBasic</a>
|
|
|
|
<li><a href="../Gitlab/Entities/UserLogin.html">Gitlab::Entities::UserLogin</a>
|
|
|
|
<li><a href="../Gitlab/FileEditor.html">Gitlab::FileEditor</a>
|
|
|
|
<li><a href="../Gitlab/GitLogger.html">Gitlab::GitLogger</a>
|
|
|
|
<li><a href="../Gitlab/Gitolite.html">Gitlab::Gitolite</a>
|
|
|
|
<li><a href="../Gitlab/Gitolite/AccessDenied.html">Gitlab::Gitolite::AccessDenied</a>
|
|
|
|
<li><a href="../Gitlab/GitoliteConfig.html">Gitlab::GitoliteConfig</a>
|
|
|
|
<li><a href="../Gitlab/GitoliteConfig/PullError.html">Gitlab::GitoliteConfig::PullError</a>
|
|
|
|
<li><a href="../Gitlab/GitoliteConfig/PushError.html">Gitlab::GitoliteConfig::PushError</a>
|
|
|
|
<li><a href="../Gitlab/GraphCommit.html">Gitlab::GraphCommit</a>
|
|
|
|
<li><a href="../Gitlab/InlineDiff.html">Gitlab::InlineDiff</a>
|
|
|
|
<li><a href="../Gitlab/Issues.html">Gitlab::Issues</a>
|
|
|
|
<li><a href="../Gitlab/Logger.html">Gitlab::Logger</a>
|
|
|
|
<li><a href="../Gitlab/Markdown.html">Gitlab::Markdown</a>
|
|
|
|
<li><a href="../Gitlab/Merge.html">Gitlab::Merge</a>
|
|
|
|
<li><a href="../Gitlab/Milestones.html">Gitlab::Milestones</a>
|
|
|
|
<li><a href="../Gitlab/Projects.html">Gitlab::Projects</a>
|
|
|
|
<li><a href="../Gitlab/Satellite.html">Gitlab::Satellite</a>
|
|
|
|
<li><a href="../Gitlab/Session.html">Gitlab::Session</a>
|
|
|
|
<li><a href="../Gitlab/Theme.html">Gitlab::Theme</a>
|
|
|
|
<li><a href="../Gitlab/Users.html">Gitlab::Users</a>
|
|
|
|
<li><a href="../Admin.html">Admin</a>
|
|
|
|
<li><a href="../Admin/DashboardController.html">Admin::DashboardController</a>
|
|
|
|
<li><a href="../Admin/GroupsController.html">Admin::GroupsController</a>
|
|
|
|
<li><a href="../Admin/HooksController.html">Admin::HooksController</a>
|
|
|
|
<li><a href="../Admin/LogsController.html">Admin::LogsController</a>
|
|
|
|
<li><a href="../Admin/ProjectsController.html">Admin::ProjectsController</a>
|
|
|
|
<li><a href="../Admin/ResqueController.html">Admin::ResqueController</a>
|
|
|
|
<li><a href="../Admin/TeamMembersController.html">Admin::TeamMembersController</a>
|
|
|
|
<li><a href="../Admin/UsersController.html">Admin::UsersController</a>
|
|
|
|
<li><a href="../Notes.html">Notes</a>
|
|
|
|
<li><a href="../Notes/CreateContext.html">Notes::CreateContext</a>
|
|
|
|
<li><a href="../Notes/LoadContext.html">Notes::LoadContext</a>
|
|
|
|
<li><a href="../Redcarpet.html">Redcarpet</a>
|
|
|
|
<li><a href="../Redcarpet/Render.html">Redcarpet::Render</a>
|
|
|
|
<li><a href="../Redcarpet/Render/GitlabHTML.html">Redcarpet::Render::GitlabHTML</a>
|
|
|
|
<li><a href="../ExtractsPath.html">ExtractsPath</a>
|
|
|
|
<li><a href="../ExtractsPath/InvalidPathError.html">ExtractsPath::InvalidPathError</a>
|
|
|
|
<li><a href="../FileSizeValidator.html">FileSizeValidator</a>
|
|
|
|
<li><a href="../FileSizeValidator/Helper.html">FileSizeValidator::Helper</a>
|
|
|
|
<li><a href="../Grack.html">Grack</a>
|
|
|
|
<li><a href="../Grack/Auth.html">Grack::Auth</a>
|
|
|
|
<li><a href="../IssueCommonality.html">IssueCommonality</a>
|
|
|
|
<li><a href="../IssueCommonality/ClassMethods.html">IssueCommonality::ClassMethods</a>
|
|
|
|
<li><a href="../StaticModel.html">StaticModel</a>
|
|
|
|
<li><a href="../StaticModel/ClassMethods.html">StaticModel::ClassMethods</a>
|
|
|
|
<li><a href="../Ability.html">Ability</a>
|
|
|
|
<li><a href="../Account.html">Account</a>
|
|
|
|
<li><a href="../ActivityObserver.html">ActivityObserver</a>
|
|
|
|
<li><a href="../AdminController.html">AdminController</a>
|
|
|
|
<li><a href="../ApplicationController.html">ApplicationController</a>
|
|
|
|
<li><a href="../ApplicationDecorator.html">ApplicationDecorator</a>
|
|
|
|
<li><a href="../ApplicationHelper.html">ApplicationHelper</a>
|
|
|
|
<li><a href="../AttachmentUploader.html">AttachmentUploader</a>
|
|
|
|
<li><a href="../Authority.html">Authority</a>
|
|
|
|
<li><a href="../BaseContext.html">BaseContext</a>
|
|
|
|
<li><a href="../BlameController.html">BlameController</a>
|
|
|
|
<li><a href="../BlobController.html">BlobController</a>
|
|
|
|
<li><a href="../Commit.html">Commit</a>
|
|
|
|
<li><a href="../CommitController.html">CommitController</a>
|
|
|
|
<li><a href="../CommitDecorator.html">CommitDecorator</a>
|
|
|
|
<li><a href="../CommitLoadContext.html">CommitLoadContext</a>
|
|
|
|
<li><a href="../CommitsController.html">CommitsController</a>
|
|
|
|
<li><a href="../CommitsHelper.html">CommitsHelper</a>
|
|
|
|
<li><a href="../CompareController.html">CompareController</a>
|
|
|
|
<li><a href="../DashboardController.html">DashboardController</a>
|
|
|
|
<li><a href="../DeployKeysController.html">DeployKeysController</a>
|
|
|
|
<li><a href="../ErrorsController.html">ErrorsController</a>
|
|
|
|
<li><a href="../Event.html">Event</a>
|
|
|
|
<li><a href="../EventDecorator.html">EventDecorator</a>
|
|
|
|
<li><a href="../EventsHelper.html">EventsHelper</a>
|
|
|
|
<li><a href="../GitHost.html">GitHost</a>
|
|
|
|
<li><a href="../GitlabMarkdownHelper.html">GitlabMarkdownHelper</a>
|
|
|
|
<li><a href="../Group.html">Group</a>
|
|
|
|
<li><a href="../GroupsController.html">GroupsController</a>
|
|
|
|
<li><a href="../HelpController.html">HelpController</a>
|
|
|
|
<li><a href="../HooksController.html">HooksController</a>
|
|
|
|
<li><a href="../Issue.html">Issue</a>
|
|
|
|
<li><a href="../IssueObserver.html">IssueObserver</a>
|
|
|
|
<li><a href="../IssuesBulkUpdateContext.html">IssuesBulkUpdateContext</a>
|
|
|
|
<li><a href="../IssuesController.html">IssuesController</a>
|
|
|
|
<li><a href="../IssuesHelper.html">IssuesHelper</a>
|
|
|
|
<li><a href="../IssuesListContext.html">IssuesListContext</a>
|
|
|
|
<li><a href="../Key.html">Key</a>
|
|
|
|
<li><a href="../KeyObserver.html">KeyObserver</a>
|
|
|
|
<li><a href="../KeysController.html">KeysController</a>
|
|
|
|
<li><a href="../LabelsController.html">LabelsController</a>
|
|
|
|
<li><a href="../MergeRequest.html">MergeRequest</a>
|
|
|
|
<li><a href="../MergeRequestObserver.html">MergeRequestObserver</a>
|
|
|
|
<li><a href="../MergeRequestsController.html">MergeRequestsController</a>
|
|
|
|
<li><a href="../MergeRequestsHelper.html">MergeRequestsHelper</a>
|
|
|
|
<li><a href="../MergeRequestsLoadContext.html">MergeRequestsLoadContext</a>
|
|
|
|
<li><a href="../Milestone.html">Milestone</a>
|
|
|
|
<li><a href="../MilestonesController.html">MilestonesController</a>
|
|
|
|
<li><a href="../Note.html">Note</a>
|
|
|
|
<li><a href="../NoteObserver.html">NoteObserver</a>
|
|
|
|
<li><a href="../NotesController.html">NotesController</a>
|
|
|
|
<li><a href="../NotesHelper.html">NotesHelper</a>
|
|
|
|
<li><a href="../Notify.html">Notify</a>
|
|
|
|
<li><a href="../OmniauthCallbacksController.html">OmniauthCallbacksController</a>
|
|
|
|
<li><a href="../PostReceive.html">PostReceive</a>
|
|
|
|
<li><a href="../ProfileController.html">ProfileController</a>
|
|
|
|
<li><a href="../ProfileHelper.html">ProfileHelper</a>
|
|
|
|
<li><a href="../Project.html">Project</a>
|
|
|
|
<li><a href="../ProjectHook.html">ProjectHook</a>
|
|
|
|
<li><a href="../ProjectObserver.html">ProjectObserver</a>
|
|
|
|
<li><a href="../ProjectResourceController.html">ProjectResourceController</a>
|
|
|
|
<li><a href="../ProjectsController.html">ProjectsController</a>
|
|
|
|
<li><a href="../ProjectsHelper.html">ProjectsHelper</a>
|
|
|
|
<li><a href="../ProtectedBranch.html">ProtectedBranch</a>
|
|
|
|
<li><a href="../ProtectedBranchesController.html">ProtectedBranchesController</a>
|
|
|
|
<li><a href="../PushEvent.html">PushEvent</a>
|
|
|
|
<li><a href="../PushObserver.html">PushObserver</a>
|
|
|
|
<li><a href="../RefsController.html">RefsController</a>
|
|
|
|
<li><a href="../RepositoriesController.html">RepositoriesController</a>
|
|
|
|
<li><a href="../Repository.html">Repository</a>
|
|
|
|
<li><a href="../SearchContext.html">SearchContext</a>
|
|
|
|
<li><a href="../SearchController.html">SearchController</a>
|
|
|
|
<li><a href="../Snippet.html">Snippet</a>
|
|
|
|
<li><a href="../SnippetsController.html">SnippetsController</a>
|
|
|
|
<li><a href="../SnippetsHelper.html">SnippetsHelper</a>
|
|
|
|
<li><a href="../SystemHook.html">SystemHook</a>
|
|
|
|
<li><a href="../SystemHookObserver.html">SystemHookObserver</a>
|
|
|
|
<li><a href="../SystemHookWorker.html">SystemHookWorker</a>
|
|
|
|
<li><a href="../TabHelper.html">TabHelper</a>
|
|
|
|
<li><a href="../TagsHelper.html">TagsHelper</a>
|
|
|
|
<li><a href="../Team.html">Team</a>
|
|
|
|
<li><a href="../TeamMembersController.html">TeamMembersController</a>
|
|
|
|
<li><a href="../TestHookContext.html">TestHookContext</a>
|
|
|
|
<li><a href="../Tree.html">Tree</a>
|
|
|
|
<li><a href="../TreeController.html">TreeController</a>
|
|
|
|
<li><a href="../TreeDecorator.html">TreeDecorator</a>
|
|
|
|
<li><a href="../TreeHelper.html">TreeHelper</a>
|
|
|
|
<li><a href="../User.html">User</a>
|
|
|
|
<li><a href="../UserObserver.html">UserObserver</a>
|
|
|
|
<li><a href="../UsersProject.html">UsersProject</a>
|
|
|
|
<li><a href="../UsersProjectObserver.html">UsersProjectObserver</a>
|
|
|
|
<li><a href="../Votes.html">Votes</a>
|
|
|
|
<li><a href="../WebHook.html">WebHook</a>
|
|
|
|
<li><a href="../Wiki.html">Wiki</a>
|
|
|
|
<li><a href="../WikisController.html">WikisController</a>
|
|
|
|
</ul>
|
|
</nav>
|
|
|
|
</div>
|
|
</nav>
|
|
|
|
<div id="documentation">
|
|
<h1 class="class">class Gitlab::GitoliteConfig</h1>
|
|
|
|
<div id="description" class="description">
|
|
|
|
</div><!-- description -->
|
|
|
|
|
|
|
|
|
|
<section id="5Buntitled-5D" class="documentation-section">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Attributes -->
|
|
<section id="attribute-method-details" class="method-section section">
|
|
<h3 class="section-header">Attributes</h3>
|
|
|
|
|
|
<div id="attribute-i-conf" class="method-detail">
|
|
<div class="method-heading attribute-method-heading">
|
|
<span class="method-name">conf</span><span
|
|
class="attribute-access-type">[R]</span>
|
|
</div>
|
|
|
|
<div class="method-description">
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div id="attribute-i-config_tmp_dir" class="method-detail">
|
|
<div class="method-heading attribute-method-heading">
|
|
<span class="method-name">config_tmp_dir</span><span
|
|
class="attribute-access-type">[R]</span>
|
|
</div>
|
|
|
|
<div class="method-description">
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div id="attribute-i-ga_repo" class="method-detail">
|
|
<div class="method-heading attribute-method-heading">
|
|
<span class="method-name">ga_repo</span><span
|
|
class="attribute-access-type">[R]</span>
|
|
</div>
|
|
|
|
<div class="method-description">
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</section><!-- attribute-method-details -->
|
|
|
|
|
|
<!-- Methods -->
|
|
|
|
<section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
|
|
<h3 class="section-header">Public Instance Methods</h3>
|
|
|
|
|
|
<div id="method-i-admin_all_repo" class="method-detail ">
|
|
|
|
<div class="method-heading">
|
|
<span class="method-name">admin_all_repo</span><span
|
|
class="method-args">()</span>
|
|
<span class="method-click-advice">click to toggle source</span>
|
|
</div>
|
|
|
|
|
|
<div class="method-description">
|
|
|
|
<p>Enable access to all repos for gitolite admin. We use it for accept merge
|
|
request feature</p>
|
|
|
|
|
|
|
|
<div class="method-source-code" id="admin_all_repo-source">
|
|
<pre><span class="ruby-comment"># File lib/gitlab/backend/gitolite_config.rb, line 162</span>
|
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">admin_all_repo</span>
|
|
<span class="ruby-identifier">owner_name</span> = <span class="ruby-constant">Gitlab</span>.<span class="ruby-identifier">config</span>.<span class="ruby-identifier">gitolite_admin_key</span>
|
|
|
|
<span class="ruby-comment"># @ALL repos premission for gitolite owner</span>
|
|
<span class="ruby-identifier">repo_name</span> = <span class="ruby-string">"@all"</span>
|
|
<span class="ruby-identifier">repo</span> = <span class="ruby-keyword">if</span> <span class="ruby-identifier">conf</span>.<span class="ruby-identifier">has_repo?</span>(<span class="ruby-identifier">repo_name</span>)
|
|
<span class="ruby-identifier">conf</span>.<span class="ruby-identifier">get_repo</span>(<span class="ruby-identifier">repo_name</span>)
|
|
<span class="ruby-keyword">else</span>
|
|
<span class="ruby-operator">::</span><span class="ruby-constant">Gitolite</span><span class="ruby-operator">::</span><span class="ruby-constant">Config</span><span class="ruby-operator">::</span><span class="ruby-constant">Repo</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">repo_name</span>)
|
|
<span class="ruby-keyword">end</span>
|
|
|
|
<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">add_permission</span>(<span class="ruby-string">"RW+"</span>, <span class="ruby-string">""</span>, <span class="ruby-identifier">owner_name</span>)
|
|
<span class="ruby-identifier">conf</span>.<span class="ruby-identifier">add_repo</span>(<span class="ruby-identifier">repo</span>, <span class="ruby-keyword">true</span>)
|
|
<span class="ruby-keyword">end</span></pre>
|
|
</div><!-- admin_all_repo-source -->
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div><!-- admin_all_repo-method -->
|
|
|
|
|
|
<div id="method-i-admin_all_repo-21" class="method-detail ">
|
|
|
|
<div class="method-heading">
|
|
<span class="method-name">admin_all_repo!</span><span
|
|
class="method-args">()</span>
|
|
<span class="method-click-advice">click to toggle source</span>
|
|
</div>
|
|
|
|
|
|
<div class="method-description">
|
|
|
|
|
|
|
|
|
|
|
|
<div class="method-source-code" id="admin_all_repo-21-source">
|
|
<pre><span class="ruby-comment"># File lib/gitlab/backend/gitolite_config.rb, line 177</span>
|
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">admin_all_repo!</span>
|
|
<span class="ruby-identifier">apply</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">config</span><span class="ruby-operator">|</span> <span class="ruby-identifier">config</span>.<span class="ruby-identifier">admin_all_repo</span> }
|
|
<span class="ruby-keyword">end</span></pre>
|
|
</div><!-- admin_all_repo-21-source -->
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div><!-- admin_all_repo-21-method -->
|
|
|
|
|
|
<div id="method-i-apply" class="method-detail ">
|
|
|
|
<div class="method-heading">
|
|
<span class="method-name">apply</span><span
|
|
class="method-args">() { |self| ... }</span>
|
|
<span class="method-click-advice">click to toggle source</span>
|
|
</div>
|
|
|
|
|
|
<div class="method-description">
|
|
|
|
|
|
|
|
|
|
|
|
<div class="method-source-code" id="apply-source">
|
|
<pre><span class="ruby-comment"># File lib/gitlab/backend/gitolite_config.rb, line 20</span>
|
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">apply</span>
|
|
<span class="ruby-constant">Timeout</span><span class="ruby-operator">::</span><span class="ruby-identifier">timeout</span>(<span class="ruby-value">30</span>) <span class="ruby-keyword">do</span>
|
|
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-constant">Rails</span>.<span class="ruby-identifier">root</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">'tmp'</span>, <span class="ruby-string">"gitlabhq-gitolite.lock"</span>), <span class="ruby-string">"w+"</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-keyword">begin</span>
|
|
<span class="ruby-comment"># Set exclusive lock</span>
|
|
<span class="ruby-comment"># to prevent race condition</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-comment"># Pull gitolite-admin repo</span>
|
|
<span class="ruby-comment"># in tmp dir before do any changes</span>
|
|
<span class="ruby-identifier">pull</span>(<span class="ruby-identifier">config_tmp_dir</span>)
|
|
|
|
<span class="ruby-comment"># Build ga_repo object and @conf</span>
|
|
<span class="ruby-comment"># to access gitolite-admin configuration</span>
|
|
<span class="ruby-ivar">@conf</span> = <span class="ruby-identifier">ga_repo</span>.<span class="ruby-identifier">config</span>
|
|
|
|
<span class="ruby-comment"># Do any changes</span>
|
|
<span class="ruby-comment"># in gitolite-admin</span>
|
|
<span class="ruby-comment"># config here</span>
|
|
<span class="ruby-keyword">yield</span>(<span class="ruby-keyword">self</span>)
|
|
|
|
<span class="ruby-comment"># Save changes in</span>
|
|
<span class="ruby-comment"># gitolite-admin repo</span>
|
|
<span class="ruby-comment"># before push it</span>
|
|
<span class="ruby-identifier">ga_repo</span>.<span class="ruby-identifier">save</span>
|
|
|
|
<span class="ruby-comment"># Push gitolite-admin repo</span>
|
|
<span class="ruby-comment"># to apply all changes</span>
|
|
<span class="ruby-identifier">push</span>(<span class="ruby-identifier">config_tmp_dir</span>)
|
|
<span class="ruby-keyword">ensure</span>
|
|
<span class="ruby-comment"># Remove tmp dir</span>
|
|
<span class="ruby-comment"># removing the gitolite folder first is important to avoid</span>
|
|
<span class="ruby-comment"># NFS issues.</span>
|
|
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm_rf</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">config_tmp_dir</span>, <span class="ruby-string">'gitolite'</span>))
|
|
|
|
<span class="ruby-comment"># Remove parent tmp dir</span>
|
|
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm_rf</span>(<span class="ruby-identifier">config_tmp_dir</span>)
|
|
|
|
<span class="ruby-comment"># Unlock so other task can access</span>
|
|
<span class="ruby-comment"># gitolite configuration</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_UN</span>)
|
|
<span class="ruby-keyword">end</span>
|
|
<span class="ruby-keyword">end</span>
|
|
<span class="ruby-keyword">end</span>
|
|
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">PullError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">ex</span>
|
|
<span class="ruby-identifier">log</span>(<span class="ruby-string">"Pull error -> "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">ex</span>.<span class="ruby-identifier">message</span>)
|
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">Gitolite</span><span class="ruby-operator">::</span><span class="ruby-constant">AccessDenied</span>, <span class="ruby-identifier">ex</span>.<span class="ruby-identifier">message</span>
|
|
|
|
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">PushError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">ex</span>
|
|
<span class="ruby-identifier">log</span>(<span class="ruby-string">"Push error -> "</span> <span class="ruby-operator">+</span> <span class="ruby-string">" "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">ex</span>.<span class="ruby-identifier">message</span>)
|
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">Gitolite</span><span class="ruby-operator">::</span><span class="ruby-constant">AccessDenied</span>, <span class="ruby-identifier">ex</span>.<span class="ruby-identifier">message</span>
|
|
|
|
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">ex</span>
|
|
<span class="ruby-identifier">log</span>(<span class="ruby-identifier">ex</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">+</span> <span class="ruby-string">" "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">ex</span>.<span class="ruby-identifier">message</span>)
|
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">Gitolite</span><span class="ruby-operator">::</span><span class="ruby-constant">AccessDenied</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">"gitolite timeout"</span>)
|
|
<span class="ruby-keyword">end</span></pre>
|
|
</div><!-- apply-source -->
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div><!-- apply-method -->
|
|
|
|
|
|
<div id="method-i-destroy_project" class="method-detail ">
|
|
|
|
<div class="method-heading">
|
|
<span class="method-name">destroy_project</span><span
|
|
class="method-args">(project)</span>
|
|
<span class="method-click-advice">click to toggle source</span>
|
|
</div>
|
|
|
|
|
|
<div class="method-description">
|
|
|
|
|
|
|
|
|
|
|
|
<div class="method-source-code" id="destroy_project-source">
|
|
<pre><span class="ruby-comment"># File lib/gitlab/backend/gitolite_config.rb, line 81</span>
|
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">destroy_project</span>(<span class="ruby-identifier">project</span>)
|
|
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm_rf</span>(<span class="ruby-identifier">project</span>.<span class="ruby-identifier">path_to_repo</span>)
|
|
<span class="ruby-identifier">conf</span>.<span class="ruby-identifier">rm_repo</span>(<span class="ruby-identifier">project</span>.<span class="ruby-identifier">path</span>)
|
|
<span class="ruby-keyword">end</span></pre>
|
|
</div><!-- destroy_project-source -->
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div><!-- destroy_project-method -->
|
|
|
|
|
|
<div id="method-i-destroy_project-21" class="method-detail ">
|
|
|
|
<div class="method-heading">
|
|
<span class="method-name">destroy_project!</span><span
|
|
class="method-args">(project)</span>
|
|
<span class="method-click-advice">click to toggle source</span>
|
|
</div>
|
|
|
|
|
|
<div class="method-description">
|
|
|
|
|
|
|
|
|
|
|
|
<div class="method-source-code" id="destroy_project-21-source">
|
|
<pre><span class="ruby-comment"># File lib/gitlab/backend/gitolite_config.rb, line 86</span>
|
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">destroy_project!</span>(<span class="ruby-identifier">project</span>)
|
|
<span class="ruby-identifier">apply</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">config</span><span class="ruby-operator">|</span>
|
|
<span class="ruby-identifier">config</span>.<span class="ruby-identifier">destroy_project</span>(<span class="ruby-identifier">project</span>)
|
|
<span class="ruby-keyword">end</span>
|
|
<span class="ruby-keyword">end</span></pre>
|
|
</div><!-- destroy_project-21-source -->
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div><!-- destroy_project-21-method -->
|
|
|
|
|
|
<div id="method-i-log" class="method-detail ">
|
|
|
|
<div class="method-heading">
|
|
<span class="method-name">log</span><span
|
|
class="method-args">(message)</span>
|
|
<span class="method-click-advice">click to toggle source</span>
|
|
</div>
|
|
|
|
|
|
<div class="method-description">
|
|
|
|
|
|
|
|
|
|
|
|
<div class="method-source-code" id="log-source">
|
|
<pre><span class="ruby-comment"># File lib/gitlab/backend/gitolite_config.rb, line 77</span>
|
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">log</span> <span class="ruby-identifier">message</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">message</span>)
|
|
<span class="ruby-keyword">end</span></pre>
|
|
</div><!-- log-source -->
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div><!-- log-method -->
|
|
|
|
|
|
<div id="method-i-rm_key" class="method-detail ">
|
|
|
|
<div class="method-heading">
|
|
<span class="method-name">rm_key</span><span
|
|
class="method-args">(user)</span>
|
|
<span class="method-click-advice">click to toggle source</span>
|
|
</div>
|
|
|
|
|
|
<div class="method-description">
|
|
|
|
|
|
|
|
|
|
|
|
<div class="method-source-code" id="rm_key-source">
|
|
<pre><span class="ruby-comment"># File lib/gitlab/backend/gitolite_config.rb, line 98</span>
|
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">rm_key</span>(<span class="ruby-identifier">user</span>)
|
|
<span class="ruby-identifier">key_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">config_tmp_dir</span>, <span class="ruby-string">'gitolite/keydir'</span>, <span class="ruby-node">"#{user}.pub"</span>)
|
|
<span class="ruby-identifier">ga_key</span> = <span class="ruby-operator">::</span><span class="ruby-constant">Gitolite</span><span class="ruby-operator">::</span><span class="ruby-constant">SSHKey</span>.<span class="ruby-identifier">from_file</span>(<span class="ruby-identifier">key_path</span>)
|
|
<span class="ruby-identifier">ga_repo</span>.<span class="ruby-identifier">rm_key</span>(<span class="ruby-identifier">ga_key</span>)
|
|
<span class="ruby-keyword">end</span></pre>
|
|
</div><!-- rm_key-source -->
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div><!-- rm_key-method -->
|
|
|
|
|
|
<div id="method-i-update_project" class="method-detail ">
|
|
|
|
<div class="method-heading">
|
|
<span class="method-name">update_project</span><span
|
|
class="method-args">(repo_name, project)</span>
|
|
<span class="method-click-advice">click to toggle source</span>
|
|
</div>
|
|
|
|
|
|
<div class="method-description">
|
|
|
|
<p>update or create</p>
|
|
|
|
|
|
|
|
<div class="method-source-code" id="update_project-source">
|
|
<pre><span class="ruby-comment"># File lib/gitlab/backend/gitolite_config.rb, line 105</span>
|
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">update_project</span>(<span class="ruby-identifier">repo_name</span>, <span class="ruby-identifier">project</span>)
|
|
<span class="ruby-identifier">repo</span> = <span class="ruby-identifier">update_project_config</span>(<span class="ruby-identifier">project</span>, <span class="ruby-identifier">conf</span>)
|
|
<span class="ruby-identifier">conf</span>.<span class="ruby-identifier">add_repo</span>(<span class="ruby-identifier">repo</span>, <span class="ruby-keyword">true</span>)
|
|
<span class="ruby-keyword">end</span></pre>
|
|
</div><!-- update_project-source -->
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div><!-- update_project-method -->
|
|
|
|
|
|
<div id="method-i-update_project-21" class="method-detail ">
|
|
|
|
<div class="method-heading">
|
|
<span class="method-name">update_project!</span><span
|
|
class="method-args">(repo_name, project)</span>
|
|
<span class="method-click-advice">click to toggle source</span>
|
|
</div>
|
|
|
|
|
|
<div class="method-description">
|
|
|
|
|
|
|
|
|
|
|
|
<div class="method-source-code" id="update_project-21-source">
|
|
<pre><span class="ruby-comment"># File lib/gitlab/backend/gitolite_config.rb, line 110</span>
|
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">update_project!</span>(<span class="ruby-identifier">repo_name</span>, <span class="ruby-identifier">project</span>)
|
|
<span class="ruby-identifier">apply</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">config</span><span class="ruby-operator">|</span>
|
|
<span class="ruby-identifier">config</span>.<span class="ruby-identifier">update_project</span>(<span class="ruby-identifier">repo_name</span>, <span class="ruby-identifier">project</span>)
|
|
<span class="ruby-keyword">end</span>
|
|
<span class="ruby-keyword">end</span></pre>
|
|
</div><!-- update_project-21-source -->
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div><!-- update_project-21-method -->
|
|
|
|
|
|
<div id="method-i-update_project_config" class="method-detail ">
|
|
|
|
<div class="method-heading">
|
|
<span class="method-name">update_project_config</span><span
|
|
class="method-args">(project, conf)</span>
|
|
<span class="method-click-advice">click to toggle source</span>
|
|
</div>
|
|
|
|
|
|
<div class="method-description">
|
|
|
|
|
|
|
|
|
|
|
|
<div class="method-source-code" id="update_project_config-source">
|
|
<pre><span class="ruby-comment"># File lib/gitlab/backend/gitolite_config.rb, line 125</span>
|
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">update_project_config</span>(<span class="ruby-identifier">project</span>, <span class="ruby-identifier">conf</span>)
|
|
<span class="ruby-identifier">repo_name</span> = <span class="ruby-identifier">project</span>.<span class="ruby-identifier">path</span>
|
|
|
|
<span class="ruby-identifier">repo</span> = <span class="ruby-keyword">if</span> <span class="ruby-identifier">conf</span>.<span class="ruby-identifier">has_repo?</span>(<span class="ruby-identifier">repo_name</span>)
|
|
<span class="ruby-identifier">conf</span>.<span class="ruby-identifier">get_repo</span>(<span class="ruby-identifier">repo_name</span>)
|
|
<span class="ruby-keyword">else</span>
|
|
<span class="ruby-operator">::</span><span class="ruby-constant">Gitolite</span><span class="ruby-operator">::</span><span class="ruby-constant">Config</span><span class="ruby-operator">::</span><span class="ruby-constant">Repo</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">repo_name</span>)
|
|
<span class="ruby-keyword">end</span>
|
|
|
|
<span class="ruby-identifier">name_readers</span> = <span class="ruby-identifier">project</span>.<span class="ruby-identifier">repository_readers</span>
|
|
<span class="ruby-identifier">name_writers</span> = <span class="ruby-identifier">project</span>.<span class="ruby-identifier">repository_writers</span>
|
|
<span class="ruby-identifier">name_masters</span> = <span class="ruby-identifier">project</span>.<span class="ruby-identifier">repository_masters</span>
|
|
|
|
<span class="ruby-identifier">pr_br</span> = <span class="ruby-identifier">project</span>.<span class="ruby-identifier">protected_branches</span>.<span class="ruby-identifier">map</span>(&<span class="ruby-value">:name</span>).<span class="ruby-identifier">join</span>(<span class="ruby-string">"$ "</span>)
|
|
|
|
<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">clean_permissions</span>
|
|
|
|
<span class="ruby-comment"># Deny access to protected branches for writers</span>
|
|
<span class="ruby-keyword">unless</span> <span class="ruby-identifier">name_writers</span>.<span class="ruby-identifier">blank?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">pr_br</span>.<span class="ruby-identifier">blank?</span>
|
|
<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">add_permission</span>(<span class="ruby-string">"-"</span>, <span class="ruby-identifier">pr_br</span>.<span class="ruby-identifier">strip</span> <span class="ruby-operator">+</span> <span class="ruby-string">"$ "</span>, <span class="ruby-identifier">name_writers</span>)
|
|
<span class="ruby-keyword">end</span>
|
|
|
|
<span class="ruby-comment"># Add read permissions</span>
|
|
<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">add_permission</span>(<span class="ruby-string">"R"</span>, <span class="ruby-string">""</span>, <span class="ruby-identifier">name_readers</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">name_readers</span>.<span class="ruby-identifier">blank?</span>
|
|
|
|
<span class="ruby-comment"># Add write permissions</span>
|
|
<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">add_permission</span>(<span class="ruby-string">"RW+"</span>, <span class="ruby-string">""</span>, <span class="ruby-identifier">name_writers</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">name_writers</span>.<span class="ruby-identifier">blank?</span>
|
|
<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">add_permission</span>(<span class="ruby-string">"RW+"</span>, <span class="ruby-string">""</span>, <span class="ruby-identifier">name_masters</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">name_masters</span>.<span class="ruby-identifier">blank?</span>
|
|
|
|
<span class="ruby-comment"># Add sharedRepository config</span>
|
|
<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">set_git_config</span>(<span class="ruby-string">"core.sharedRepository"</span>, <span class="ruby-string">"0660"</span>)
|
|
|
|
<span class="ruby-identifier">repo</span>
|
|
<span class="ruby-keyword">end</span></pre>
|
|
</div><!-- update_project_config-source -->
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div><!-- update_project_config-method -->
|
|
|
|
|
|
<div id="method-i-update_projects" class="method-detail ">
|
|
|
|
<div class="method-heading">
|
|
<span class="method-name">update_projects</span><span
|
|
class="method-args">(projects)</span>
|
|
<span class="method-click-advice">click to toggle source</span>
|
|
</div>
|
|
|
|
|
|
<div class="method-description">
|
|
|
|
<p>Updates many projects and uses project.path as the repo path An order of
|
|
magnitude faster than <a
|
|
href="GitoliteConfig.html#method-i-update_project">#update_project</a></p>
|
|
|
|
|
|
|
|
<div class="method-source-code" id="update_projects-source">
|
|
<pre><span class="ruby-comment"># File lib/gitlab/backend/gitolite_config.rb, line 118</span>
|
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">update_projects</span>(<span class="ruby-identifier">projects</span>)
|
|
<span class="ruby-identifier">projects</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">project</span><span class="ruby-operator">|</span>
|
|
<span class="ruby-identifier">repo</span> = <span class="ruby-identifier">update_project_config</span>(<span class="ruby-identifier">project</span>, <span class="ruby-identifier">conf</span>)
|
|
<span class="ruby-identifier">conf</span>.<span class="ruby-identifier">add_repo</span>(<span class="ruby-identifier">repo</span>, <span class="ruby-keyword">true</span>)
|
|
<span class="ruby-keyword">end</span>
|
|
<span class="ruby-keyword">end</span></pre>
|
|
</div><!-- update_projects-source -->
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div><!-- update_projects-method -->
|
|
|
|
|
|
<div id="method-i-write_key" class="method-detail ">
|
|
|
|
<div class="method-heading">
|
|
<span class="method-name">write_key</span><span
|
|
class="method-args">(id, key)</span>
|
|
<span class="method-click-advice">click to toggle source</span>
|
|
</div>
|
|
|
|
|
|
<div class="method-description">
|
|
|
|
|
|
|
|
|
|
|
|
<div class="method-source-code" id="write_key-source">
|
|
<pre><span class="ruby-comment"># File lib/gitlab/backend/gitolite_config.rb, line 92</span>
|
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">write_key</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">key</span>)
|
|
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">config_tmp_dir</span>, <span class="ruby-string">'gitolite/keydir'</span>,<span class="ruby-node">"#{id}.pub"</span>), <span class="ruby-string">'w'</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">write</span>(<span class="ruby-identifier">key</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">%r\n/</span>,<span class="ruby-string">''</span>))
|
|
<span class="ruby-keyword">end</span>
|
|
<span class="ruby-keyword">end</span></pre>
|
|
</div><!-- write_key-source -->
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div><!-- write_key-method -->
|
|
|
|
|
|
</section><!-- public-instance-method-details -->
|
|
|
|
</section><!-- 5Buntitled-5D -->
|
|
|
|
</div><!-- documentation -->
|
|
|
|
|
|
<footer id="validator-badges">
|
|
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
|
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
|
|
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
|
</footer>
|
|
|