churn 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. checksums.yaml +5 -5
  2. data/{LICENSE → LICENSE.txt} +0 -0
  3. data/README.md +137 -120
  4. data/bin/churn +27 -12
  5. data/churn.gemspec +7 -21
  6. data/lib/churn/calculator.rb +24 -11
  7. data/lib/churn/history.rb +1 -1
  8. data/lib/churn/location_mapping.rb +1 -1
  9. data/lib/churn/options.rb +7 -3
  10. data/lib/churn/scm/bzr_analyzer.rb +11 -4
  11. data/lib/churn/scm/git_analyzer.rb +5 -3
  12. data/lib/churn/scm/hg_analyzer.rb +11 -4
  13. data/lib/churn/scm/source_control.rb +6 -8
  14. data/lib/churn/scm/svn_analyzer.rb +9 -3
  15. data/lib/churn/version.rb +1 -1
  16. metadata +24 -190
  17. data/.deferred_server +0 -1
  18. data/.document +0 -5
  19. data/.gitignore +0 -11
  20. data/.travis.yml +0 -6
  21. data/Gemfile +0 -3
  22. data/Gemfile.lock +0 -79
  23. data/Rakefile +0 -41
  24. data/doc/Churn.html +0 -165
  25. data/doc/Churn/BzrAnalyzer.html +0 -276
  26. data/doc/Churn/ChurnCalculator.html +0 -578
  27. data/doc/Churn/ChurnHistory.html +0 -250
  28. data/doc/Churn/ChurnOptions.html +0 -393
  29. data/doc/Churn/GitAnalyzer.html +0 -311
  30. data/doc/Churn/HgAnalyzer.html +0 -276
  31. data/doc/Churn/LocationMapping.html +0 -448
  32. data/doc/Churn/SourceControl.html +0 -451
  33. data/doc/Churn/SvnAnalyzer.html +0 -311
  34. data/doc/LICENSE.html +0 -123
  35. data/doc/Object.html +0 -246
  36. data/doc/created.rid +0 -15
  37. data/doc/images/add.png +0 -0
  38. data/doc/images/arrow_up.png +0 -0
  39. data/doc/images/brick.png +0 -0
  40. data/doc/images/brick_link.png +0 -0
  41. data/doc/images/bug.png +0 -0
  42. data/doc/images/bullet_black.png +0 -0
  43. data/doc/images/bullet_toggle_minus.png +0 -0
  44. data/doc/images/bullet_toggle_plus.png +0 -0
  45. data/doc/images/date.png +0 -0
  46. data/doc/images/delete.png +0 -0
  47. data/doc/images/find.png +0 -0
  48. data/doc/images/loadingAnimation.gif +0 -0
  49. data/doc/images/macFFBgHack.png +0 -0
  50. data/doc/images/package.png +0 -0
  51. data/doc/images/page_green.png +0 -0
  52. data/doc/images/page_white_text.png +0 -0
  53. data/doc/images/page_white_width.png +0 -0
  54. data/doc/images/plugin.png +0 -0
  55. data/doc/images/ruby.png +0 -0
  56. data/doc/images/tag_blue.png +0 -0
  57. data/doc/images/tag_green.png +0 -0
  58. data/doc/images/transparent.png +0 -0
  59. data/doc/images/wrench.png +0 -0
  60. data/doc/images/wrench_orange.png +0 -0
  61. data/doc/images/zoom.png +0 -0
  62. data/doc/index.html +0 -100
  63. data/doc/js/darkfish.js +0 -155
  64. data/doc/js/jquery.js +0 -18
  65. data/doc/js/navigation.js +0 -142
  66. data/doc/js/search.js +0 -94
  67. data/doc/js/search_index.js +0 -1
  68. data/doc/js/searcher.js +0 -228
  69. data/doc/rdoc.css +0 -595
  70. data/doc/table_of_contents.html +0 -167
  71. data/test/data/churn_calculator.rb +0 -217
  72. data/test/data/test_helper.rb +0 -14
  73. data/test/test_helper.rb +0 -21
  74. data/test/unit/bzr_analyzer_test.rb +0 -65
  75. data/test/unit/churn_calculator_test.rb +0 -181
  76. data/test/unit/churn_history_test.rb +0 -24
  77. data/test/unit/churn_options_test.rb +0 -16
  78. data/test/unit/git_analyzer_test.rb +0 -88
  79. data/test/unit/hg_analyzer_test.rb +0 -66
  80. data/test/unit/location_mapping_test.rb +0 -35
  81. data/test/unit/source_control_test.rb +0 -22
  82. data/test/unit/svn_analyzer_test.rb +0 -65
@@ -1,448 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
-
7
- <title>class Churn::LocationMapping - 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
-
47
-
48
- <div id="file-metadata">
49
- <nav id="file-list-section" class="section">
50
- <h3 class="section-header">Defined In</h3>
51
- <ul>
52
- <li>lib/churn/location_mapping.rb
53
- </ul>
54
- </nav>
55
-
56
-
57
- </div>
58
-
59
- <div id="class-metadata">
60
-
61
- <nav id="parent-class-section" class="section">
62
- <h3 class="section-header">Parent</h3>
63
-
64
- <p class="link">SexpProcessor
65
-
66
- </nav>
67
-
68
-
69
-
70
- <!-- Method Quickref -->
71
- <nav id="method-list-section" class="section">
72
- <h3 class="section-header">Methods</h3>
73
-
74
- <ul class="link-list">
75
-
76
- <li class="calls-super" ><a href="#method-c-new">::new</a>
77
-
78
- <li ><a href="#method-i-analyze_list">#analyze_list</a>
79
-
80
- <li ><a href="#method-i-deep_last_line">#deep_last_line</a>
81
-
82
- <li ><a href="#method-i-get_info">#get_info</a>
83
-
84
- <li ><a href="#method-i-process_class">#process_class</a>
85
-
86
- <li ><a href="#method-i-process_defn">#process_defn</a>
87
-
88
- </ul>
89
- </nav>
90
-
91
- </div>
92
-
93
- <div id="project-metadata">
94
- <nav id="fileindex-section" class="section project-section">
95
- <h3 class="section-header">Pages</h3>
96
-
97
- <ul>
98
-
99
- <li class="file"><a href="../LICENSE.html">LICENSE</a>
100
-
101
- </ul>
102
- </nav>
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="../Churn.html">Churn</a>
110
-
111
- <li><a href="../Churn/BzrAnalyzer.html">Churn::BzrAnalyzer</a>
112
-
113
- <li><a href="../Churn/ChurnCalculator.html">Churn::ChurnCalculator</a>
114
-
115
- <li><a href="../Churn/ChurnHistory.html">Churn::ChurnHistory</a>
116
-
117
- <li><a href="../Churn/ChurnOptions.html">Churn::ChurnOptions</a>
118
-
119
- <li><a href="../Churn/GitAnalyzer.html">Churn::GitAnalyzer</a>
120
-
121
- <li><a href="../Churn/HgAnalyzer.html">Churn::HgAnalyzer</a>
122
-
123
- <li><a href="../Churn/LocationMapping.html">Churn::LocationMapping</a>
124
-
125
- <li><a href="../Churn/SourceControl.html">Churn::SourceControl</a>
126
-
127
- <li><a href="../Churn/SvnAnalyzer.html">Churn::SvnAnalyzer</a>
128
-
129
- <li><a href="../Object.html">Object</a>
130
-
131
- </ul>
132
- </nav>
133
-
134
- </div>
135
- </nav>
136
-
137
- <div id="documentation">
138
- <h1 class="class">class Churn::LocationMapping</h1>
139
-
140
- <div id="description" class="description">
141
-
142
- <p>Given a ruby file, map the klass and methods to a range of line numbers The
143
- klass and method to line numbers mappings, are stored in
144
- @klasses_collection and @methods_collection this is based off <a
145
- href="https://github.com/seattlerb/ruby_parser">github.com/seattlerb/ruby_parser</a>
146
- which seems to have some known line number bugs perhaps look at and move
147
- more to the style of line numbers from metric_fu <a
148
- href="https://github.com/metricfu/metric_fu/blob/master/lib/data_structures/line_numbers.rb">github.com/metricfu/metric_fu/blob/master/lib/data_structures/line_numbers.rb</a></p>
149
-
150
- </div><!-- description -->
151
-
152
-
153
-
154
-
155
- <section id="5Buntitled-5D" class="documentation-section">
156
-
157
-
158
-
159
-
160
-
161
-
162
-
163
- <!-- Attributes -->
164
- <section id="attribute-method-details" class="method-section section">
165
- <h3 class="section-header">Attributes</h3>
166
-
167
-
168
- <div id="attribute-i-klasses_collection" class="method-detail">
169
- <div class="method-heading attribute-method-heading">
170
- <span class="method-name">klasses_collection</span><span
171
- class="attribute-access-type">[R]</span>
172
- </div>
173
-
174
- <div class="method-description">
175
-
176
-
177
-
178
- </div>
179
- </div>
180
-
181
- <div id="attribute-i-methods_collection" class="method-detail">
182
- <div class="method-heading attribute-method-heading">
183
- <span class="method-name">methods_collection</span><span
184
- class="attribute-access-type">[R]</span>
185
- </div>
186
-
187
- <div class="method-description">
188
-
189
-
190
-
191
- </div>
192
- </div>
193
-
194
- </section><!-- attribute-method-details -->
195
-
196
-
197
- <!-- Methods -->
198
-
199
- <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
200
- <h3 class="section-header">Public Class Methods</h3>
201
-
202
-
203
- <div id="method-c-new" class="method-detail ">
204
-
205
- <div class="method-heading">
206
- <span class="method-name">new</span><span
207
- class="method-args">()</span>
208
-
209
- <span class="method-click-advice">click to toggle source</span>
210
-
211
- </div>
212
-
213
-
214
- <div class="method-description">
215
-
216
-
217
-
218
-
219
- <div class="method-calls-super">
220
- Calls superclass method
221
-
222
- </div>
223
-
224
-
225
-
226
- <div class="method-source-code" id="new-source">
227
- <pre><span class="ruby-comment"># File lib/churn/location_mapping.rb, line 13</span>
228
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>()
229
- <span class="ruby-keyword">super</span>
230
- <span class="ruby-ivar">@klasses_collection</span> = {}
231
- <span class="ruby-ivar">@methods_collection</span> = {}
232
- <span class="ruby-ivar">@parser</span> = <span class="ruby-constant">RubyParser</span>.<span class="ruby-identifier">new</span>
233
- <span class="ruby-keyword">self</span>.<span class="ruby-identifier">auto_shift_type</span> = <span class="ruby-keyword">true</span>
234
- <span class="ruby-keyword">self</span>.<span class="ruby-identifier">require_empty</span> = <span class="ruby-keyword">false</span>
235
- <span class="ruby-keyword">end</span></pre>
236
- </div><!-- new-source -->
237
-
238
- </div>
239
-
240
-
241
-
242
-
243
- </div><!-- new-method -->
244
-
245
-
246
- </section><!-- public-class-method-details -->
247
-
248
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
249
- <h3 class="section-header">Public Instance Methods</h3>
250
-
251
-
252
- <div id="method-i-analyze_list" class="method-detail ">
253
-
254
- <div class="method-heading">
255
- <span class="method-name">analyze_list</span><span
256
- class="method-args">(exp)</span>
257
-
258
- <span class="method-click-advice">click to toggle source</span>
259
-
260
- </div>
261
-
262
-
263
- <div class="method-description">
264
-
265
-
266
-
267
-
268
-
269
-
270
- <div class="method-source-code" id="analyze_list-source">
271
- <pre><span class="ruby-comment"># File lib/churn/location_mapping.rb, line 46</span>
272
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">analyze_list</span> <span class="ruby-identifier">exp</span>
273
- <span class="ruby-identifier">process</span> <span class="ruby-identifier">exp</span>.<span class="ruby-identifier">shift</span> <span class="ruby-keyword">until</span> <span class="ruby-identifier">exp</span>.<span class="ruby-identifier">empty?</span>
274
- <span class="ruby-identifier">exp</span>
275
- <span class="ruby-keyword">end</span></pre>
276
- </div><!-- analyze_list-source -->
277
-
278
- </div>
279
-
280
-
281
-
282
-
283
- </div><!-- analyze_list-method -->
284
-
285
-
286
- <div id="method-i-deep_last_line" class="method-detail ">
287
-
288
- <div class="method-heading">
289
- <span class="method-name">deep_last_line</span><span
290
- class="method-args">(exp)</span>
291
-
292
- <span class="method-click-advice">click to toggle source</span>
293
-
294
- </div>
295
-
296
-
297
- <div class="method-description">
298
-
299
-
300
-
301
-
302
-
303
-
304
- <div class="method-source-code" id="deep_last_line-source">
305
- <pre><span class="ruby-comment"># File lib/churn/location_mapping.rb, line 40</span>
306
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">deep_last_line</span>(<span class="ruby-identifier">exp</span>)
307
- <span class="ruby-identifier">lines</span> = []
308
- <span class="ruby-identifier">exp</span>.<span class="ruby-identifier">deep_each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">lines</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">line</span> }
309
- <span class="ruby-identifier">lines</span>.<span class="ruby-identifier">max</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
310
- <span class="ruby-keyword">end</span></pre>
311
- </div><!-- deep_last_line-source -->
312
-
313
- </div>
314
-
315
-
316
-
317
-
318
- </div><!-- deep_last_line-method -->
319
-
320
-
321
- <div id="method-i-get_info" class="method-detail ">
322
-
323
- <div class="method-heading">
324
- <span class="method-name">get_info</span><span
325
- class="method-args">(file)</span>
326
-
327
- <span class="method-click-advice">click to toggle source</span>
328
-
329
- </div>
330
-
331
-
332
- <div class="method-description">
333
-
334
-
335
-
336
-
337
-
338
-
339
- <div class="method-source-code" id="get_info-source">
340
- <pre><span class="ruby-comment"># File lib/churn/location_mapping.rb, line 22</span>
341
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">get_info</span>(<span class="ruby-identifier">file</span>)
342
- <span class="ruby-identifier">ast</span> = <span class="ruby-ivar">@parser</span>.<span class="ruby-identifier">process</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">file</span>), <span class="ruby-identifier">file</span>)
343
- <span class="ruby-identifier">process</span> <span class="ruby-identifier">ast</span>
344
- <span class="ruby-keyword">end</span></pre>
345
- </div><!-- get_info-source -->
346
-
347
- </div>
348
-
349
-
350
-
351
-
352
- </div><!-- get_info-method -->
353
-
354
-
355
- <div id="method-i-process_class" class="method-detail ">
356
-
357
- <div class="method-heading">
358
- <span class="method-name">process_class</span><span
359
- class="method-args">(exp)</span>
360
-
361
- <span class="method-click-advice">click to toggle source</span>
362
-
363
- </div>
364
-
365
-
366
- <div class="method-description">
367
-
368
-
369
-
370
-
371
-
372
-
373
- <div class="method-source-code" id="process_class-source">
374
- <pre><span class="ruby-comment"># File lib/churn/location_mapping.rb, line 27</span>
375
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">process_class</span>(<span class="ruby-identifier">exp</span>)
376
- <span class="ruby-identifier">name</span> = <span class="ruby-identifier">exp</span>.<span class="ruby-identifier">shift</span>
377
- <span class="ruby-identifier">start_line</span> = <span class="ruby-identifier">exp</span>.<span class="ruby-identifier">line</span>
378
- <span class="ruby-identifier">last_line</span> = <span class="ruby-identifier">deep_last_line</span>(<span class="ruby-identifier">exp</span>)
379
- <span class="ruby-identifier">name</span> = <span class="ruby-identifier">name</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Symbol</span>)
380
- <span class="ruby-identifier">name</span> = <span class="ruby-identifier">name</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">value</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Sexp</span>) <span class="ruby-comment">#deals with cases like class Test::Unit::TestCase</span>
381
- <span class="ruby-ivar">@current_class</span> = <span class="ruby-identifier">name</span>
382
- <span class="ruby-ivar">@klasses_collection</span>[<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>] = [] <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@klasses_collection</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">name</span>)
383
- <span class="ruby-ivar">@klasses_collection</span>[<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>] <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-identifier">start_line</span><span class="ruby-operator">..</span><span class="ruby-identifier">last_line</span>)
384
- <span class="ruby-identifier">analyze_list</span> <span class="ruby-identifier">exp</span>
385
- <span class="ruby-identifier">s</span>()
386
- <span class="ruby-keyword">end</span></pre>
387
- </div><!-- process_class-source -->
388
-
389
- </div>
390
-
391
-
392
-
393
-
394
- </div><!-- process_class-method -->
395
-
396
-
397
- <div id="method-i-process_defn" class="method-detail ">
398
-
399
- <div class="method-heading">
400
- <span class="method-name">process_defn</span><span
401
- class="method-args">(exp)</span>
402
-
403
- <span class="method-click-advice">click to toggle source</span>
404
-
405
- </div>
406
-
407
-
408
- <div class="method-description">
409
-
410
-
411
-
412
-
413
-
414
-
415
- <div class="method-source-code" id="process_defn-source">
416
- <pre><span class="ruby-comment"># File lib/churn/location_mapping.rb, line 51</span>
417
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">process_defn</span>(<span class="ruby-identifier">exp</span>)
418
- <span class="ruby-identifier">name</span> = <span class="ruby-identifier">exp</span>.<span class="ruby-identifier">shift</span>
419
- <span class="ruby-identifier">start_line</span> = <span class="ruby-identifier">exp</span>.<span class="ruby-identifier">line</span>
420
- <span class="ruby-identifier">last_line</span> = <span class="ruby-identifier">deep_last_line</span>(<span class="ruby-identifier">exp</span>)
421
- <span class="ruby-identifier">full_name</span> = <span class="ruby-node">&quot;#{@current_class}##{name}&quot;</span>
422
- <span class="ruby-ivar">@methods_collection</span>[<span class="ruby-identifier">full_name</span>] = [] <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@methods_collection</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">full_name</span>)
423
- <span class="ruby-ivar">@methods_collection</span>[<span class="ruby-identifier">full_name</span>] <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-identifier">start_line</span><span class="ruby-operator">..</span><span class="ruby-identifier">last_line</span>)
424
- <span class="ruby-keyword">return</span> <span class="ruby-identifier">s</span>(<span class="ruby-value">:defn</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">process</span>(<span class="ruby-identifier">exp</span>.<span class="ruby-identifier">shift</span>), <span class="ruby-identifier">process</span>(<span class="ruby-identifier">exp</span>.<span class="ruby-identifier">shift</span>))
425
- <span class="ruby-keyword">end</span></pre>
426
- </div><!-- process_defn-source -->
427
-
428
- </div>
429
-
430
-
431
-
432
-
433
- </div><!-- process_defn-method -->
434
-
435
-
436
- </section><!-- public-instance-method-details -->
437
-
438
- </section><!-- 5Buntitled-5D -->
439
-
440
- </div><!-- documentation -->
441
-
442
-
443
- <footer id="validator-badges">
444
- <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
445
- <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.1.
446
- <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
447
- </footer>
448
-
@@ -1,451 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
-
7
- <title>class Churn::SourceControl - 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
-
47
-
48
- <div id="file-metadata">
49
- <nav id="file-list-section" class="section">
50
- <h3 class="section-header">Defined In</h3>
51
- <ul>
52
- <li>lib/churn/scm/source_control.rb
53
- </ul>
54
- </nav>
55
-
56
-
57
- </div>
58
-
59
- <div id="class-metadata">
60
-
61
- <nav id="parent-class-section" class="section">
62
- <h3 class="section-header">Parent</h3>
63
-
64
- <p class="link"><a href="../Object.html">Object</a>
65
-
66
- </nav>
67
-
68
-
69
-
70
- <!-- Method Quickref -->
71
- <nav id="method-list-section" class="section">
72
- <h3 class="section-header">Methods</h3>
73
-
74
- <ul class="link-list">
75
-
76
- <li ><a href="#method-c-new">::new</a>
77
-
78
- <li ><a href="#method-c-set_source_control">::set_source_control</a>
79
-
80
- <li ><a href="#method-c-supported-3F">::supported?</a>
81
-
82
- <li ><a href="#method-i-get_logs">#get_logs</a>
83
-
84
- <li ><a href="#method-i-get_revisions">#get_revisions</a>
85
-
86
- <li ><a href="#method-i-get_updated_files_change_info">#get_updated_files_change_info</a>
87
-
88
- <li ><a href="#method-i-get_updated_files_from_log">#get_updated_files_from_log</a>
89
-
90
- </ul>
91
- </nav>
92
-
93
- </div>
94
-
95
- <div id="project-metadata">
96
- <nav id="fileindex-section" class="section project-section">
97
- <h3 class="section-header">Pages</h3>
98
-
99
- <ul>
100
-
101
- <li class="file"><a href="../LICENSE.html">LICENSE</a>
102
-
103
- </ul>
104
- </nav>
105
-
106
- <nav id="classindex-section" class="section project-section">
107
- <h3 class="section-header">Class and Module Index</h3>
108
-
109
- <ul class="link-list">
110
-
111
- <li><a href="../Churn.html">Churn</a>
112
-
113
- <li><a href="../Churn/BzrAnalyzer.html">Churn::BzrAnalyzer</a>
114
-
115
- <li><a href="../Churn/ChurnCalculator.html">Churn::ChurnCalculator</a>
116
-
117
- <li><a href="../Churn/ChurnHistory.html">Churn::ChurnHistory</a>
118
-
119
- <li><a href="../Churn/ChurnOptions.html">Churn::ChurnOptions</a>
120
-
121
- <li><a href="../Churn/GitAnalyzer.html">Churn::GitAnalyzer</a>
122
-
123
- <li><a href="../Churn/HgAnalyzer.html">Churn::HgAnalyzer</a>
124
-
125
- <li><a href="../Churn/LocationMapping.html">Churn::LocationMapping</a>
126
-
127
- <li><a href="../Churn/SourceControl.html">Churn::SourceControl</a>
128
-
129
- <li><a href="../Churn/SvnAnalyzer.html">Churn::SvnAnalyzer</a>
130
-
131
- <li><a href="../Object.html">Object</a>
132
-
133
- </ul>
134
- </nav>
135
-
136
- </div>
137
- </nav>
138
-
139
- <div id="documentation">
140
- <h1 class="class">class Churn::SourceControl</h1>
141
-
142
- <div id="description" class="description">
143
-
144
- <p>Base clase for analyzing various SCM systems like git, HG, and SVN</p>
145
-
146
- </div><!-- description -->
147
-
148
-
149
-
150
-
151
- <section id="5Buntitled-5D" class="documentation-section">
152
-
153
-
154
-
155
-
156
-
157
-
158
-
159
-
160
- <!-- Methods -->
161
-
162
- <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
163
- <h3 class="section-header">Public Class Methods</h3>
164
-
165
-
166
- <div id="method-c-new" class="method-detail ">
167
-
168
- <div class="method-heading">
169
- <span class="method-name">new</span><span
170
- class="method-args">(start_date=nil)</span>
171
-
172
- <span class="method-click-advice">click to toggle source</span>
173
-
174
- </div>
175
-
176
-
177
- <div class="method-description">
178
-
179
-
180
-
181
-
182
-
183
-
184
- <div class="method-source-code" id="new-source">
185
- <pre><span class="ruby-comment"># File lib/churn/scm/source_control.rb, line 24</span>
186
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">start_date</span>=<span class="ruby-keyword">nil</span>)
187
- <span class="ruby-ivar">@start_date</span> = <span class="ruby-identifier">start_date</span>
188
- <span class="ruby-keyword">end</span></pre>
189
- </div><!-- new-source -->
190
-
191
- </div>
192
-
193
-
194
-
195
-
196
- </div><!-- new-method -->
197
-
198
-
199
- <div id="method-c-set_source_control" class="method-detail ">
200
-
201
- <div class="method-heading">
202
- <span class="method-name">set_source_control</span><span
203
- class="method-args">(start_date)</span>
204
-
205
- <span class="method-click-advice">click to toggle source</span>
206
-
207
- </div>
208
-
209
-
210
- <div class="method-description">
211
-
212
-
213
-
214
-
215
-
216
-
217
- <div class="method-source-code" id="set_source_control-source">
218
- <pre><span class="ruby-comment"># File lib/churn/scm/source_control.rb, line 6</span>
219
- <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">set_source_control</span>(<span class="ruby-identifier">start_date</span>)
220
- <span class="ruby-keyword">if</span> <span class="ruby-constant">GitAnalyzer</span>.<span class="ruby-identifier">supported?</span>
221
- <span class="ruby-constant">GitAnalyzer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">start_date</span>)
222
- <span class="ruby-keyword">elsif</span> <span class="ruby-constant">HgAnalyzer</span>.<span class="ruby-identifier">supported?</span>
223
- <span class="ruby-constant">HgAnalyzer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">start_date</span>)
224
- <span class="ruby-keyword">elsif</span> <span class="ruby-constant">BzrAnalyzer</span>.<span class="ruby-identifier">supported?</span>
225
- <span class="ruby-constant">BzrAnalyzer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">start_date</span>)
226
- <span class="ruby-keyword">elsif</span> <span class="ruby-constant">SvnAnalyzer</span>.<span class="ruby-identifier">supported?</span>
227
- <span class="ruby-constant">SvnAnalyzer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">start_date</span>)
228
- <span class="ruby-keyword">else</span>
229
- <span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;Churn requires a bazaar, git, mercurial, or subversion source control&quot;</span>
230
- <span class="ruby-keyword">end</span>
231
- <span class="ruby-keyword">end</span></pre>
232
- </div><!-- set_source_control-source -->
233
-
234
- </div>
235
-
236
-
237
-
238
-
239
- </div><!-- set_source_control-method -->
240
-
241
-
242
- <div id="method-c-supported-3F" class="method-detail ">
243
-
244
- <div class="method-heading">
245
- <span class="method-name">supported?</span><span
246
- class="method-args">()</span>
247
-
248
- <span class="method-click-advice">click to toggle source</span>
249
-
250
- </div>
251
-
252
-
253
- <div class="method-description">
254
-
255
-
256
-
257
-
258
-
259
-
260
- <div class="method-source-code" id="supported-3F-source">
261
- <pre><span class="ruby-comment"># File lib/churn/scm/source_control.rb, line 20</span>
262
- <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">supported?</span>
263
- <span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;child class must implement&quot;</span>
264
- <span class="ruby-keyword">end</span></pre>
265
- </div><!-- supported-3F-source -->
266
-
267
- </div>
268
-
269
-
270
-
271
-
272
- </div><!-- supported-3F-method -->
273
-
274
-
275
- </section><!-- public-class-method-details -->
276
-
277
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
278
- <h3 class="section-header">Public Instance Methods</h3>
279
-
280
-
281
- <div id="method-i-get_logs" class="method-detail ">
282
-
283
- <div class="method-heading">
284
- <span class="method-name">get_logs</span><span
285
- class="method-args">()</span>
286
-
287
- <span class="method-click-advice">click to toggle source</span>
288
-
289
- </div>
290
-
291
-
292
- <div class="method-description">
293
-
294
-
295
-
296
-
297
-
298
-
299
- <div class="method-source-code" id="get_logs-source">
300
- <pre><span class="ruby-comment"># File lib/churn/scm/source_control.rb, line 28</span>
301
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">get_logs</span>
302
- <span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;child class must implement&quot;</span>
303
- <span class="ruby-keyword">end</span></pre>
304
- </div><!-- get_logs-source -->
305
-
306
- </div>
307
-
308
-
309
-
310
-
311
- </div><!-- get_logs-method -->
312
-
313
-
314
- <div id="method-i-get_revisions" class="method-detail ">
315
-
316
- <div class="method-heading">
317
- <span class="method-name">get_revisions</span><span
318
- class="method-args">()</span>
319
-
320
- <span class="method-click-advice">click to toggle source</span>
321
-
322
- </div>
323
-
324
-
325
- <div class="method-description">
326
-
327
-
328
-
329
-
330
-
331
-
332
- <div class="method-source-code" id="get_revisions-source">
333
- <pre><span class="ruby-comment"># File lib/churn/scm/source_control.rb, line 32</span>
334
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">get_revisions</span>
335
- <span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;child class must implement&quot;</span>
336
- <span class="ruby-keyword">end</span></pre>
337
- </div><!-- get_revisions-source -->
338
-
339
- </div>
340
-
341
-
342
-
343
-
344
- </div><!-- get_revisions-method -->
345
-
346
-
347
- <div id="method-i-get_updated_files_change_info" class="method-detail ">
348
-
349
- <div class="method-heading">
350
- <span class="method-name">get_updated_files_change_info</span><span
351
- class="method-args">(revision, revisions)</span>
352
-
353
- <span class="method-click-advice">click to toggle source</span>
354
-
355
- </div>
356
-
357
-
358
- <div class="method-description">
359
-
360
-
361
-
362
-
363
-
364
-
365
- <div class="method-source-code" id="get_updated_files_change_info-source">
366
- <pre><span class="ruby-comment"># File lib/churn/scm/source_control.rb, line 36</span>
367
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">get_updated_files_change_info</span>(<span class="ruby-identifier">revision</span>, <span class="ruby-identifier">revisions</span>)
368
- <span class="ruby-identifier">updated</span> = {}
369
- <span class="ruby-identifier">logs</span> = <span class="ruby-identifier">get_updated_files_from_log</span>(<span class="ruby-identifier">revision</span>, <span class="ruby-identifier">revisions</span>)
370
- <span class="ruby-identifier">recent_file</span> = <span class="ruby-keyword">nil</span>
371
- <span class="ruby-identifier">logs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
372
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp">/^---/</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp">/^\+\+\+/</span>)
373
- <span class="ruby-comment"># Remove the --- a/ and +++ b/ if present</span>
374
- <span class="ruby-identifier">recent_file</span> = <span class="ruby-identifier">get_recent_file</span>(<span class="ruby-identifier">line</span>)
375
- <span class="ruby-identifier">updated</span>[<span class="ruby-identifier">recent_file</span>] = [] <span class="ruby-keyword">unless</span> <span class="ruby-identifier">updated</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">recent_file</span>)
376
- <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp">/^@@/</span>)
377
- <span class="ruby-comment"># Now add the added/removed ranges for the line</span>
378
- <span class="ruby-identifier">removed_range</span> = <span class="ruby-identifier">get_changed_range</span>(<span class="ruby-identifier">line</span>, <span class="ruby-string">'-'</span>)
379
- <span class="ruby-identifier">added_range</span> = <span class="ruby-identifier">get_changed_range</span>(<span class="ruby-identifier">line</span>, <span class="ruby-string">'\+'</span>)
380
- <span class="ruby-identifier">updated</span>[<span class="ruby-identifier">recent_file</span>] <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">removed_range</span>
381
- <span class="ruby-identifier">updated</span>[<span class="ruby-identifier">recent_file</span>] <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">added_range</span>
382
- <span class="ruby-keyword">else</span>
383
- <span class="ruby-identifier">puts</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp">/^---/</span>)
384
- <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;diff lines that don't match the two patterns aren't expected: '#{line}'&quot;</span>
385
- <span class="ruby-keyword">end</span>
386
- <span class="ruby-keyword">end</span>
387
- <span class="ruby-identifier">updated</span>
388
- <span class="ruby-keyword">end</span></pre>
389
- </div><!-- get_updated_files_change_info-source -->
390
-
391
- </div>
392
-
393
-
394
-
395
-
396
- </div><!-- get_updated_files_change_info-method -->
397
-
398
-
399
- <div id="method-i-get_updated_files_from_log" class="method-detail ">
400
-
401
- <div class="method-heading">
402
- <span class="method-name">get_updated_files_from_log</span><span
403
- class="method-args">(revision, revisions)</span>
404
-
405
- <span class="method-click-advice">click to toggle source</span>
406
-
407
- </div>
408
-
409
-
410
- <div class="method-description">
411
-
412
-
413
-
414
-
415
-
416
-
417
- <div class="method-source-code" id="get_updated_files_from_log-source">
418
- <pre><span class="ruby-comment"># File lib/churn/scm/source_control.rb, line 59</span>
419
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">get_updated_files_from_log</span>(<span class="ruby-identifier">revision</span>, <span class="ruby-identifier">revisions</span>)
420
- <span class="ruby-identifier">current_index</span> = <span class="ruby-identifier">revisions</span>.<span class="ruby-identifier">index</span>(<span class="ruby-identifier">revision</span>)
421
- <span class="ruby-identifier">previous_index</span> = <span class="ruby-identifier">current_index</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>
422
- <span class="ruby-identifier">previous_revision</span> = <span class="ruby-identifier">revisions</span>[<span class="ruby-identifier">previous_index</span>] <span class="ruby-keyword">unless</span> <span class="ruby-identifier">revisions</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">previous_index</span>
423
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">revision</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">previous_revision</span>
424
- <span class="ruby-identifier">get_diff</span>(<span class="ruby-identifier">revision</span>, <span class="ruby-identifier">previous_revision</span>)
425
- <span class="ruby-keyword">else</span>
426
- []
427
- <span class="ruby-keyword">end</span>
428
- <span class="ruby-keyword">end</span></pre>
429
- </div><!-- get_updated_files_from_log-source -->
430
-
431
- </div>
432
-
433
-
434
-
435
-
436
- </div><!-- get_updated_files_from_log-method -->
437
-
438
-
439
- </section><!-- public-instance-method-details -->
440
-
441
- </section><!-- 5Buntitled-5D -->
442
-
443
- </div><!-- documentation -->
444
-
445
-
446
- <footer id="validator-badges">
447
- <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
448
- <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.1.
449
- <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
450
- </footer>
451
-