knife-github 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. data/.gitignore +1 -0
  2. data/.yardopts +1 -0
  3. data/LICENSE +201 -201
  4. data/Rakefile +5 -0
  5. data/doc/Chef.html +132 -0
  6. data/doc/Chef/Knife.html +138 -0
  7. data/doc/Chef/Knife/GithubBase.html +784 -0
  8. data/doc/Chef/Knife/GithubBaseList.html +316 -0
  9. data/doc/Chef/Knife/GithubClone.html +341 -0
  10. data/doc/Chef/Knife/GithubCompare.html +299 -0
  11. data/doc/Chef/Knife/GithubDeploy.html +1449 -0
  12. data/doc/Chef/Knife/GithubDiff.html +473 -0
  13. data/doc/Chef/Knife/GithubList.html +299 -0
  14. data/doc/KnifeGithubCleanup.html +115 -0
  15. data/doc/KnifeGithubCleanup/GithubCleanup.html +425 -0
  16. data/doc/KnifeGithubSearch.html +115 -0
  17. data/doc/KnifeGithubSearch/GithubSearch.html +325 -0
  18. data/doc/_index.html +206 -0
  19. data/doc/class_list.html +54 -0
  20. data/doc/css/common.css +1 -0
  21. data/doc/css/full_list.css +57 -0
  22. data/doc/css/style.css +338 -0
  23. data/doc/file.README.html +118 -0
  24. data/doc/file_list.html +56 -0
  25. data/doc/frames.html +26 -0
  26. data/doc/index.html +118 -0
  27. data/doc/js/app.js +214 -0
  28. data/doc/js/full_list.js +178 -0
  29. data/doc/js/jquery.js +4 -0
  30. data/doc/method_list.html +197 -0
  31. data/doc/top-level-namespace.html +114 -0
  32. data/lib/chef/knife/github_base.rb +4 -4
  33. data/lib/chef/knife/github_baselist.rb +6 -3
  34. data/lib/chef/knife/github_cleanup.rb +1 -1
  35. data/lib/chef/knife/{github_download.rb → github_clone.rb} +8 -8
  36. data/lib/chef/knife/github_compare.rb +3 -4
  37. data/lib/chef/knife/github_deploy.rb +89 -67
  38. data/lib/chef/knife/github_diff.rb +50 -20
  39. data/lib/chef/knife/github_list.rb +1 -1
  40. data/lib/knife-github/version.rb +1 -1
  41. metadata +32 -3
@@ -0,0 +1,138 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Class: Chef::Knife
8
+
9
+ &mdash; Knife Github utilities
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '../';
20
+ framesUrl = "../frames.html#!" + escape(window.location.href);
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="../_index.html">Index (K)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../Chef.html" title="Chef (class)">Chef</a></span></span>
36
+ &raquo;
37
+ <span class="title">Knife</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="../class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="../method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="../file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Class: Chef::Knife
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+ <dt class="r1">Inherits:</dt>
75
+ <dd class="r1">
76
+ <span class="inheritName">Object</span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next">Chef::Knife</li>
82
+
83
+ </ul>
84
+ <a href="#" class="inheritanceTree">show all</a>
85
+
86
+ </dd>
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+ <dt class="r2 last">Defined in:</dt>
97
+ <dd class="r2 last">lib/chef/knife/github_list.rb<span class="defines">,<br />
98
+ lib/chef/knife/github_base.rb,<br /> lib/chef/knife/github_diff.rb,<br /> lib/chef/knife/github_clone.rb,<br /> lib/chef/knife/github_deploy.rb,<br /> lib/chef/knife/github_compare.rb,<br /> lib/chef/knife/github_baselist.rb</span>
99
+ </dd>
100
+
101
+ </dl>
102
+ <div class="clear"></div>
103
+
104
+ <div id="subclasses">
105
+ <h2>Direct Known Subclasses</h2>
106
+ <p class="children"><span class='object_link'><a href="Knife/GithubClone.html" title="Chef::Knife::GithubClone (class)">GithubClone</a></span>, <span class='object_link'><a href="Knife/GithubCompare.html" title="Chef::Knife::GithubCompare (class)">GithubCompare</a></span>, <span class='object_link'><a href="Knife/GithubDeploy.html" title="Chef::Knife::GithubDeploy (class)">GithubDeploy</a></span>, <span class='object_link'><a href="Knife/GithubDiff.html" title="Chef::Knife::GithubDiff (class)">GithubDiff</a></span>, <span class='object_link'><a href="Knife/GithubList.html" title="Chef::Knife::GithubList (class)">GithubList</a></span>, <span class='object_link'><a href="../KnifeGithubCleanup/GithubCleanup.html" title="KnifeGithubCleanup::GithubCleanup (class)">KnifeGithubCleanup::GithubCleanup</a></span>, <span class='object_link'><a href="../KnifeGithubSearch/GithubSearch.html" title="KnifeGithubSearch::GithubSearch (class)">KnifeGithubSearch::GithubSearch</a></span></p>
107
+ </div>
108
+ <h2>Defined Under Namespace</h2>
109
+ <p class="children">
110
+
111
+
112
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Knife/GithubBase.html" title="Chef::Knife::GithubBase (module)">GithubBase</a></span>, <span class='object_link'><a href="Knife/GithubBaseList.html" title="Chef::Knife::GithubBaseList (module)">GithubBaseList</a></span>
113
+
114
+
115
+
116
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Knife/GithubClone.html" title="Chef::Knife::GithubClone (class)">GithubClone</a></span>, <span class='object_link'><a href="Knife/GithubCompare.html" title="Chef::Knife::GithubCompare (class)">GithubCompare</a></span>, <span class='object_link'><a href="Knife/GithubDeploy.html" title="Chef::Knife::GithubDeploy (class)">GithubDeploy</a></span>, <span class='object_link'><a href="Knife/GithubDiff.html" title="Chef::Knife::GithubDiff (class)">GithubDiff</a></span>, <span class='object_link'><a href="Knife/GithubList.html" title="Chef::Knife::GithubList (class)">GithubList</a></span>
117
+
118
+
119
+ </p>
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+ </div>
130
+
131
+ <div id="footer">
132
+ Generated on Wed Oct 30 20:03:34 2013 by
133
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
134
+ 0.8.7.2 (ruby-1.9.3).
135
+ </div>
136
+
137
+ </body>
138
+ </html>
@@ -0,0 +1,784 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Module: Chef::Knife::GithubBase
8
+
9
+ &mdash; Knife Github utilities
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '../../';
20
+ framesUrl = "../../frames.html#!" + escape(window.location.href);
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="../../_index.html">Index (G)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../../Chef.html" title="Chef (class)">Chef</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Knife.html" title="Chef::Knife (class)">Knife</a></span></span>
36
+ &raquo;
37
+ <span class="title">GithubBase</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="../../class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="../../method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="../../file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Module: Chef::Knife::GithubBase
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+ <dt class="r1 last">Defined in:</dt>
82
+ <dd class="r1 last">lib/chef/knife/github_base.rb</dd>
83
+
84
+ </dl>
85
+ <div class="clear"></div>
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ <h2>
96
+ Class Method Summary
97
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
98
+ </h2>
99
+
100
+ <ul class="summary">
101
+
102
+ <li class="public ">
103
+ <span class="summary_signature">
104
+
105
+ <a href="#included-class_method" title="included (class method)">+ (Object) <strong>included</strong>(includer) </a>
106
+
107
+
108
+
109
+ </span>
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+ <span class="summary_desc"><div class='inline'></div></span>
120
+
121
+ </li>
122
+
123
+
124
+ </ul>
125
+
126
+
127
+
128
+
129
+ <div id="class_method_details" class="method_details_list">
130
+ <h2>Class Method Details</h2>
131
+
132
+
133
+ <div class="method_details first">
134
+ <h3 class="signature first" id="included-class_method">
135
+
136
+ + (<tt>Object</tt>) <strong>included</strong>(includer)
137
+
138
+
139
+
140
+
141
+
142
+ </h3><table class="source_code">
143
+ <tr>
144
+ <td>
145
+ <pre class="lines">
146
+
147
+
148
+ 26
149
+ 27
150
+ 28
151
+ 29
152
+ 30
153
+ 31
154
+ 32
155
+ 33
156
+ 34
157
+ 35
158
+ 36
159
+ 37
160
+ 38
161
+ 39
162
+ 40
163
+ 41
164
+ 42
165
+ 43
166
+ 44
167
+ 45
168
+ 46
169
+ 47
170
+ 48
171
+ 49
172
+ 50
173
+ 51
174
+ 52
175
+ 53
176
+ 54
177
+ 55
178
+ 56
179
+ 57
180
+ 58
181
+ 59
182
+ 60
183
+ 61
184
+ 62
185
+ 63
186
+ 64
187
+ 65
188
+ 66
189
+ 67
190
+ 68
191
+ 69
192
+ 70
193
+ 71
194
+ 72
195
+ 73
196
+ 74
197
+ 75
198
+ 76
199
+ 77
200
+ 78
201
+ 79
202
+ 80
203
+ 81
204
+ 82
205
+ 83
206
+ 84
207
+ 85
208
+ 86
209
+ 87
210
+ 88
211
+ 89
212
+ 90
213
+ 91
214
+ 92
215
+ 93
216
+ 94
217
+ 95
218
+ 96
219
+ 97
220
+ 98
221
+ 99
222
+ 100
223
+ 101
224
+ 102
225
+ 103
226
+ 104
227
+ 105
228
+ 106
229
+ 107
230
+ 108
231
+ 109
232
+ 110
233
+ 111
234
+ 112
235
+ 113
236
+ 114
237
+ 115
238
+ 116
239
+ 117
240
+ 118
241
+ 119
242
+ 120
243
+ 121
244
+ 122
245
+ 123
246
+ 124
247
+ 125
248
+ 126
249
+ 127
250
+ 128
251
+ 129
252
+ 130
253
+ 131
254
+ 132
255
+ 133
256
+ 134
257
+ 135
258
+ 136
259
+ 137
260
+ 138
261
+ 139
262
+ 140
263
+ 141
264
+ 142
265
+ 143
266
+ 144
267
+ 145
268
+ 146
269
+ 147
270
+ 148
271
+ 149
272
+ 150
273
+ 151
274
+ 152
275
+ 153
276
+ 154
277
+ 155
278
+ 156
279
+ 157
280
+ 158
281
+ 159
282
+ 160
283
+ 161
284
+ 162
285
+ 163
286
+ 164
287
+ 165
288
+ 166
289
+ 167
290
+ 168
291
+ 169
292
+ 170
293
+ 171
294
+ 172
295
+ 173
296
+ 174
297
+ 175
298
+ 176
299
+ 177
300
+ 178
301
+ 179
302
+ 180
303
+ 181
304
+ 182
305
+ 183
306
+ 184
307
+ 185
308
+ 186
309
+ 187
310
+ 188
311
+ 189
312
+ 190
313
+ 191
314
+ 192
315
+ 193
316
+ 194
317
+ 195
318
+ 196
319
+ 197
320
+ 198
321
+ 199
322
+ 200
323
+ 201
324
+ 202
325
+ 203
326
+ 204
327
+ 205
328
+ 206
329
+ 207
330
+ 208
331
+ 209
332
+ 210
333
+ 211
334
+ 212
335
+ 213
336
+ 214
337
+ 215
338
+ 216
339
+ 217
340
+ 218
341
+ 219
342
+ 220
343
+ 221
344
+ 222
345
+ 223
346
+ 224
347
+ 225
348
+ 226
349
+ 227
350
+ 228
351
+ 229
352
+ 230
353
+ 231
354
+ 232
355
+ 233
356
+ 234
357
+ 235
358
+ 236
359
+ 237
360
+ 238
361
+ 239
362
+ 240
363
+ 241
364
+ 242
365
+ 243
366
+ 244
367
+ 245
368
+ 246
369
+ 247
370
+ 248
371
+ 249
372
+ 250
373
+ 251
374
+ 252
375
+ 253
376
+ 254
377
+ 255
378
+ 256
379
+ 257
380
+ 258
381
+ 259
382
+ 260
383
+ 261
384
+ 262
385
+ 263
386
+ 264
387
+ 265
388
+ 266
389
+ 267
390
+ 268
391
+ 269
392
+ 270
393
+ 271
394
+ 272
395
+ 273
396
+ 274
397
+ 275
398
+ 276
399
+ 277
400
+ 278
401
+ 279
402
+ 280
403
+ 281
404
+ 282
405
+ 283
406
+ 284
407
+ 285
408
+ 286
409
+ 287
410
+ 288
411
+ 289
412
+ 290
413
+ 291
414
+ 292
415
+ 293
416
+ 294
417
+ 295
418
+ 296
419
+ 297
420
+ 298
421
+ 299
422
+ 300
423
+ 301
424
+ 302
425
+ 303
426
+ 304
427
+ 305
428
+ 306
429
+ 307
430
+ 308
431
+ 309
432
+ 310
433
+ 311
434
+ 312
435
+ 313
436
+ 314
437
+ 315
438
+ 316
439
+ 317
440
+ 318
441
+ 319
442
+ 320
443
+ 321
444
+ 322
445
+ 323
446
+ 324
447
+ 325
448
+ 326
449
+ 327
450
+ 328
451
+ 329
452
+ 330
453
+ 331
454
+ 332
455
+ 333</pre>
456
+ </td>
457
+ <td>
458
+ <pre class="code"><span class="info file"># File 'lib/chef/knife/github_base.rb', line 26</span>
459
+
460
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_included'>included</span><span class='lparen'>(</span><span class='id identifier rubyid_includer'>includer</span><span class='rparen'>)</span>
461
+ <span class='id identifier rubyid_includer'>includer</span><span class='period'>.</span><span class='id identifier rubyid_class_eval'>class_eval</span> <span class='kw'>do</span>
462
+
463
+ <span class='id identifier rubyid_deps'>deps</span> <span class='kw'>do</span>
464
+ <span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>chef/mixin/shell_out</span><span class='tstring_end'>'</span></span>
465
+ <span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>mixlib/versioning</span><span class='tstring_end'>'</span></span>
466
+ <span class='kw'>end</span>
467
+
468
+ <span class='id identifier rubyid_option'>option</span> <span class='symbol'>:github_url</span><span class='comma'>,</span>
469
+ <span class='symbol'>:long</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>--github_url URL</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
470
+ <span class='symbol'>:description</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>URL of the github enterprise appliance</span><span class='tstring_end'>&quot;</span></span>
471
+
472
+ <span class='id identifier rubyid_option'>option</span> <span class='symbol'>:github_organizations</span><span class='comma'>,</span>
473
+ <span class='symbol'>:long</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>--github_org ORG:ORG</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
474
+ <span class='symbol'>:description</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Lookup chef cookbooks in this colon-separated list of organizations</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
475
+ <span class='symbol'>:proc</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_lambda'>lambda</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_o'>o</span><span class='op'>|</span> <span class='id identifier rubyid_o'>o</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>:</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span>
476
+
477
+ <span class='id identifier rubyid_option'>option</span> <span class='symbol'>:github_link</span><span class='comma'>,</span>
478
+ <span class='symbol'>:long</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>--github_link TYPE</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
479
+ <span class='symbol'>:description</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Link type: ssh, http, git (dafault: ssh)</span><span class='tstring_end'>&quot;</span></span>
480
+
481
+ <span class='id identifier rubyid_option'>option</span> <span class='symbol'>:github_api_version</span><span class='comma'>,</span>
482
+ <span class='symbol'>:long</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>--github_api_ver VERSION</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
483
+ <span class='symbol'>:description</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Version number of the API (default: v3)</span><span class='tstring_end'>&quot;</span></span>
484
+
485
+ <span class='id identifier rubyid_option'>option</span> <span class='symbol'>:github_ssl_verify_mode</span><span class='comma'>,</span>
486
+ <span class='symbol'>:long</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>--github_ssl_verify_mode</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
487
+ <span class='symbol'>:description</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>SSL verify mode: verify_peer, verify_none (default: verify_peer)</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
488
+ <span class='symbol'>:boolean</span> <span class='op'>=&gt;</span> <span class='kw'>true</span>
489
+
490
+ <span class='id identifier rubyid_option'>option</span> <span class='symbol'>:github_tmp</span><span class='comma'>,</span>
491
+ <span class='symbol'>:long</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>--github_tmp PATH</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
492
+ <span class='symbol'>:description</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>A path where temporary files for the diff function will be made default: /tmp/gitdiff)</span><span class='tstring_end'>&quot;</span></span>
493
+
494
+ <span class='id identifier rubyid_option'>option</span> <span class='symbol'>:github_no_update</span><span class='comma'>,</span>
495
+ <span class='symbol'>:long</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>--github_no_update</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
496
+ <span class='symbol'>:description</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Turn github update checking off</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
497
+ <span class='symbol'>:boolean</span> <span class='op'>=&gt;</span> <span class='kw'>true</span>
498
+
499
+ <span class='kw'>def</span> <span class='id identifier rubyid_validate_base_options'>validate_base_options</span>
500
+ <span class='kw'>unless</span> <span class='id identifier rubyid_locate_config_value'>locate_config_value</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>github_url</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
501
+ <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Github URL not specified</span><span class='tstring_end'>&quot;</span></span>
502
+ <span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span>
503
+ <span class='kw'>end</span>
504
+ <span class='kw'>unless</span> <span class='id identifier rubyid_locate_config_value'>locate_config_value</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>github_organizations</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
505
+ <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Github organization(s) not specified</span><span class='tstring_end'>&quot;</span></span>
506
+ <span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span>
507
+ <span class='kw'>end</span>
508
+ <span class='kw'>unless</span> <span class='id identifier rubyid_locate_config_value'>locate_config_value</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>github_no_update</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
509
+ <span class='id identifier rubyid_check_gem_version'>check_gem_version</span>
510
+ <span class='kw'>end</span>
511
+
512
+ <span class='ivar'>@github_url</span> <span class='op'>=</span> <span class='id identifier rubyid_locate_config_value'>locate_config_value</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>github_url</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
513
+ <span class='ivar'>@github_organizations</span> <span class='op'>=</span> <span class='id identifier rubyid_locate_config_value'>locate_config_value</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>github_organizations</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
514
+ <span class='ivar'>@github_link</span> <span class='op'>=</span> <span class='id identifier rubyid_locate_config_value'>locate_config_value</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>github_link</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>ssh</span><span class='tstring_end'>'</span></span>
515
+ <span class='ivar'>@github_api_version</span> <span class='op'>=</span> <span class='id identifier rubyid_locate_config_value'>locate_config_value</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>github_api_version</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>v3</span><span class='tstring_end'>'</span></span>
516
+ <span class='ivar'>@github_ssl_verify_mode</span> <span class='op'>=</span> <span class='id identifier rubyid_locate_config_value'>locate_config_value</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>github_ssl_verify_mode</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>verify_peer</span><span class='tstring_end'>'</span></span>
517
+ <span class='ivar'>@github_tmp</span> <span class='op'>=</span> <span class='id identifier rubyid_locate_config_value'>locate_config_value</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>github_tmp</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/var/tmp/gitdiff</span><span class='tstring_end'>'</span></span>
518
+ <span class='ivar'>@github_tmp</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='ivar'>@github_tmp</span><span class='rbrace'>}</span><span class='embexpr_beg'>#{</span><span class='const'>Process</span><span class='period'>.</span><span class='id identifier rubyid_pid'>pid</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
519
+ <span class='kw'>end</span>
520
+
521
+ <span class='kw'>def</span> <span class='id identifier rubyid_check_gem_version'>check_gem_version</span>
522
+ <span class='id identifier rubyid_url'>url</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>http://rubygems.org/api/v1/gems/knife-github.json</span><span class='tstring_end'>'</span></span>
523
+ <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='backtick'>`</span><span class='tstring_content'>curl -L -s </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_url'>url</span><span class='rbrace'>}</span><span class='tstring_end'>`</span></span>
524
+ <span class='kw'>begin</span>
525
+ <span class='id identifier rubyid_json'>json</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_result'>result</span><span class='rparen'>)</span>
526
+ <span class='id identifier rubyid_webversion'>webversion</span> <span class='op'>=</span> <span class='const'>Mixlib</span><span class='op'>::</span><span class='const'>Versioning</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>version</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
527
+ <span class='id identifier rubyid_thisversion'>thisversion</span> <span class='op'>=</span> <span class='const'>Mixlib</span><span class='op'>::</span><span class='const'>Versioning</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Knife</span><span class='op'>::</span><span class='const'>Github</span><span class='op'>::</span><span class='const'>VERSION</span><span class='rparen'>)</span>
528
+ <span class='kw'>if</span> <span class='id identifier rubyid_webversion'>webversion</span> <span class='op'>&gt;</span> <span class='id identifier rubyid_thisversion'>thisversion</span>
529
+ <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>INFO: New version (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_webversion'>webversion</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rbrace'>}</span><span class='tstring_content'>) of knife-github is available!</span><span class='tstring_end'>&quot;</span></span>
530
+ <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>INFO: Turn off this message with --github_no_update or add knife[:github_no_update] = true to your configuration</span><span class='tstring_end'>&quot;</span></span>
531
+ <span class='kw'>end</span>
532
+ <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>local_gem_version : </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_thisversion'>thisversion</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
533
+ <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>repo_gem_version : </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_webversion'>webversion</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
534
+ <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>repo_downloads : </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>version_downloads</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
535
+ <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>repo_total_downloads : </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>downloads</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
536
+
537
+ <span class='kw'>rescue</span>
538
+ <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>INFO: Cannot verify gem version information from rubygems.org</span><span class='tstring_end'>&quot;</span></span>
539
+ <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>INFO: Turn off this message with --github_no_update or add knife[:github_no_update] = true to your configuration</span><span class='tstring_end'>&quot;</span></span>
540
+ <span class='kw'>end</span>
541
+ <span class='kw'>end</span>
542
+
543
+ <span class='kw'>def</span> <span class='id identifier rubyid_display_debug_info'>display_debug_info</span>
544
+ <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>github_url : </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='ivar'>@github_url</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
545
+ <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>github_org : </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='ivar'>@github_organizations</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
546
+ <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>github_api : </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='ivar'>@github_api_version</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
547
+ <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>github_link : </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='ivar'>@github_link</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
548
+ <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>github_ssl_mode : </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='ivar'>@github_ssl_verify_mode</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
549
+ <span class='kw'>end</span>
550
+
551
+ <span class='kw'>def</span> <span class='id identifier rubyid_locate_config_value'>locate_config_value</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
552
+ <span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
553
+ <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Config</span><span class='lbracket'>[</span><span class='symbol'>:knife</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span>
554
+ <span class='kw'>end</span>
555
+
556
+ <span class='kw'>def</span> <span class='id identifier rubyid_get_repo_clone_link'>get_repo_clone_link</span>
557
+ <span class='id identifier rubyid_link'>link</span> <span class='op'>=</span> <span class='id identifier rubyid_locate_config_value'>locate_config_value</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>github_link</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
558
+ <span class='id identifier rubyid_repo_link'>repo_link</span> <span class='op'>=</span> <span class='kw'>case</span> <span class='id identifier rubyid_link'>link</span>
559
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>ssh</span><span class='tstring_end'>'</span></span> <span class='kw'>then</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>ssh_url</span><span class='tstring_end'>'</span></span>
560
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>http</span><span class='tstring_end'>'</span></span> <span class='kw'>then</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>clone_url</span><span class='tstring_end'>'</span></span>
561
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>https</span><span class='tstring_end'>'</span></span> <span class='kw'>then</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>clone_url</span><span class='tstring_end'>'</span></span>
562
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>svn</span><span class='tstring_end'>'</span></span> <span class='kw'>then</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>svn_url</span><span class='tstring_end'>'</span></span>
563
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>html</span><span class='tstring_end'>'</span></span> <span class='kw'>then</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>html_url</span><span class='tstring_end'>'</span></span>
564
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>git</span><span class='tstring_end'>'</span></span> <span class='kw'>then</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>git_url</span><span class='tstring_end'>'</span></span>
565
+ <span class='kw'>else</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>ssh_url</span><span class='tstring_end'>'</span></span>
566
+ <span class='kw'>end</span>
567
+ <span class='kw'>return</span> <span class='id identifier rubyid_repo_link'>repo_link</span>
568
+ <span class='kw'>end</span>
569
+
570
+ <span class='kw'>def</span> <span class='id identifier rubyid_get_all_repos'>get_all_repos</span><span class='lparen'>(</span><span class='id identifier rubyid_orgs'>orgs</span><span class='rparen'>)</span>
571
+ <span class='comment'># Parse every org and merge all into one hash
572
+ </span> <span class='id identifier rubyid_repos'>repos</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
573
+ <span class='id identifier rubyid_orgs'>orgs</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_org'>org</span><span class='op'>|</span>
574
+ <span class='id identifier rubyid_get_repos'>get_repos</span><span class='lparen'>(</span><span class='id identifier rubyid_org'>org</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_repo'>repo</span><span class='op'>|</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='id identifier rubyid_repo'>repo</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>name</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='semicolon'>;</span> <span class='id identifier rubyid_repos'>repos</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_repo'>repo</span> <span class='rbrace'>}</span>
575
+ <span class='kw'>end</span>
576
+ <span class='id identifier rubyid_repos'>repos</span>
577
+ <span class='kw'>end</span>
578
+
579
+ <span class='kw'>def</span> <span class='id identifier rubyid_get_repos'>get_repos</span><span class='lparen'>(</span><span class='id identifier rubyid_org'>org</span><span class='rparen'>)</span>
580
+ <span class='id identifier rubyid_dns_name'>dns_name</span> <span class='op'>=</span> <span class='id identifier rubyid_get_dns_name'>get_dns_name</span><span class='lparen'>(</span><span class='ivar'>@github_url</span><span class='rparen'>)</span>
581
+ <span class='id identifier rubyid_file_cache'>file_cache</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>HOME</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>/.chef/.</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_dns_name'>dns_name</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='rbrace'>}</span><span class='tstring_content'>_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_org'>org</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
582
+
583
+ <span class='kw'>if</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='id identifier rubyid_file_cache'>file_cache</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.json</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
584
+ <span class='id identifier rubyid_json'>json</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='id identifier rubyid_file_cache'>file_cache</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.json</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
585
+ <span class='id identifier rubyid_json_updated'>json_updated</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>updated_at</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
586
+ <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_org'>org</span><span class='rbrace'>}</span><span class='tstring_content'> - cache created at : </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_json_updated'>json_updated</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
587
+ <span class='id identifier rubyid_repo_updated'>repo_updated</span> <span class='op'>=</span> <span class='id identifier rubyid_get_org_updated_time'>get_org_updated_time</span><span class='lparen'>(</span><span class='id identifier rubyid_org'>org</span><span class='rparen'>)</span>
588
+ <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_org'>org</span><span class='rbrace'>}</span><span class='tstring_content'> - repos updated at : </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_repo_updated'>repo_updated</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
589
+
590
+ <span class='kw'>unless</span> <span class='id identifier rubyid_json_updated'>json_updated</span> <span class='op'>&gt;=</span> <span class='id identifier rubyid_repo_updated'>repo_updated</span>
591
+ <span class='comment'># update cache file
592
+ </span> <span class='id identifier rubyid_create_cache_file'>create_cache_file</span><span class='lparen'>(</span><span class='id identifier rubyid_file_cache'>file_cache</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.cache</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_org'>org</span><span class='rparen'>)</span>
593
+ <span class='id identifier rubyid_create_cache_json'>create_cache_json</span><span class='lparen'>(</span><span class='id identifier rubyid_file_cache'>file_cache</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.json</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_org'>org</span><span class='rparen'>)</span>
594
+ <span class='kw'>end</span>
595
+ <span class='kw'>else</span>
596
+ <span class='id identifier rubyid_create_cache_file'>create_cache_file</span><span class='lparen'>(</span><span class='id identifier rubyid_file_cache'>file_cache</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.cache</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_org'>org</span><span class='rparen'>)</span>
597
+ <span class='id identifier rubyid_create_cache_json'>create_cache_json</span><span class='lparen'>(</span><span class='id identifier rubyid_file_cache'>file_cache</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.json</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_org'>org</span><span class='rparen'>)</span>
598
+ <span class='kw'>end</span>
599
+
600
+ <span class='comment'># use cache files
601
+ </span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='id identifier rubyid_file_cache'>file_cache</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.cache</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
602
+ <span class='kw'>end</span>
603
+
604
+ <span class='kw'>def</span> <span class='id identifier rubyid_create_cache_json'>create_cache_json</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_org'>org</span><span class='rparen'>)</span>
605
+ <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Updating the cache file: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_file'>file</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
606
+ <span class='id identifier rubyid_url'>url</span> <span class='op'>=</span> <span class='ivar'>@github_url</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/api/</span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='ivar'>@github_api_version</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/orgs/</span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_org'>org</span>
607
+ <span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>response</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>json</span><span class='tstring_end'>'</span></span><span class='rbrace'>}</span>
608
+ <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_send_request'>send_request</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
609
+ <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>w</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_f'>f</span><span class='op'>|</span> <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_pretty_generate'>pretty_generate</span><span class='lparen'>(</span><span class='id identifier rubyid_result'>result</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
610
+ <span class='kw'>end</span>
611
+
612
+ <span class='kw'>def</span> <span class='id identifier rubyid_create_cache_file'>create_cache_file</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_org'>org</span><span class='rparen'>)</span>
613
+ <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Updating the cache file: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_file'>file</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
614
+ <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_get_repos_github'>get_repos_github</span><span class='lparen'>(</span><span class='id identifier rubyid_org'>org</span><span class='rparen'>)</span>
615
+ <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>w</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_f'>f</span><span class='op'>|</span> <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_pretty_generate'>pretty_generate</span><span class='lparen'>(</span><span class='id identifier rubyid_result'>result</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
616
+ <span class='kw'>end</span>
617
+
618
+ <span class='kw'>def</span> <span class='id identifier rubyid_get_org_updated_time'>get_org_updated_time</span><span class='lparen'>(</span><span class='id identifier rubyid_org'>org</span><span class='rparen'>)</span>
619
+ <span class='id identifier rubyid_url'>url</span> <span class='op'>=</span> <span class='ivar'>@github_url</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/api/</span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='ivar'>@github_api_version</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/orgs/</span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_org'>org</span>
620
+ <span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>response</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>json</span><span class='tstring_end'>'</span></span><span class='rbrace'>}</span>
621
+ <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_send_request'>send_request</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
622
+ <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_result'>result</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>updated_at</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
623
+ <span class='kw'>end</span>
624
+
625
+ <span class='kw'>def</span> <span class='id identifier rubyid_get_repos_github'>get_repos_github</span><span class='lparen'>(</span><span class='id identifier rubyid_org'>org</span><span class='rparen'>)</span>
626
+ <span class='comment'># Get all repo's for the org from github
627
+ </span> <span class='id identifier rubyid_arr'>arr</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
628
+ <span class='id identifier rubyid_page'>page</span> <span class='op'>=</span> <span class='int'>1</span>
629
+ <span class='id identifier rubyid_url'>url</span> <span class='op'>=</span> <span class='ivar'>@github_url</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/api/</span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='ivar'>@github_api_version</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/orgs/</span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_org'>org</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/repos</span><span class='tstring_end'>&quot;</span></span>
630
+ <span class='kw'>while</span> <span class='kw'>true</span>
631
+ <span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>response</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>json</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>page</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_page'>page</span> <span class='rbrace'>}</span>
632
+ <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_send_request'>send_request</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
633
+ <span class='kw'>break</span> <span class='kw'>if</span> <span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'>&lt;</span> <span class='int'>1</span>
634
+ <span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='op'>|</span>
635
+ <span class='kw'>if</span> <span class='id identifier rubyid_key'>key</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>tags_url</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
636
+ <span class='id identifier rubyid_tags'>tags</span> <span class='op'>=</span> <span class='id identifier rubyid_get_tags'>get_tags</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
637
+ <span class='id identifier rubyid_key'>key</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>tags</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_tags'>tags</span> <span class='kw'>unless</span> <span class='id identifier rubyid_tags'>tags</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_tags'>tags</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
638
+ <span class='id identifier rubyid_key'>key</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>latest_tag</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_get_latest_tag'>get_latest_tag</span><span class='lparen'>(</span><span class='id identifier rubyid_tags'>tags</span><span class='rparen'>)</span>
639
+ <span class='id identifier rubyid_arr'>arr</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_key'>key</span>
640
+ <span class='kw'>else</span>
641
+ <span class='id identifier rubyid_arr'>arr</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_key'>key</span>
642
+ <span class='kw'>end</span>
643
+ <span class='rbrace'>}</span>
644
+ <span class='id identifier rubyid_page'>page</span> <span class='op'>=</span> <span class='id identifier rubyid_page'>page</span> <span class='op'>+</span> <span class='int'>1</span>
645
+ <span class='kw'>end</span>
646
+ <span class='id identifier rubyid_arr'>arr</span>
647
+ <span class='kw'>end</span>
648
+
649
+ <span class='kw'>def</span> <span class='id identifier rubyid_get_tags'>get_tags</span><span class='lparen'>(</span><span class='id identifier rubyid_repo'>repo</span><span class='rparen'>)</span>
650
+ <span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>response</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>json</span><span class='tstring_end'>'</span></span><span class='rbrace'>}</span>
651
+ <span class='id identifier rubyid_tags'>tags</span> <span class='op'>=</span> <span class='id identifier rubyid_send_request'>send_request</span><span class='lparen'>(</span><span class='id identifier rubyid_repo'>repo</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>tags_url</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
652
+ <span class='id identifier rubyid_tags'>tags</span>
653
+ <span class='kw'>end</span>
654
+
655
+ <span class='kw'>def</span> <span class='id identifier rubyid_get_latest_tag'>get_latest_tag</span><span class='lparen'>(</span><span class='id identifier rubyid_tags'>tags</span><span class='rparen'>)</span>
656
+ <span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_tags'>tags</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_tags'>tags</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
657
+ <span class='id identifier rubyid_tags_arr'>tags_arr</span> <span class='op'>=</span><span class='lbracket'>[</span><span class='rbracket'>]</span>
658
+ <span class='id identifier rubyid_tags'>tags</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_tag'>tag</span><span class='op'>|</span>
659
+ <span class='id identifier rubyid_tags_arr'>tags_arr</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='const'>Mixlib</span><span class='op'>::</span><span class='const'>Versioning</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_tag'>tag</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>name</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_tag'>tag</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>name</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^(\d*)\.(\d*)\.(\d*)$</span><span class='regexp_end'>/</span></span>
660
+ <span class='kw'>end</span>
661
+ <span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_tags_arr'>tags_arr</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_tags_arr'>tags_arr</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
662
+ <span class='kw'>return</span> <span class='id identifier rubyid_tags_arr'>tags_arr</span><span class='period'>.</span><span class='id identifier rubyid_sort'>sort</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
663
+ <span class='kw'>end</span>
664
+
665
+ <span class='kw'>def</span> <span class='id identifier rubyid_get_dns_name'>get_dns_name</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='rparen'>)</span>
666
+ <span class='id identifier rubyid_url'>url</span> <span class='op'>=</span> <span class='id identifier rubyid_url'>url</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>http://</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_url'>url</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='period'>.</span><span class='id identifier rubyid_start_with?'>start_with?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>http://</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
667
+ <span class='id identifier rubyid_url'>url</span> <span class='op'>=</span> <span class='id identifier rubyid_url'>url</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>https://</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_url'>url</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='period'>.</span><span class='id identifier rubyid_start_with?'>start_with?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>https://</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
668
+ <span class='id identifier rubyid_url'>url</span>
669
+ <span class='kw'>end</span>
670
+
671
+ <span class='kw'>def</span> <span class='id identifier rubyid_send_request'>send_request</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
672
+ <span class='kw'>unless</span> <span class='id identifier rubyid_params'>params</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
673
+ <span class='id identifier rubyid_params_arr'>params_arr</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
674
+ <span class='id identifier rubyid_params'>params</span><span class='period'>.</span><span class='id identifier rubyid_sort'>sort</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_elem'>elem</span><span class='op'>|</span>
675
+ <span class='id identifier rubyid_params_arr'>params_arr</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_elem'>elem</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>=</span><span class='tstring_end'>'</span></span> <span class='op'>+</span> <span class='const'>CGI</span><span class='period'>.</span><span class='id identifier rubyid_escape'>escape</span><span class='lparen'>(</span><span class='id identifier rubyid_elem'>elem</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>+</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>%20</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'> </span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>%20</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
676
+ <span class='rbrace'>}</span>
677
+ <span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='id identifier rubyid_params_arr'>params_arr</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>&amp;</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
678
+ <span class='id identifier rubyid_url'>url</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_url'>url</span><span class='rbrace'>}</span><span class='tstring_content'>?</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_data'>data</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
679
+ <span class='kw'>end</span>
680
+
681
+ <span class='kw'>if</span> <span class='ivar'>@github_ssl_verify_mode</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>verify_none</span><span class='tstring_end'>&quot;</span></span>
682
+ <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:ssl_verify_mode</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='symbol'>:verify_none</span>
683
+ <span class='kw'>elsif</span> <span class='ivar'>@github_ssl_verify_mode</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>verify_peer</span><span class='tstring_end'>&quot;</span></span>
684
+ <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:ssl_verify_mode</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='symbol'>:verify_peer</span>
685
+ <span class='kw'>end</span>
686
+
687
+ <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>URL: </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_url'>url</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
688
+
689
+ <span class='id identifier rubyid_uri'>uri</span> <span class='op'>=</span> <span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='rparen'>)</span>
690
+ <span class='id identifier rubyid_req_body'>req_body</span> <span class='op'>=</span> <span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTP</span><span class='op'>::</span><span class='const'>Get</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='period'>.</span><span class='id identifier rubyid_request_uri'>request_uri</span><span class='rparen'>)</span>
691
+ <span class='id identifier rubyid_request'>request</span> <span class='op'>=</span> <span class='const'>Chef</span><span class='op'>::</span><span class='const'>REST</span><span class='op'>::</span><span class='const'>RESTRequest</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>GET</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_uri'>uri</span><span class='comma'>,</span> <span class='id identifier rubyid_req_body'>req_body</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
692
+
693
+ <span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span>
694
+
695
+ <span class='kw'>unless</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTPOK</span><span class='rparen'>)</span> <span class='kw'>then</span>
696
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Error </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span><span class='rbrace'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
697
+ <span class='id identifier rubyid_puts'>puts</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_pretty_generate'>pretty_generate</span><span class='lparen'>(</span><span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span><span class='rparen'>)</span>
698
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>URL: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_url'>url</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
699
+ <span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span>
700
+ <span class='kw'>end</span>
701
+
702
+ <span class='kw'>begin</span>
703
+ <span class='id identifier rubyid_json'>json</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
704
+ <span class='kw'>rescue</span>
705
+ <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>The result on the RESTRequest is not in json format</span><span class='tstring_end'>&quot;</span></span>
706
+ <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Output: </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span>
707
+ <span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span>
708
+ <span class='kw'>end</span>
709
+ <span class='kw'>return</span> <span class='id identifier rubyid_json'>json</span>
710
+ <span class='kw'>end</span>
711
+
712
+ <span class='kw'>def</span> <span class='id identifier rubyid_get_clone'>get_clone</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_cookbook'>cookbook</span><span class='rparen'>)</span>
713
+ <span class='kw'>if</span> <span class='op'>!</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_directory?'>directory?</span> <span class='ivar'>@github_tmp</span>
714
+ <span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_mkdir'>mkdir</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='ivar'>@github_tmp</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
715
+ <span class='kw'>end</span>
716
+ <span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_mkdir'>mkdir</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='ivar'>@github_tmp</span><span class='rbrace'>}</span><span class='tstring_content'>/git</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
717
+ <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Getting </span><span class='embexpr_beg'>#{</span><span class='ivar'>@cookbook_name</span><span class='rbrace'>}</span><span class='tstring_content'> from </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_url'>url</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
718
+ <span class='id identifier rubyid_output'>output</span> <span class='op'>=</span> <span class='backtick'>`</span><span class='tstring_content'>git clone </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_url'>url</span><span class='rbrace'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='ivar'>@github_tmp</span><span class='rbrace'>}</span><span class='tstring_content'>/git/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cookbook'>cookbook</span><span class='rbrace'>}</span><span class='tstring_content'> 2&gt;&amp;1</span><span class='tstring_end'>`</span></span>
719
+ <span class='kw'>if</span> <span class='gvar'>$?</span><span class='period'>.</span><span class='id identifier rubyid_exitstatus'>exitstatus</span> <span class='op'>!=</span> <span class='int'>0</span>
720
+ <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Could not clone the repository for: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cookbook'>cookbook</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
721
+ <span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_remove_entry'>remove_entry</span><span class='lparen'>(</span><span class='ivar'>@github_tmp</span><span class='rparen'>)</span>
722
+ <span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span>
723
+ <span class='kw'>end</span>
724
+ <span class='kw'>return</span> <span class='kw'>true</span>
725
+ <span class='kw'>end</span>
726
+
727
+ <span class='kw'>def</span> <span class='id identifier rubyid_add_tag'>add_tag</span><span class='lparen'>(</span><span class='id identifier rubyid_version'>version</span><span class='rparen'>)</span>
728
+ <span class='id identifier rubyid_cpath'>cpath</span> <span class='op'>=</span> <span class='id identifier rubyid_cookbook_path_valid?'>cookbook_path_valid?</span><span class='lparen'>(</span><span class='ivar'>@cookbook_name</span><span class='comma'>,</span> <span class='kw'>false</span><span class='rparen'>)</span>
729
+ <span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_chdir'>chdir</span><span class='lparen'>(</span><span class='id identifier rubyid_cpath'>cpath</span><span class='rparen'>)</span>
730
+ <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Adding tag</span><span class='tstring_end'>&quot;</span></span>
731
+ <span class='id identifier rubyid_output'>output</span> <span class='op'>=</span> <span class='backtick'>`</span><span class='tstring_content'>git tag -a &quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_version'>version</span><span class='rbrace'>}</span><span class='tstring_content'>&quot; -m &quot;Added tag </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_version'>version</span><span class='rbrace'>}</span><span class='tstring_content'>&quot; 2&gt;&amp;1</span><span class='tstring_end'>`</span></span>
732
+ <span class='kw'>if</span> <span class='gvar'>$?</span><span class='period'>.</span><span class='id identifier rubyid_exitstatus'>exitstatus</span> <span class='op'>!=</span> <span class='int'>0</span>
733
+ <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Could not add tag for: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@cookbook_name</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
734
+ <span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_remove_entry'>remove_entry</span><span class='lparen'>(</span><span class='ivar'>@github_tmp</span><span class='rparen'>)</span>
735
+ <span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span>
736
+ <span class='kw'>end</span>
737
+ <span class='kw'>end</span>
738
+
739
+ <span class='kw'>def</span> <span class='id identifier rubyid_cookbook_path_valid?'>cookbook_path_valid?</span><span class='lparen'>(</span><span class='id identifier rubyid_cookbook_name'>cookbook_name</span><span class='comma'>,</span> <span class='id identifier rubyid_check_exists'>check_exists</span><span class='rparen'>)</span>
740
+ <span class='id identifier rubyid_cookbook_path'>cookbook_path</span> <span class='op'>=</span> <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:cookbook_path</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Config</span><span class='lbracket'>[</span><span class='symbol'>:cookbook_path</span><span class='rbracket'>]</span>
741
+ <span class='kw'>if</span> <span class='id identifier rubyid_cookbook_path'>cookbook_path</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_cookbook_path'>cookbook_path</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
742
+ <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Please specify a cookbook path</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
743
+ <span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span>
744
+ <span class='kw'>end</span>
745
+
746
+ <span class='kw'>unless</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='id identifier rubyid_cookbook_path'>cookbook_path</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_directory?'>directory?</span><span class='lparen'>(</span><span class='id identifier rubyid_cookbook_path'>cookbook_path</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='rparen'>)</span>
747
+ <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Cannot find the directory: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cookbook_path'>cookbook_path</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
748
+ <span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span>
749
+ <span class='kw'>end</span>
750
+
751
+ <span class='id identifier rubyid_cookbook_path'>cookbook_path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_cookbook_path'>cookbook_path</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='comma'>,</span><span class='id identifier rubyid_cookbook_name'>cookbook_name</span><span class='rparen'>)</span>
752
+ <span class='kw'>if</span> <span class='id identifier rubyid_check_exists'>check_exists</span>
753
+ <span class='kw'>if</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='id identifier rubyid_cookbook_path'>cookbook_path</span><span class='rparen'>)</span>
754
+ <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Processing [S] </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cookbook_name'>cookbook_name</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
755
+ <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Path to </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cookbook_path'>cookbook_path</span><span class='rbrace'>}</span><span class='tstring_content'> already exists, skipping.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
756
+ <span class='kw'>return</span> <span class='kw'>nil</span>
757
+ <span class='kw'>end</span>
758
+ <span class='kw'>else</span>
759
+ <span class='kw'>if</span> <span class='op'>!</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='id identifier rubyid_cookbook_path'>cookbook_path</span><span class='rparen'>)</span>
760
+ <span class='kw'>return</span> <span class='kw'>nil</span>
761
+ <span class='kw'>end</span>
762
+ <span class='kw'>end</span>
763
+ <span class='kw'>return</span> <span class='id identifier rubyid_cookbook_path'>cookbook_path</span>
764
+ <span class='kw'>end</span>
765
+
766
+ <span class='kw'>end</span>
767
+ <span class='kw'>end</span></pre>
768
+ </td>
769
+ </tr>
770
+ </table>
771
+ </div>
772
+
773
+ </div>
774
+
775
+ </div>
776
+
777
+ <div id="footer">
778
+ Generated on Wed Oct 30 20:03:34 2013 by
779
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
780
+ 0.8.7.2 (ruby-1.9.3).
781
+ </div>
782
+
783
+ </body>
784
+ </html>