contributions 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rdoc_options +16 -0
- data/Rakefile +19 -0
- data/html/Contributions.html +139 -0
- data/html/Contributions/Contributions.html +747 -0
- data/html/Contributions/Git.html +405 -0
- data/html/Contributions/GithubAPI.html +430 -0
- data/html/Contributions/RepositoryList.html +389 -0
- data/html/Contributions/StringUtils.html +514 -0
- data/html/created.rid +9 -0
- data/html/images/add.png +0 -0
- data/html/images/brick.png +0 -0
- data/html/images/brick_link.png +0 -0
- data/html/images/bug.png +0 -0
- data/html/images/bullet_black.png +0 -0
- data/html/images/bullet_toggle_minus.png +0 -0
- data/html/images/bullet_toggle_plus.png +0 -0
- data/html/images/date.png +0 -0
- data/html/images/delete.png +0 -0
- data/html/images/find.png +0 -0
- data/html/images/loadingAnimation.gif +0 -0
- data/html/images/macFFBgHack.png +0 -0
- data/html/images/package.png +0 -0
- data/html/images/page_green.png +0 -0
- data/html/images/page_white_text.png +0 -0
- data/html/images/page_white_width.png +0 -0
- data/html/images/plugin.png +0 -0
- data/html/images/ruby.png +0 -0
- data/html/images/tag_blue.png +0 -0
- data/html/images/tag_green.png +0 -0
- data/html/images/transparent.png +0 -0
- data/html/images/wrench.png +0 -0
- data/html/images/wrench_orange.png +0 -0
- data/html/images/zoom.png +0 -0
- data/html/index.html +79 -0
- data/html/js/darkfish.js +153 -0
- data/html/js/jquery.js +18 -0
- data/html/js/navigation.js +142 -0
- data/html/js/search.js +94 -0
- data/html/js/search_index.js +1 -0
- data/html/js/searcher.js +228 -0
- data/html/rdoc.css +543 -0
- data/html/table_of_contents.html +163 -0
- data/lib/contributions/version.rb +1 -1
- metadata +49 -8
@@ -0,0 +1,405 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>class Contributions::Git - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
|
10
|
+
|
11
|
+
<script type="text/javascript">
|
12
|
+
var rdoc_rel_prefix = "../";
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
|
17
|
+
<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
|
18
|
+
<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
|
19
|
+
<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
|
20
|
+
<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
|
21
|
+
|
22
|
+
|
23
|
+
<body id="top" class="class">
|
24
|
+
<nav id="metadata">
|
25
|
+
<nav id="home-section" class="section">
|
26
|
+
<h3 class="section-header">
|
27
|
+
<a href="../index.html">Home</a>
|
28
|
+
<a href="../table_of_contents.html#classes">Classes</a>
|
29
|
+
<a href="../table_of_contents.html#methods">Methods</a>
|
30
|
+
</h3>
|
31
|
+
</nav>
|
32
|
+
|
33
|
+
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
36
|
+
<h3 class="section-header">
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
+
</h3>
|
40
|
+
</form>
|
41
|
+
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
+
</nav>
|
44
|
+
|
45
|
+
|
46
|
+
<div id="file-metadata">
|
47
|
+
<nav id="file-list-section" class="section">
|
48
|
+
<h3 class="section-header">Defined In</h3>
|
49
|
+
<ul>
|
50
|
+
<li>lib/contributions/git.rb
|
51
|
+
</ul>
|
52
|
+
</nav>
|
53
|
+
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<div id="class-metadata">
|
58
|
+
<nav id="sections-section" class="section">
|
59
|
+
<h3 class="section-header">Sections</h3>
|
60
|
+
<ul class="link-list">
|
61
|
+
|
62
|
+
<li><a href="#5Buntitled-5D"></a></li>
|
63
|
+
|
64
|
+
<li><a href="#Public">Public</a></li>
|
65
|
+
|
66
|
+
<li><a href="#Internal">Internal</a></li>
|
67
|
+
|
68
|
+
</ul>
|
69
|
+
</nav>
|
70
|
+
|
71
|
+
<nav id="parent-class-section" class="section">
|
72
|
+
<h3 class="section-header">Parent</h3>
|
73
|
+
|
74
|
+
<p class="link">Object
|
75
|
+
|
76
|
+
</nav>
|
77
|
+
|
78
|
+
|
79
|
+
<!-- Method Quickref -->
|
80
|
+
<nav id="method-list-section" class="section">
|
81
|
+
<h3 class="section-header">Methods</h3>
|
82
|
+
|
83
|
+
<ul class="link-list">
|
84
|
+
|
85
|
+
<li><a href="#method-c-clone">::clone</a>
|
86
|
+
|
87
|
+
<li><a href="#method-c-contributions">::contributions</a>
|
88
|
+
|
89
|
+
<li><a href="#method-c-log_format">::log_format</a>
|
90
|
+
|
91
|
+
<li><a href="#method-c-read_log">::read_log</a>
|
92
|
+
|
93
|
+
</ul>
|
94
|
+
</nav>
|
95
|
+
|
96
|
+
</div>
|
97
|
+
|
98
|
+
<div id="project-metadata">
|
99
|
+
|
100
|
+
<nav id="classindex-section" class="section project-section">
|
101
|
+
<h3 class="section-header">Class and Module Index</h3>
|
102
|
+
|
103
|
+
<ul class="link-list">
|
104
|
+
|
105
|
+
<li><a href="../Contributions.html">Contributions</a>
|
106
|
+
|
107
|
+
<li><a href="../Contributions/Contributions.html">Contributions::Contributions</a>
|
108
|
+
|
109
|
+
<li><a href="../Contributions/Git.html">Contributions::Git</a>
|
110
|
+
|
111
|
+
<li><a href="../Contributions/GithubAPI.html">Contributions::GithubAPI</a>
|
112
|
+
|
113
|
+
<li><a href="../Contributions/RepositoryList.html">Contributions::RepositoryList</a>
|
114
|
+
|
115
|
+
<li><a href="../Contributions/StringUtils.html">Contributions::StringUtils</a>
|
116
|
+
|
117
|
+
</ul>
|
118
|
+
</nav>
|
119
|
+
|
120
|
+
</div>
|
121
|
+
</nav>
|
122
|
+
|
123
|
+
<div id="documentation">
|
124
|
+
<h1 class="class">class Contributions::Git</h1>
|
125
|
+
|
126
|
+
<div id="description" class="description">
|
127
|
+
|
128
|
+
</div><!-- description -->
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
<!-- Constants -->
|
140
|
+
<section id="constants-list" class="section">
|
141
|
+
<h3 class="section-header">Constants</h3>
|
142
|
+
<dl>
|
143
|
+
|
144
|
+
<dt id="ENDING">ENDING
|
145
|
+
|
146
|
+
<dd class="description">
|
147
|
+
|
148
|
+
|
149
|
+
<dt id="KEYS">KEYS
|
150
|
+
|
151
|
+
<dd class="description">
|
152
|
+
|
153
|
+
|
154
|
+
<dt id="SEPARATOR">SEPARATOR
|
155
|
+
|
156
|
+
<dd class="description">
|
157
|
+
|
158
|
+
|
159
|
+
</dl>
|
160
|
+
</section>
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
<!-- Methods -->
|
166
|
+
|
167
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section section">
|
168
|
+
<h3 class="section-header">Public Class Methods</h3>
|
169
|
+
|
170
|
+
|
171
|
+
<div id="method-c-log_format" class="method-detail ">
|
172
|
+
|
173
|
+
<div class="method-heading">
|
174
|
+
<span class="method-name">log_format</span><span
|
175
|
+
class="method-args">()</span>
|
176
|
+
<span class="method-click-advice">click to toggle source</span>
|
177
|
+
</div>
|
178
|
+
|
179
|
+
|
180
|
+
<div class="method-description">
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
<div class="method-source-code" id="log_format-source">
|
187
|
+
<pre><span class="ruby-comment"># File lib/contributions/git.rb, line 60</span>
|
188
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">log_format</span>
|
189
|
+
[<span class="ruby-string">"%h"</span>, <span class="ruby-string">"%ci"</span>, <span class="ruby-string">"%s"</span>, <span class="ruby-string">"%b"</span>].<span class="ruby-identifier">join</span>(<span class="ruby-constant">SEPARATOR</span>) <span class="ruby-operator"><<</span> <span class="ruby-constant">ENDING</span>
|
190
|
+
<span class="ruby-keyword">end</span></pre>
|
191
|
+
</div><!-- log_format-source -->
|
192
|
+
|
193
|
+
</div>
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
</div><!-- log_format-method -->
|
199
|
+
|
200
|
+
|
201
|
+
</section><!-- public-class-method-details -->
|
202
|
+
|
203
|
+
</section><!-- 5Buntitled-5D -->
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
<section id="Public" class="documentation-section">
|
208
|
+
|
209
|
+
<div class="documentation-section-title">
|
210
|
+
<h2 class="section-header">
|
211
|
+
Public
|
212
|
+
</h2>
|
213
|
+
<span class="section-click-top">
|
214
|
+
<a href="#top">↑ top</a>
|
215
|
+
</span>
|
216
|
+
</div>
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
<!-- Methods -->
|
226
|
+
|
227
|
+
<section id="public-class-Public-method-details" class="method-section section">
|
228
|
+
<h3 class="section-header">Public Class Methods</h3>
|
229
|
+
|
230
|
+
|
231
|
+
<div id="method-c-clone" class="method-detail ">
|
232
|
+
|
233
|
+
<div class="method-heading">
|
234
|
+
<span class="method-name">clone</span><span
|
235
|
+
class="method-args">(repository) { || ... }</span>
|
236
|
+
<span class="method-click-advice">click to toggle source</span>
|
237
|
+
</div>
|
238
|
+
|
239
|
+
|
240
|
+
<div class="method-description">
|
241
|
+
|
242
|
+
<p>Clone a repository and run the block passed inside the newly cloned
|
243
|
+
repository.</p>
|
244
|
+
<dl class="rdoc-list note-list"><dt>repository
|
245
|
+
<dd>
|
246
|
+
<p>a ‘username/repository_name’ string.</p>
|
247
|
+
</dd><dt>block
|
248
|
+
<dd>
|
249
|
+
<p>a block to be executed inside the newly cloned directory.</p>
|
250
|
+
</dd></dl>
|
251
|
+
|
252
|
+
<p>Returns the return value of the block.</p>
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
<div class="method-source-code" id="clone-source">
|
257
|
+
<pre><span class="ruby-comment"># File lib/contributions/git.rb, line 33</span>
|
258
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">clone</span>(<span class="ruby-identifier">repository</span>, &<span class="ruby-identifier">block</span>)
|
259
|
+
<span class="ruby-identifier">value</span> = <span class="ruby-string">''</span>
|
260
|
+
<span class="ruby-identifier">repo_name</span> = <span class="ruby-identifier">repository</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp">%r([^\/]*$)/</span>)[<span class="ruby-value">1</span>]
|
261
|
+
<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">mktmpdir</span>(<span class="ruby-identifier">repo_name</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">dir</span><span class="ruby-operator">|</span>
|
262
|
+
<span class="ruby-identifier">cloned_repo_name</span> = <span class="ruby-identifier">dir</span> <span class="ruby-operator">+</span> <span class="ruby-string">'/'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">repo_name</span>
|
263
|
+
<span class="ruby-identifier">system</span> <span class="ruby-node">"git clone -q https://github.com/#{repository} #{cloned_repo_name}"</span>
|
264
|
+
<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">chdir</span>(<span class="ruby-identifier">cloned_repo_name</span>) <span class="ruby-keyword">do</span>
|
265
|
+
<span class="ruby-identifier">value</span> = <span class="ruby-keyword">yield</span>
|
266
|
+
<span class="ruby-keyword">end</span>
|
267
|
+
|
268
|
+
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm_rf</span>(<span class="ruby-identifier">cloned_repo_name</span>)
|
269
|
+
<span class="ruby-keyword">end</span>
|
270
|
+
|
271
|
+
<span class="ruby-identifier">value</span>
|
272
|
+
<span class="ruby-keyword">end</span></pre>
|
273
|
+
</div><!-- clone-source -->
|
274
|
+
|
275
|
+
</div>
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
</div><!-- clone-method -->
|
281
|
+
|
282
|
+
|
283
|
+
<div id="method-c-contributions" class="method-detail ">
|
284
|
+
|
285
|
+
<div class="method-heading">
|
286
|
+
<span class="method-name">contributions</span><span
|
287
|
+
class="method-args">(user, repository)</span>
|
288
|
+
<span class="method-click-advice">click to toggle source</span>
|
289
|
+
</div>
|
290
|
+
|
291
|
+
|
292
|
+
<div class="method-description">
|
293
|
+
|
294
|
+
<p>Get all the contributions in a repository by a user (contributions for
|
295
|
+
which the user is the <strong>author</strong>).</p>
|
296
|
+
<dl class="rdoc-list note-list"><dt>user
|
297
|
+
<dd>
|
298
|
+
<p>a user’s name (the name that shows up as the committer or author—e.g.,
|
299
|
+
‘John Smith’</p>
|
300
|
+
</dd><dt>repository
|
301
|
+
<dd>
|
302
|
+
<p>a ‘username/repository_name’ string.</p>
|
303
|
+
</dd></dl>
|
304
|
+
|
305
|
+
<p>Returns an Array of Hashes with keys for :sha, :date, :subject, :body</p>
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
<div class="method-source-code" id="contributions-source">
|
310
|
+
<pre><span class="ruby-comment"># File lib/contributions/git.rb, line 20</span>
|
311
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">contributions</span>(<span class="ruby-identifier">user</span>, <span class="ruby-identifier">repository</span>)
|
312
|
+
<span class="ruby-identifier">log</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">clone</span>(<span class="ruby-identifier">repository</span>) { <span class="ruby-keyword">self</span>.<span class="ruby-identifier">read_log</span>(<span class="ruby-identifier">user</span>) }
|
313
|
+
<span class="ruby-constant">StringUtils</span>.<span class="ruby-identifier">string_to_hash</span>(<span class="ruby-identifier">log</span>, <span class="ruby-constant">KEYS</span>, <span class="ruby-constant">SEPARATOR</span>, <span class="ruby-constant">ENDING</span>)
|
314
|
+
<span class="ruby-keyword">end</span></pre>
|
315
|
+
</div><!-- contributions-source -->
|
316
|
+
|
317
|
+
</div>
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
</div><!-- contributions-method -->
|
323
|
+
|
324
|
+
|
325
|
+
</section><!-- public-class-method-details -->
|
326
|
+
|
327
|
+
</section><!-- Public -->
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
<section id="Internal" class="documentation-section">
|
332
|
+
|
333
|
+
<div class="documentation-section-title">
|
334
|
+
<h2 class="section-header">
|
335
|
+
Internal
|
336
|
+
</h2>
|
337
|
+
<span class="section-click-top">
|
338
|
+
<a href="#top">↑ top</a>
|
339
|
+
</span>
|
340
|
+
</div>
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
<!-- Methods -->
|
350
|
+
|
351
|
+
<section id="public-class-Internal-method-details" class="method-section section">
|
352
|
+
<h3 class="section-header">Public Class Methods</h3>
|
353
|
+
|
354
|
+
|
355
|
+
<div id="method-c-read_log" class="method-detail ">
|
356
|
+
|
357
|
+
<div class="method-heading">
|
358
|
+
<span class="method-name">read_log</span><span
|
359
|
+
class="method-args">(user)</span>
|
360
|
+
<span class="method-click-advice">click to toggle source</span>
|
361
|
+
</div>
|
362
|
+
|
363
|
+
|
364
|
+
<div class="method-description">
|
365
|
+
|
366
|
+
<p>The command to read the git log.</p>
|
367
|
+
<dl class="rdoc-list note-list"><dt>user
|
368
|
+
<dd>
|
369
|
+
<p>the user’s name.</p>
|
370
|
+
</dd></dl>
|
371
|
+
|
372
|
+
<p>Returns nothing.</p>
|
373
|
+
|
374
|
+
|
375
|
+
|
376
|
+
<div class="method-source-code" id="read_log-source">
|
377
|
+
<pre><span class="ruby-comment"># File lib/contributions/git.rb, line 54</span>
|
378
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">read_log</span>(<span class="ruby-identifier">user</span>)
|
379
|
+
<span class="ruby-comment"># We want a string returned (for parsing); so use read over</span>
|
380
|
+
<span class="ruby-comment"># readlines.</span>
|
381
|
+
<span class="ruby-constant">IO</span>.<span class="ruby-identifier">popen</span>(<span class="ruby-node">"git log --author='#{user}' --format='#{self.log_format}' --no-color"</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">io</span><span class="ruby-operator">|</span> <span class="ruby-identifier">io</span>.<span class="ruby-identifier">read</span> }
|
382
|
+
<span class="ruby-keyword">end</span></pre>
|
383
|
+
</div><!-- read_log-source -->
|
384
|
+
|
385
|
+
</div>
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
|
390
|
+
</div><!-- read_log-method -->
|
391
|
+
|
392
|
+
|
393
|
+
</section><!-- public-class-method-details -->
|
394
|
+
|
395
|
+
</section><!-- Internal -->
|
396
|
+
|
397
|
+
</div><!-- documentation -->
|
398
|
+
|
399
|
+
|
400
|
+
<footer id="validator-badges">
|
401
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
402
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
|
403
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
404
|
+
</footer>
|
405
|
+
|
@@ -0,0 +1,430 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>class Contributions::GithubAPI - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
|
10
|
+
|
11
|
+
<script type="text/javascript">
|
12
|
+
var rdoc_rel_prefix = "../";
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
|
17
|
+
<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
|
18
|
+
<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
|
19
|
+
<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
|
20
|
+
<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
|
21
|
+
|
22
|
+
|
23
|
+
<body id="top" class="class">
|
24
|
+
<nav id="metadata">
|
25
|
+
<nav id="home-section" class="section">
|
26
|
+
<h3 class="section-header">
|
27
|
+
<a href="../index.html">Home</a>
|
28
|
+
<a href="../table_of_contents.html#classes">Classes</a>
|
29
|
+
<a href="../table_of_contents.html#methods">Methods</a>
|
30
|
+
</h3>
|
31
|
+
</nav>
|
32
|
+
|
33
|
+
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
36
|
+
<h3 class="section-header">
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
+
</h3>
|
40
|
+
</form>
|
41
|
+
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
+
</nav>
|
44
|
+
|
45
|
+
|
46
|
+
<div id="file-metadata">
|
47
|
+
<nav id="file-list-section" class="section">
|
48
|
+
<h3 class="section-header">Defined In</h3>
|
49
|
+
<ul>
|
50
|
+
<li>lib/contributions/github_api.rb
|
51
|
+
</ul>
|
52
|
+
</nav>
|
53
|
+
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<div id="class-metadata">
|
58
|
+
<nav id="sections-section" class="section">
|
59
|
+
<h3 class="section-header">Sections</h3>
|
60
|
+
<ul class="link-list">
|
61
|
+
|
62
|
+
<li><a href="#5Buntitled-5D"></a></li>
|
63
|
+
|
64
|
+
<li><a href="#Public">Public</a></li>
|
65
|
+
|
66
|
+
<li><a href="#Internal">Internal</a></li>
|
67
|
+
|
68
|
+
</ul>
|
69
|
+
</nav>
|
70
|
+
|
71
|
+
<nav id="parent-class-section" class="section">
|
72
|
+
<h3 class="section-header">Parent</h3>
|
73
|
+
|
74
|
+
<p class="link">Object
|
75
|
+
|
76
|
+
</nav>
|
77
|
+
|
78
|
+
|
79
|
+
<!-- Method Quickref -->
|
80
|
+
<nav id="method-list-section" class="section">
|
81
|
+
<h3 class="section-header">Methods</h3>
|
82
|
+
|
83
|
+
<ul class="link-list">
|
84
|
+
|
85
|
+
<li><a href="#method-c-forks">::forks</a>
|
86
|
+
|
87
|
+
<li><a href="#method-c-name">::name</a>
|
88
|
+
|
89
|
+
<li><a href="#method-c-parent">::parent</a>
|
90
|
+
|
91
|
+
<li><a href="#method-c-repos">::repos</a>
|
92
|
+
|
93
|
+
<li><a href="#method-c-repository">::repository</a>
|
94
|
+
|
95
|
+
<li><a href="#method-c-user">::user</a>
|
96
|
+
|
97
|
+
</ul>
|
98
|
+
</nav>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<div id="project-metadata">
|
103
|
+
|
104
|
+
<nav id="classindex-section" class="section project-section">
|
105
|
+
<h3 class="section-header">Class and Module Index</h3>
|
106
|
+
|
107
|
+
<ul class="link-list">
|
108
|
+
|
109
|
+
<li><a href="../Contributions.html">Contributions</a>
|
110
|
+
|
111
|
+
<li><a href="../Contributions/Contributions.html">Contributions::Contributions</a>
|
112
|
+
|
113
|
+
<li><a href="../Contributions/Git.html">Contributions::Git</a>
|
114
|
+
|
115
|
+
<li><a href="../Contributions/GithubAPI.html">Contributions::GithubAPI</a>
|
116
|
+
|
117
|
+
<li><a href="../Contributions/RepositoryList.html">Contributions::RepositoryList</a>
|
118
|
+
|
119
|
+
<li><a href="../Contributions/StringUtils.html">Contributions::StringUtils</a>
|
120
|
+
|
121
|
+
</ul>
|
122
|
+
</nav>
|
123
|
+
|
124
|
+
</div>
|
125
|
+
</nav>
|
126
|
+
|
127
|
+
<div id="documentation">
|
128
|
+
<h1 class="class">class Contributions::GithubAPI</h1>
|
129
|
+
|
130
|
+
<div id="description" class="description">
|
131
|
+
|
132
|
+
</div><!-- description -->
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
<!-- Methods -->
|
147
|
+
|
148
|
+
</section><!-- 5Buntitled-5D -->
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
<section id="Public" class="documentation-section">
|
153
|
+
|
154
|
+
<div class="documentation-section-title">
|
155
|
+
<h2 class="section-header">
|
156
|
+
Public
|
157
|
+
</h2>
|
158
|
+
<span class="section-click-top">
|
159
|
+
<a href="#top">↑ top</a>
|
160
|
+
</span>
|
161
|
+
</div>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
<!-- Methods -->
|
171
|
+
|
172
|
+
<section id="public-class-Public-method-details" class="method-section section">
|
173
|
+
<h3 class="section-header">Public Class Methods</h3>
|
174
|
+
|
175
|
+
|
176
|
+
<div id="method-c-forks" class="method-detail ">
|
177
|
+
|
178
|
+
<div class="method-heading">
|
179
|
+
<span class="method-name">forks</span><span
|
180
|
+
class="method-args">(username)</span>
|
181
|
+
<span class="method-click-advice">click to toggle source</span>
|
182
|
+
</div>
|
183
|
+
|
184
|
+
|
185
|
+
<div class="method-description">
|
186
|
+
|
187
|
+
<p>Get just the user’s repositories that are forks.</p>
|
188
|
+
|
189
|
+
<p>Returns an Array.</p>
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
<div class="method-source-code" id="forks-source">
|
194
|
+
<pre><span class="ruby-comment"># File lib/contributions/github_api.rb, line 10</span>
|
195
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">forks</span>(<span class="ruby-identifier">username</span>)
|
196
|
+
<span class="ruby-identifier">forks</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">repos</span>(<span class="ruby-identifier">username</span>).<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-identifier">r</span>[<span class="ruby-string">"fork"</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword">true</span> }
|
197
|
+
<span class="ruby-identifier">repo_names</span> = <span class="ruby-identifier">forks</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-identifier">r</span>[<span class="ruby-string">"owner"</span>][<span class="ruby-string">"login"</span>] <span class="ruby-operator">+</span> <span class="ruby-string">'/'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">r</span>[<span class="ruby-string">"name"</span>] }
|
198
|
+
<span class="ruby-identifier">repo_names</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">parent</span>(<span class="ruby-identifier">r</span>) }
|
199
|
+
<span class="ruby-keyword">end</span></pre>
|
200
|
+
</div><!-- forks-source -->
|
201
|
+
|
202
|
+
</div>
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
</div><!-- forks-method -->
|
208
|
+
|
209
|
+
|
210
|
+
<div id="method-c-name" class="method-detail ">
|
211
|
+
|
212
|
+
<div class="method-heading">
|
213
|
+
<span class="method-name">name</span><span
|
214
|
+
class="method-args">(username)</span>
|
215
|
+
<span class="method-click-advice">click to toggle source</span>
|
216
|
+
</div>
|
217
|
+
|
218
|
+
|
219
|
+
<div class="method-description">
|
220
|
+
|
221
|
+
<p>Get the name of the user.</p>
|
222
|
+
<dl class="rdoc-list note-list"><dt>username
|
223
|
+
<dd>
|
224
|
+
<p>github username.</p>
|
225
|
+
</dd></dl>
|
226
|
+
|
227
|
+
<p>Returns a String.</p>
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
<div class="method-source-code" id="name-source">
|
232
|
+
<pre><span class="ruby-comment"># File lib/contributions/github_api.rb, line 21</span>
|
233
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">name</span>(<span class="ruby-identifier">username</span>)
|
234
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">user</span>(<span class="ruby-identifier">username</span>)[<span class="ruby-string">"name"</span>]
|
235
|
+
<span class="ruby-keyword">end</span></pre>
|
236
|
+
</div><!-- name-source -->
|
237
|
+
|
238
|
+
</div>
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
</div><!-- name-method -->
|
244
|
+
|
245
|
+
|
246
|
+
<div id="method-c-parent" class="method-detail ">
|
247
|
+
|
248
|
+
<div class="method-heading">
|
249
|
+
<span class="method-name">parent</span><span
|
250
|
+
class="method-args">(repository)</span>
|
251
|
+
<span class="method-click-advice">click to toggle source</span>
|
252
|
+
</div>
|
253
|
+
|
254
|
+
|
255
|
+
<div class="method-description">
|
256
|
+
|
257
|
+
<p>Get the name of the forked repository.</p>
|
258
|
+
<dl class="rdoc-list note-list"><dt>repository
|
259
|
+
<dd>
|
260
|
+
<p>a ‘username/repository_name’ string.</p>
|
261
|
+
</dd></dl>
|
262
|
+
|
263
|
+
<p>Returns a String.</p>
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
<div class="method-source-code" id="parent-source">
|
268
|
+
<pre><span class="ruby-comment"># File lib/contributions/github_api.rb, line 30</span>
|
269
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">parent</span>(<span class="ruby-identifier">repository</span>)
|
270
|
+
<span class="ruby-identifier">username</span>, <span class="ruby-identifier">repo_name</span> = <span class="ruby-identifier">repository</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">'/'</span>)
|
271
|
+
<span class="ruby-identifier">repo_info</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">repository</span>(<span class="ruby-identifier">repository</span>)
|
272
|
+
<span class="ruby-identifier">repo_info</span>[<span class="ruby-string">"parent"</span>][<span class="ruby-string">"owner"</span>][<span class="ruby-string">"login"</span>] <span class="ruby-operator">+</span> <span class="ruby-string">'/'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">repo_name</span>
|
273
|
+
<span class="ruby-keyword">end</span></pre>
|
274
|
+
</div><!-- parent-source -->
|
275
|
+
|
276
|
+
</div>
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
</div><!-- parent-method -->
|
282
|
+
|
283
|
+
|
284
|
+
<div id="method-c-repos" class="method-detail ">
|
285
|
+
|
286
|
+
<div class="method-heading">
|
287
|
+
<span class="method-name">repos</span><span
|
288
|
+
class="method-args">(username)</span>
|
289
|
+
<span class="method-click-advice">click to toggle source</span>
|
290
|
+
</div>
|
291
|
+
|
292
|
+
|
293
|
+
<div class="method-description">
|
294
|
+
|
295
|
+
<p>Get all the user’s repositories.</p>
|
296
|
+
|
297
|
+
<p>Returns an Array.</p>
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
<div class="method-source-code" id="repos-source">
|
302
|
+
<pre><span class="ruby-comment"># File lib/contributions/github_api.rb, line 39</span>
|
303
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">repos</span>(<span class="ruby-identifier">username</span>)
|
304
|
+
<span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">open</span>(<span class="ruby-node">"https://api.github.com/users/#{username}/repos?per_page=100"</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">read</span> } )
|
305
|
+
<span class="ruby-keyword">end</span></pre>
|
306
|
+
</div><!-- repos-source -->
|
307
|
+
|
308
|
+
</div>
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
</div><!-- repos-method -->
|
314
|
+
|
315
|
+
|
316
|
+
</section><!-- public-class-method-details -->
|
317
|
+
|
318
|
+
</section><!-- Public -->
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
<section id="Internal" class="documentation-section">
|
323
|
+
|
324
|
+
<div class="documentation-section-title">
|
325
|
+
<h2 class="section-header">
|
326
|
+
Internal
|
327
|
+
</h2>
|
328
|
+
<span class="section-click-top">
|
329
|
+
<a href="#top">↑ top</a>
|
330
|
+
</span>
|
331
|
+
</div>
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
<!-- Methods -->
|
341
|
+
|
342
|
+
<section id="public-class-Internal-method-details" class="method-section section">
|
343
|
+
<h3 class="section-header">Public Class Methods</h3>
|
344
|
+
|
345
|
+
|
346
|
+
<div id="method-c-repository" class="method-detail ">
|
347
|
+
|
348
|
+
<div class="method-heading">
|
349
|
+
<span class="method-name">repository</span><span
|
350
|
+
class="method-args">(repository)</span>
|
351
|
+
<span class="method-click-advice">click to toggle source</span>
|
352
|
+
</div>
|
353
|
+
|
354
|
+
|
355
|
+
<div class="method-description">
|
356
|
+
|
357
|
+
<p>Get the repository info (all of it) from github.</p>
|
358
|
+
<dl class="rdoc-list note-list"><dt>repository
|
359
|
+
<dd>
|
360
|
+
<p>a ‘username/repository_name’ string.</p>
|
361
|
+
</dd></dl>
|
362
|
+
|
363
|
+
<p>Returns a Hash.</p>
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
<div class="method-source-code" id="repository-source">
|
368
|
+
<pre><span class="ruby-comment"># File lib/contributions/github_api.rb, line 57</span>
|
369
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">repository</span>(<span class="ruby-identifier">repository</span>)
|
370
|
+
<span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">open</span>(<span class="ruby-node">"https://api.github.com/repos/#{repository}"</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">read</span> } )
|
371
|
+
<span class="ruby-keyword">end</span></pre>
|
372
|
+
</div><!-- repository-source -->
|
373
|
+
|
374
|
+
</div>
|
375
|
+
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
</div><!-- repository-method -->
|
380
|
+
|
381
|
+
|
382
|
+
<div id="method-c-user" class="method-detail ">
|
383
|
+
|
384
|
+
<div class="method-heading">
|
385
|
+
<span class="method-name">user</span><span
|
386
|
+
class="method-args">(username)</span>
|
387
|
+
<span class="method-click-advice">click to toggle source</span>
|
388
|
+
</div>
|
389
|
+
|
390
|
+
|
391
|
+
<div class="method-description">
|
392
|
+
|
393
|
+
<p>Get the user info (all of it) from github.</p>
|
394
|
+
<dl class="rdoc-list note-list"><dt>username
|
395
|
+
<dd>
|
396
|
+
<p>github username.</p>
|
397
|
+
</dd></dl>
|
398
|
+
|
399
|
+
<p>Returns a Hash.</p>
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
<div class="method-source-code" id="user-source">
|
404
|
+
<pre><span class="ruby-comment"># File lib/contributions/github_api.rb, line 48</span>
|
405
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">user</span>(<span class="ruby-identifier">username</span>)
|
406
|
+
<span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">open</span>(<span class="ruby-node">"https://api.github.com/users/#{username}"</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">read</span> } )
|
407
|
+
<span class="ruby-keyword">end</span></pre>
|
408
|
+
</div><!-- user-source -->
|
409
|
+
|
410
|
+
</div>
|
411
|
+
|
412
|
+
|
413
|
+
|
414
|
+
|
415
|
+
</div><!-- user-method -->
|
416
|
+
|
417
|
+
|
418
|
+
</section><!-- public-class-method-details -->
|
419
|
+
|
420
|
+
</section><!-- Internal -->
|
421
|
+
|
422
|
+
</div><!-- documentation -->
|
423
|
+
|
424
|
+
|
425
|
+
<footer id="validator-badges">
|
426
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
427
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
|
428
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
429
|
+
</footer>
|
430
|
+
|