churn 1.0.2 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
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,578 +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::ChurnCalculator - 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/calculator.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-to_s">::to_s</a>
79
-
80
- <li ><a href="#method-i-analyze">#analyze</a>
81
-
82
- <li ><a href="#method-i-emit">#emit</a>
83
-
84
- <li ><a href="#method-i-generate_history">#generate_history</a>
85
-
86
- <li ><a href="#method-i-remote_report">#remote_report</a>
87
-
88
- <li ><a href="#method-i-report">#report</a>
89
-
90
- <li ><a href="#method-i-to_h">#to_h</a>
91
-
92
- <li ><a href="#method-i-to_s">#to_s</a>
93
-
94
- </ul>
95
- </nav>
96
-
97
- </div>
98
-
99
- <div id="project-metadata">
100
- <nav id="fileindex-section" class="section project-section">
101
- <h3 class="section-header">Pages</h3>
102
-
103
- <ul>
104
-
105
- <li class="file"><a href="../LICENSE.html">LICENSE</a>
106
-
107
- </ul>
108
- </nav>
109
-
110
- <nav id="classindex-section" class="section project-section">
111
- <h3 class="section-header">Class and Module Index</h3>
112
-
113
- <ul class="link-list">
114
-
115
- <li><a href="../Churn.html">Churn</a>
116
-
117
- <li><a href="../Churn/BzrAnalyzer.html">Churn::BzrAnalyzer</a>
118
-
119
- <li><a href="../Churn/ChurnCalculator.html">Churn::ChurnCalculator</a>
120
-
121
- <li><a href="../Churn/ChurnHistory.html">Churn::ChurnHistory</a>
122
-
123
- <li><a href="../Churn/ChurnOptions.html">Churn::ChurnOptions</a>
124
-
125
- <li><a href="../Churn/GitAnalyzer.html">Churn::GitAnalyzer</a>
126
-
127
- <li><a href="../Churn/HgAnalyzer.html">Churn::HgAnalyzer</a>
128
-
129
- <li><a href="../Churn/LocationMapping.html">Churn::LocationMapping</a>
130
-
131
- <li><a href="../Churn/SourceControl.html">Churn::SourceControl</a>
132
-
133
- <li><a href="../Churn/SvnAnalyzer.html">Churn::SvnAnalyzer</a>
134
-
135
- <li><a href="../Object.html">Object</a>
136
-
137
- </ul>
138
- </nav>
139
-
140
- </div>
141
- </nav>
142
-
143
- <div id="documentation">
144
- <h1 class="class">class Churn::ChurnCalculator</h1>
145
-
146
- <div id="description" class="description">
147
-
148
- <p>The work horse of the the churn library. This class takes user input,
149
- determins the SCM the user is using. It then determines changes made during
150
- this revision. Finally it reads all the changes from previous revisions and
151
- displays human readable output on the command line. It can also ouput a
152
- yaml format readable by other tools such as metric_fu and Caliper.</p>
153
-
154
- </div><!-- description -->
155
-
156
-
157
-
158
-
159
- <section id="5Buntitled-5D" class="documentation-section">
160
-
161
-
162
-
163
-
164
-
165
-
166
-
167
-
168
- <!-- Methods -->
169
-
170
- <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
171
- <h3 class="section-header">Public Class Methods</h3>
172
-
173
-
174
- <div id="method-c-new" class="method-detail ">
175
-
176
- <div class="method-heading">
177
- <span class="method-name">new</span><span
178
- class="method-args">(options={})</span>
179
-
180
- <span class="method-click-advice">click to toggle source</span>
181
-
182
- </div>
183
-
184
-
185
- <div class="method-description">
186
-
187
- <p>intialized the churn calculator object</p>
188
-
189
-
190
-
191
-
192
- <div class="method-source-code" id="new-source">
193
- <pre><span class="ruby-comment"># File lib/churn/calculator.rb, line 30</span>
194
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span>={})
195
- <span class="ruby-ivar">@churn_options</span> = <span class="ruby-constant">ChurnOptions</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">set_options</span>(<span class="ruby-identifier">options</span>)
196
-
197
- <span class="ruby-ivar">@minimum_churn_count</span> = <span class="ruby-ivar">@churn_options</span>.<span class="ruby-identifier">minimum_churn_count</span>
198
- <span class="ruby-ivar">@ignores</span> = <span class="ruby-ivar">@churn_options</span>.<span class="ruby-identifier">ignores</span>
199
- <span class="ruby-ivar">@source_control</span> = <span class="ruby-constant">SourceControl</span>.<span class="ruby-identifier">set_source_control</span>(<span class="ruby-ivar">@churn_options</span>.<span class="ruby-identifier">start_date</span>)
200
-
201
- <span class="ruby-ivar">@changes</span> = {}
202
- <span class="ruby-ivar">@revision_changes</span> = {}
203
- <span class="ruby-ivar">@class_changes</span> = {}
204
- <span class="ruby-ivar">@method_changes</span> = {}
205
- <span class="ruby-keyword">end</span></pre>
206
- </div><!-- new-source -->
207
-
208
- </div>
209
-
210
-
211
-
212
-
213
- </div><!-- new-method -->
214
-
215
-
216
- <div id="method-c-to_s" class="method-detail ">
217
-
218
- <div class="method-heading">
219
- <span class="method-name">to_s</span><span
220
- class="method-args">(hash)</span>
221
-
222
- <span class="method-click-advice">click to toggle source</span>
223
-
224
- </div>
225
-
226
-
227
- <div class="method-description">
228
-
229
- <p>Pretty print the data as a string for the user</p>
230
-
231
-
232
-
233
-
234
- <div class="method-source-code" id="to_s-source">
235
- <pre><span class="ruby-comment"># File lib/churn/calculator.rb, line 135</span>
236
- <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">to_s</span>(<span class="ruby-identifier">hash</span>)
237
- <span class="ruby-identifier">result</span> = <span class="ruby-identifier">seperator</span>
238
- <span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span><span class="ruby-string">&quot;* Revision Changes \n&quot;</span>
239
- <span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">seperator</span>
240
- <span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">display_array</span>(<span class="ruby-string">&quot;Files&quot;</span>, <span class="ruby-identifier">hash</span>[<span class="ruby-value">:changed_files</span>], <span class="ruby-value">:fields=</span><span class="ruby-operator">&gt;</span>[<span class="ruby-value">:to_str</span>], <span class="ruby-value">:headers=</span><span class="ruby-operator">&gt;</span>{<span class="ruby-value">:to_str=</span><span class="ruby-operator">&gt;</span><span class="ruby-string">'file'</span>})
241
- <span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> <span class="ruby-string">&quot;\n&quot;</span>
242
- <span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">display_array</span>(<span class="ruby-string">&quot;Classes&quot;</span>, <span class="ruby-identifier">hash</span>[<span class="ruby-value">:changed_classes</span>])
243
- <span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> <span class="ruby-string">&quot;\n&quot;</span>
244
- <span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">display_array</span>(<span class="ruby-string">&quot;Methods&quot;</span>, <span class="ruby-identifier">hash</span>[<span class="ruby-value">:changed_methods</span>]) <span class="ruby-operator">+</span> <span class="ruby-string">&quot;\n&quot;</span>
245
- <span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">seperator</span>
246
- <span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span><span class="ruby-string">&quot;* Project Churn \n&quot;</span>
247
- <span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">seperator</span>
248
- <span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> <span class="ruby-string">&quot;\n&quot;</span>
249
- <span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">display_array</span>(<span class="ruby-string">&quot;Files&quot;</span>, <span class="ruby-identifier">hash</span>[<span class="ruby-value">:changes</span>])
250
- <span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> <span class="ruby-string">&quot;\n&quot;</span>
251
- <span class="ruby-identifier">class_churn</span> = <span class="ruby-identifier">collect_items</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-value">:class_churn</span>], <span class="ruby-string">'klass'</span>)
252
- <span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">display_array</span>(<span class="ruby-string">&quot;Classes&quot;</span>, <span class="ruby-identifier">class_churn</span>)
253
- <span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> <span class="ruby-string">&quot;\n&quot;</span>
254
- <span class="ruby-identifier">method_churn</span> = <span class="ruby-identifier">collect_items</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-value">:method_churn</span>], <span class="ruby-string">'method'</span>)
255
- <span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">display_array</span>(<span class="ruby-string">&quot;Methods&quot;</span>, <span class="ruby-identifier">method_churn</span>)
256
- <span class="ruby-keyword">end</span></pre>
257
- </div><!-- to_s-source -->
258
-
259
- </div>
260
-
261
-
262
-
263
-
264
- </div><!-- to_s-method -->
265
-
266
-
267
- </section><!-- public-class-method-details -->
268
-
269
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
270
- <h3 class="section-header">Public Instance Methods</h3>
271
-
272
-
273
- <div id="method-i-analyze" class="method-detail ">
274
-
275
- <div class="method-heading">
276
- <span class="method-name">analyze</span><span
277
- class="method-args">()</span>
278
-
279
- <span class="method-click-advice">click to toggle source</span>
280
-
281
- </div>
282
-
283
-
284
- <div class="method-description">
285
-
286
- <p>Analyze the source control data, filter, sort, and find more information on
287
- the editted files</p>
288
-
289
-
290
-
291
-
292
- <div class="method-source-code" id="analyze-source">
293
- <pre><span class="ruby-comment"># File lib/churn/calculator.rb, line 99</span>
294
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">analyze</span>
295
- <span class="ruby-ivar">@changes</span> = <span class="ruby-identifier">sort_changes</span>(<span class="ruby-ivar">@changes</span>)
296
- <span class="ruby-ivar">@changes</span> = <span class="ruby-ivar">@changes</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">file_path</span>, <span class="ruby-identifier">times_changed</span><span class="ruby-operator">|</span> {<span class="ruby-value">:file_path</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">file_path</span>, <span class="ruby-value">:times_changed</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">times_changed</span> }}
297
-
298
- <span class="ruby-identifier">calculate_revision_changes</span>
299
-
300
- <span class="ruby-ivar">@method_changes</span> = <span class="ruby-identifier">sort_changes</span>(<span class="ruby-ivar">@method_changes</span>)
301
- <span class="ruby-ivar">@method_changes</span> = <span class="ruby-ivar">@method_changes</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">method</span>, <span class="ruby-identifier">times_changed</span><span class="ruby-operator">|</span> {<span class="ruby-string">'method'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">method</span>, <span class="ruby-string">'times_changed'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">times_changed</span> }}
302
- <span class="ruby-ivar">@class_changes</span> = <span class="ruby-identifier">sort_changes</span>(<span class="ruby-ivar">@class_changes</span>)
303
- <span class="ruby-ivar">@class_changes</span> = <span class="ruby-ivar">@class_changes</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">klass</span>, <span class="ruby-identifier">times_changed</span><span class="ruby-operator">|</span> {<span class="ruby-string">'klass'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">klass</span>, <span class="ruby-string">'times_changed'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">times_changed</span> }}
304
- <span class="ruby-keyword">end</span></pre>
305
- </div><!-- analyze-source -->
306
-
307
- </div>
308
-
309
-
310
-
311
-
312
- </div><!-- analyze-method -->
313
-
314
-
315
- <div id="method-i-emit" class="method-detail ">
316
-
317
- <div class="method-heading">
318
- <span class="method-name">emit</span><span
319
- class="method-args">()</span>
320
-
321
- <span class="method-click-advice">click to toggle source</span>
322
-
323
- </div>
324
-
325
-
326
- <div class="method-description">
327
-
328
- <p>Emits various data from source control to be analyses later… Currently this
329
- is broken up like this as a throwback to metric_fu</p>
330
-
331
-
332
-
333
-
334
- <div class="method-source-code" id="emit-source">
335
- <pre><span class="ruby-comment"># File lib/churn/calculator.rb, line 93</span>
336
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">emit</span>
337
- <span class="ruby-ivar">@changes</span> = <span class="ruby-identifier">parse_log_for_changes</span>.<span class="ruby-identifier">reject</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">file</span>, <span class="ruby-identifier">change_count</span><span class="ruby-operator">|</span> <span class="ruby-identifier">change_count</span> <span class="ruby-operator">&lt;</span> <span class="ruby-ivar">@minimum_churn_count</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@ignores</span>.<span class="ruby-identifier">any?</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">ignore</span><span class="ruby-operator">|</span> <span class="ruby-identifier">file</span>.<span class="ruby-identifier">match</span>(<span class="ruby-node">/#{ignore}/</span>) } }
338
- <span class="ruby-ivar">@revisions</span> = <span class="ruby-identifier">parse_log_for_revision_changes</span>
339
- <span class="ruby-keyword">end</span></pre>
340
- </div><!-- emit-source -->
341
-
342
- </div>
343
-
344
-
345
-
346
-
347
- </div><!-- emit-method -->
348
-
349
-
350
- <div id="method-i-generate_history" class="method-detail ">
351
-
352
- <div class="method-heading">
353
- <span class="method-name">generate_history</span><span
354
- class="method-args">()</span>
355
-
356
- <span class="method-click-advice">click to toggle source</span>
357
-
358
- </div>
359
-
360
-
361
- <div class="method-description">
362
-
363
- <p>this method generates the past history of a churn project from first commit
364
- to current running the report for oldest commits first so they are built up
365
- correctly</p>
366
-
367
-
368
-
369
-
370
- <div class="method-source-code" id="generate_history-source">
371
- <pre><span class="ruby-comment"># File lib/churn/calculator.rb, line 70</span>
372
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">generate_history</span>
373
- <span class="ruby-keyword">if</span> <span class="ruby-ivar">@source_control</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">GitAnalyzer</span>)
374
- <span class="ruby-keyword">begin</span>
375
- <span class="ruby-identifier">history_starting_point</span> = <span class="ruby-constant">Chronic</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-ivar">@churn_options</span>.<span class="ruby-identifier">history</span>)
376
- <span class="ruby-ivar">@source_control</span>.<span class="ruby-identifier">get_commit_history</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">commit</span><span class="ruby-operator">|</span>
377
- <span class="ruby-node">%xgit checkout #{commit}`</span>
378
- <span class="ruby-identifier">commit_date</span> = <span class="ruby-value">%xgit show -s --format=&quot;%ci&quot;`</span>
379
- <span class="ruby-identifier">commit_date</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">commit_date</span>)
380
- <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">commit_date</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">history_starting_point</span>
381
- <span class="ruby-comment">#7776000 == 3.months without adding active support depenancy</span>
382
- <span class="ruby-identifier">start_date</span> = (<span class="ruby-identifier">commit_date</span> <span class="ruby-operator">-</span> <span class="ruby-value">7776000</span>)
383
- <span class="ruby-node">%xchurn -s &quot;#{start_date}&quot;`</span>
384
- <span class="ruby-keyword">end</span>
385
- <span class="ruby-keyword">ensure</span>
386
- <span class="ruby-value">%xgit checkout master`</span>
387
- <span class="ruby-keyword">end</span>
388
- <span class="ruby-string">&quot;churn history complete, this has munipulated git please make sure you are back on HEAD where you expect to be&quot;</span>
389
- <span class="ruby-keyword">else</span>
390
- <span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;currently generate history only supports git&quot;</span>
391
- <span class="ruby-keyword">end</span>
392
- <span class="ruby-keyword">end</span></pre>
393
- </div><!-- generate_history-source -->
394
-
395
- </div>
396
-
397
-
398
-
399
-
400
- </div><!-- generate_history-method -->
401
-
402
-
403
- <div id="method-i-remote_report" class="method-detail ">
404
-
405
- <div class="method-heading">
406
- <span class="method-name">remote_report</span><span
407
- class="method-args">()</span>
408
-
409
- <span class="method-click-advice">click to toggle source</span>
410
-
411
- </div>
412
-
413
-
414
- <div class="method-description">
415
-
416
-
417
-
418
-
419
-
420
-
421
- <div class="method-source-code" id="remote_report-source">
422
- <pre><span class="ruby-comment"># File lib/churn/calculator.rb, line 58</span>
423
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">remote_report</span>
424
- <span class="ruby-keyword">if</span> <span class="ruby-ivar">@churn_options</span>.<span class="ruby-identifier">report_host</span>
425
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;posting churn results to #{@churn_options.report_host}&quot;</span>
426
- <span class="ruby-identifier">data</span> = {<span class="ruby-value">:name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@churn_options</span>.<span class="ruby-identifier">name</span>, <span class="ruby-value">:revision</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@revisions</span>.<span class="ruby-identifier">first</span>, <span class="ruby-value">:data</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">to_h</span>}.<span class="ruby-identifier">to_json</span>
427
- <span class="ruby-constant">RestClient</span>.<span class="ruby-identifier">post</span> <span class="ruby-ivar">@churn_options</span>.<span class="ruby-identifier">report_host</span>, {<span class="ruby-string">&quot;results&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">data</span>}, <span class="ruby-value">:content_type</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:json</span>, <span class="ruby-value">:accept</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:json</span>
428
- <span class="ruby-keyword">end</span>
429
- <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ECONNREFUSED</span>
430
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;error posting churn results connection refused to host: #{@churn_options.report_host}&quot;</span>
431
- <span class="ruby-keyword">end</span></pre>
432
- </div><!-- remote_report-source -->
433
-
434
- </div>
435
-
436
-
437
-
438
-
439
- </div><!-- remote_report-method -->
440
-
441
-
442
- <div id="method-i-report" class="method-detail ">
443
-
444
- <div class="method-heading">
445
- <span class="method-name">report</span><span
446
- class="method-args">(print = true)</span>
447
-
448
- <span class="method-click-advice">click to toggle source</span>
449
-
450
- </div>
451
-
452
-
453
- <div class="method-description">
454
-
455
- <p>prepares the data for the given project to be reported. reads git/svn logs
456
- analyzes the output, generates a report and either formats as a nice string
457
- or returns hash. @param [Bolean] format to return the data, true for string
458
- or false for hash @return [Object] returns either a pretty string or a hash
459
- representing the chrun of the project</p>
460
-
461
-
462
-
463
-
464
- <div class="method-source-code" id="report-source">
465
- <pre><span class="ruby-comment"># File lib/churn/calculator.rb, line 47</span>
466
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">report</span>(<span class="ruby-identifier">print</span> = <span class="ruby-keyword">true</span>)
467
- <span class="ruby-keyword">if</span> <span class="ruby-ivar">@churn_options</span>.<span class="ruby-identifier">history</span>
468
- <span class="ruby-identifier">generate_history</span>
469
- <span class="ruby-keyword">else</span>
470
- <span class="ruby-identifier">emit</span>
471
- <span class="ruby-identifier">analyze</span>
472
- <span class="ruby-identifier">remote_report</span>
473
- <span class="ruby-identifier">print</span> <span class="ruby-operator">?</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">:</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">to_h</span>
474
- <span class="ruby-keyword">end</span>
475
- <span class="ruby-keyword">end</span></pre>
476
- </div><!-- report-source -->
477
-
478
- </div>
479
-
480
-
481
-
482
-
483
- </div><!-- report-method -->
484
-
485
-
486
- <div id="method-i-to_h" class="method-detail ">
487
-
488
- <div class="method-heading">
489
- <span class="method-name">to_h</span><span
490
- class="method-args">()</span>
491
-
492
- <span class="method-click-advice">click to toggle source</span>
493
-
494
- </div>
495
-
496
-
497
- <div class="method-description">
498
-
499
- <p>collect all the data into a single hash data structure.</p>
500
-
501
-
502
-
503
-
504
- <div class="method-source-code" id="to_h-source">
505
- <pre><span class="ruby-comment"># File lib/churn/calculator.rb, line 112</span>
506
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">to_h</span>
507
- <span class="ruby-identifier">hash</span> = {<span class="ruby-value">:churn</span> =<span class="ruby-operator">&gt;</span> {<span class="ruby-value">:changes</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@changes</span>}}
508
- <span class="ruby-identifier">hash</span>[<span class="ruby-value">:churn</span>][<span class="ruby-value">:class_churn</span>] = <span class="ruby-ivar">@class_changes</span>
509
- <span class="ruby-identifier">hash</span>[<span class="ruby-value">:churn</span>][<span class="ruby-value">:method_churn</span>] = <span class="ruby-ivar">@method_changes</span>
510
- <span class="ruby-comment">#detail the most recent changes made this revision</span>
511
- <span class="ruby-identifier">first_revision</span> = <span class="ruby-ivar">@revisions</span>.<span class="ruby-identifier">first</span>
512
- <span class="ruby-identifier">first_revision_changes</span> = <span class="ruby-ivar">@revision_changes</span>[<span class="ruby-identifier">first_revision</span>]
513
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">first_revision_changes</span>
514
- <span class="ruby-identifier">changes</span> = <span class="ruby-identifier">first_revision_changes</span>
515
- <span class="ruby-identifier">hash</span>[<span class="ruby-value">:churn</span>][<span class="ruby-value">:changed_files</span>] = <span class="ruby-identifier">changes</span>[<span class="ruby-value">:files</span>]
516
- <span class="ruby-identifier">hash</span>[<span class="ruby-value">:churn</span>][<span class="ruby-value">:changed_classes</span>] = <span class="ruby-identifier">changes</span>[<span class="ruby-value">:classes</span>]
517
- <span class="ruby-identifier">hash</span>[<span class="ruby-value">:churn</span>][<span class="ruby-value">:changed_methods</span>] = <span class="ruby-identifier">changes</span>[<span class="ruby-value">:methods</span>]
518
- <span class="ruby-keyword">end</span>
519
- <span class="ruby-comment">#TODO crappy place to do this but save hash to revision file but while entirely under metric_fu only choice</span>
520
- <span class="ruby-constant">ChurnHistory</span>.<span class="ruby-identifier">store_revision_history</span>(<span class="ruby-identifier">first_revision</span>, <span class="ruby-identifier">hash</span>, <span class="ruby-ivar">@churn_options</span>.<span class="ruby-identifier">data_directory</span>)
521
- <span class="ruby-identifier">hash</span>
522
- <span class="ruby-keyword">end</span></pre>
523
- </div><!-- to_h-source -->
524
-
525
- </div>
526
-
527
-
528
-
529
-
530
- </div><!-- to_h-method -->
531
-
532
-
533
- <div id="method-i-to_s" class="method-detail ">
534
-
535
- <div class="method-heading">
536
- <span class="method-name">to_s</span><span
537
- class="method-args">()</span>
538
-
539
- <span class="method-click-advice">click to toggle source</span>
540
-
541
- </div>
542
-
543
-
544
- <div class="method-description">
545
-
546
-
547
-
548
-
549
-
550
-
551
- <div class="method-source-code" id="to_s-source">
552
- <pre><span class="ruby-comment"># File lib/churn/calculator.rb, line 130</span>
553
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
554
- <span class="ruby-constant">ChurnCalculator</span>.<span class="ruby-identifier">to_s</span>(<span class="ruby-identifier">to_h</span>[<span class="ruby-value">:churn</span>])
555
- <span class="ruby-keyword">end</span></pre>
556
- </div><!-- to_s-source -->
557
-
558
- </div>
559
-
560
-
561
-
562
-
563
- </div><!-- to_s-method -->
564
-
565
-
566
- </section><!-- public-instance-method-details -->
567
-
568
- </section><!-- 5Buntitled-5D -->
569
-
570
- </div><!-- documentation -->
571
-
572
-
573
- <footer id="validator-badges">
574
- <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
575
- <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.1.
576
- <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
577
- </footer>
578
-