diff options
author | Riyad Preukschas <riyad@informatik.uni-bremen.de> | 2013-01-15 00:52:25 +0100 |
---|---|---|
committer | Riyad Preukschas <riyad@informatik.uni-bremen.de> | 2013-01-15 00:52:25 +0100 |
commit | 30227869482bbbdbfea153f2b45ef3bb9a9fd218 (patch) | |
tree | aff64071116447092751770d2896998f62d1b44a /doc/code/classes/Key.html | |
parent | 8ee5fce9d64b70d8981896457484fae622d142c9 (diff) | |
parent | aca0caa8cc1a6bd481f87dd810284e69d3747050 (diff) | |
download | gitlab-ce-30227869482bbbdbfea153f2b45ef3bb9a9fd218.tar.gz |
Merge commit 'master' into discussions
Conflicts:
app/assets/stylesheets/sections/notes.scss
app/contexts/notes/load_context.rb
app/models/project.rb
app/observers/note_observer.rb
app/roles/votes.rb
app/views/commit/show.html.haml
app/views/merge_requests/_show.html.haml
app/views/merge_requests/diffs.js.haml
app/views/merge_requests/show.js.haml
app/views/notes/_note.html.haml
features/steps/project/project_merge_requests.rb
spec/models/note_spec.rb
Diffstat (limited to 'doc/code/classes/Key.html')
-rw-r--r-- | doc/code/classes/Key.html | 429 |
1 files changed, 429 insertions, 0 deletions
diff --git a/doc/code/classes/Key.html b/doc/code/classes/Key.html new file mode 100644 index 00000000000..0935e4862ef --- /dev/null +++ b/doc/code/classes/Key.html @@ -0,0 +1,429 @@ +<?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>Key</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> + Key + + <span class="parent">< + + ActiveRecord::Base + + </span> + + </h1> + <ul class="files"> + + <li><a href="../files/app/models/key_rb.html">app/models/key.rb</a></li> + + </ul> + </div> + <div id="bodyContent"> + <div id="content"> + + + + + + + + + + + + + + + <!-- Method ref --> + <div class="sectiontitle">Methods</div> + <dl class="methods"> + + <dt>F</dt> + <dd> + <ul> + + + <li> + <a href="#method-i-fingerprintable_key">fingerprintable_key</a> + </li> + + </ul> + </dd> + + <dt>I</dt> + <dd> + <ul> + + + <li> + <a href="#method-i-is_deploy_key">is_deploy_key</a> + </li> + + </ul> + </dd> + + <dt>L</dt> + <dd> + <ul> + + + <li> + <a href="#method-i-last_deploy-3F">last_deploy?</a> + </li> + + </ul> + </dd> + + <dt>P</dt> + <dd> + <ul> + + + <li> + <a href="#method-i-projects">projects</a> + </li> + + </ul> + </dd> + + <dt>S</dt> + <dd> + <ul> + + + <li> + <a href="#method-i-set_identifier">set_identifier</a>, + </li> + + + <li> + <a href="#method-i-strip_white_space">strip_white_space</a> + </li> + + </ul> + </dd> + + <dt>U</dt> + <dd> + <ul> + + + <li> + <a href="#method-i-unique_key">unique_key</a> + </li> + + </ul> + </dd> + + </dl> + + + + + + + + + + + + + + + + + + + <!-- Methods --> + + <div class="sectiontitle">Instance Public methods</div> + + <div class="method"> + <div class="title method-title" id="method-i-fingerprintable_key"> + + <b>fingerprintable_key</b>() + + <a href="../classes/Key.html#method-i-fingerprintable_key" name="method-i-fingerprintable_key" class="permalink">Link</a> + </div> + + + <div class="description"> + + </div> + + + + + + + <div class="sourcecode"> + + <p class="source-link"> + Source: + <a href="javascript:toggleSource('method-i-fingerprintable_key_source')" id="l_method-i-fingerprintable_key_source">show</a> + + </p> + <div id="method-i-fingerprintable_key_source" class="dyn-source"> + <pre><span class="ruby-comment"># File app/models/key.rb, line 44</span> +<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">fingerprintable_key</span> + <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">key</span> <span class="ruby-comment"># Don't test if there is no key.</span> + <span class="ruby-comment"># `ssh-keygen -lf /dev/stdin <<< "#{key}"` errors with: redirection unexpected</span> + <span class="ruby-identifier">file</span> = <span class="ruby-constant">Tempfile</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">'key_file'</span>) + <span class="ruby-keyword">begin</span> + <span class="ruby-identifier">file</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">key</span> + <span class="ruby-identifier">file</span>.<span class="ruby-identifier">rewind</span> + <span class="ruby-identifier">fingerprint_output</span> = <span class="ruby-node">%xssh-keygen -lf #{file.path} 2>&1`</span> <span class="ruby-comment"># Catch stderr.</span> + <span class="ruby-keyword">ensure</span> + <span class="ruby-identifier">file</span>.<span class="ruby-identifier">close</span> + <span class="ruby-identifier">file</span>.<span class="ruby-identifier">unlink</span> <span class="ruby-comment"># deletes the temp file</span> + <span class="ruby-keyword">end</span> + <span class="ruby-identifier">errors</span>.<span class="ruby-identifier">add</span>(<span class="ruby-value">:key</span>, <span class="ruby-string">"can't be fingerprinted"</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">fingerprint_output</span>.<span class="ruby-identifier">match</span>(<span class="ruby-string">"failed"</span>) +<span class="ruby-keyword">end</span></pre> + </div> + </div> + + </div> + + <div class="method"> + <div class="title method-title" id="method-i-is_deploy_key"> + + <b>is_deploy_key</b>() + + <a href="../classes/Key.html#method-i-is_deploy_key" name="method-i-is_deploy_key" class="permalink">Link</a> + </div> + + + <div class="description"> + + </div> + + + + + + + <div class="sourcecode"> + + <p class="source-link"> + Source: + <a href="javascript:toggleSource('method-i-is_deploy_key_source')" id="l_method-i-is_deploy_key_source">show</a> + + </p> + <div id="method-i-is_deploy_key_source" class="dyn-source"> + <pre><span class="ruby-comment"># File app/models/key.rb, line 67</span> +<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">is_deploy_key</span> + <span class="ruby-keyword">true</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">project_id</span> +<span class="ruby-keyword">end</span></pre> + </div> + </div> + + </div> + + <div class="method"> + <div class="title method-title" id="method-i-last_deploy-3F"> + + <b>last_deploy?</b>() + + <a href="../classes/Key.html#method-i-last_deploy-3F" name="method-i-last_deploy-3F" class="permalink">Link</a> + </div> + + + <div class="description"> + + </div> + + + + + + + <div class="sourcecode"> + + <p class="source-link"> + Source: + <a href="javascript:toggleSource('method-i-last_deploy-3F_source')" id="l_method-i-last_deploy-3F_source">show</a> + + </p> + <div id="method-i-last_deploy-3F_source" class="dyn-source"> + <pre><span class="ruby-comment"># File app/models/key.rb, line 80</span> +<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">last_deploy?</span> + <span class="ruby-constant">Key</span>.<span class="ruby-identifier">where</span>(<span class="ruby-identifier">identifier</span><span class="ruby-operator">:</span> <span class="ruby-identifier">identifier</span>).<span class="ruby-identifier">count</span> <span class="ruby-operator">==</span> <span class="ruby-number">0</span> +<span class="ruby-keyword">end</span></pre> + </div> + </div> + + </div> + + <div class="method"> + <div class="title method-title" id="method-i-projects"> + + <b>projects</b>() + + <a href="../classes/Key.html#method-i-projects" name="method-i-projects" class="permalink">Link</a> + </div> + + + <div class="description"> + <p>projects that has this key</p> + </div> + + + + + + + <div class="sourcecode"> + + <p class="source-link"> + Source: + <a href="javascript:toggleSource('method-i-projects_source')" id="l_method-i-projects_source">show</a> + + </p> + <div id="method-i-projects_source" class="dyn-source"> + <pre><span class="ruby-comment"># File app/models/key.rb, line 72</span> +<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">projects</span> + <span class="ruby-keyword">if</span> <span class="ruby-identifier">is_deploy_key</span> + [<span class="ruby-identifier">project</span>] + <span class="ruby-keyword">else</span> + <span class="ruby-identifier">user</span>.<span class="ruby-identifier">projects</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-set_identifier"> + + <b>set_identifier</b>() + + <a href="../classes/Key.html#method-i-set_identifier" name="method-i-set_identifier" class="permalink">Link</a> + </div> + + + <div class="description"> + + </div> + + + + + + + <div class="sourcecode"> + + <p class="source-link"> + Source: + <a href="javascript:toggleSource('method-i-set_identifier_source')" id="l_method-i-set_identifier_source">show</a> + + </p> + <div id="method-i-set_identifier_source" class="dyn-source"> + <pre><span class="ruby-comment"># File app/models/key.rb, line 59</span> +<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">set_identifier</span> + <span class="ruby-keyword">if</span> <span class="ruby-identifier">is_deploy_key</span> + <span class="ruby-keyword">self</span>.<span class="ruby-identifier">identifier</span> = <span class="ruby-node">"deploy_#{Digest::MD5.hexdigest(key)}"</span> + <span class="ruby-keyword">else</span> + <span class="ruby-keyword">self</span>.<span class="ruby-identifier">identifier</span> = <span class="ruby-node">"#{user.identifier}_#{Time.now.to_i}"</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-strip_white_space"> + + <b>strip_white_space</b>() + + <a href="../classes/Key.html#method-i-strip_white_space" name="method-i-strip_white_space" class="permalink">Link</a> + </div> + + + <div class="description"> + + </div> + + + + + + + <div class="sourcecode"> + + <p class="source-link"> + Source: + <a href="javascript:toggleSource('method-i-strip_white_space_source')" id="l_method-i-strip_white_space_source">show</a> + + </p> + <div id="method-i-strip_white_space_source" class="dyn-source"> + <pre><span class="ruby-comment"># File app/models/key.rb, line 32</span> +<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">strip_white_space</span> + <span class="ruby-keyword">self</span>.<span class="ruby-identifier">key</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">key</span>.<span class="ruby-identifier">strip</span> <span class="ruby-keyword">unless</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">key</span>.<span class="ruby-identifier">blank?</span> +<span class="ruby-keyword">end</span></pre> + </div> + </div> + + </div> + + <div class="method"> + <div class="title method-title" id="method-i-unique_key"> + + <b>unique_key</b>() + + <a href="../classes/Key.html#method-i-unique_key" name="method-i-unique_key" class="permalink">Link</a> + </div> + + + <div class="description"> + + </div> + + + + + + + <div class="sourcecode"> + + <p class="source-link"> + Source: + <a href="javascript:toggleSource('method-i-unique_key_source')" id="l_method-i-unique_key_source">show</a> + + </p> + <div id="method-i-unique_key_source" class="dyn-source"> + <pre><span class="ruby-comment"># File app/models/key.rb, line 36</span> +<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">unique_key</span> + <span class="ruby-identifier">query</span> = <span class="ruby-constant">Key</span>.<span class="ruby-identifier">where</span>(<span class="ruby-identifier">key</span><span class="ruby-operator">:</span> <span class="ruby-identifier">key</span>) + <span class="ruby-identifier">query</span> = <span class="ruby-identifier">query</span>.<span class="ruby-identifier">where</span>(<span class="ruby-string">'(project_id IS NULL OR project_id = ?)'</span>, <span class="ruby-identifier">project_id</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">project_id</span> + <span class="ruby-keyword">if</span> (<span class="ruby-identifier">query</span>.<span class="ruby-identifier">count</span> <span class="ruby-operator">></span> <span class="ruby-number">0</span>) + <span class="ruby-identifier">errors</span>.<span class="ruby-identifier">add</span> <span class="ruby-value">:key</span>, <span class="ruby-string">'already exist.'</span> + <span class="ruby-keyword">end</span> +<span class="ruby-keyword">end</span></pre> + </div> + </div> + + </div> + </div> + + </div> + </body> +</html>
\ No newline at end of file |