knife-github 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/Chef.html +1 -1
- data/doc/Chef/Knife.html +1 -1
- data/doc/Chef/Knife/GithubBase.html +5 -5
- data/doc/Chef/Knife/GithubBaseList.html +11 -5
- data/doc/Chef/Knife/GithubClone.html +1 -1
- data/doc/Chef/Knife/GithubCompare.html +7 -7
- data/doc/Chef/Knife/GithubDeploy.html +4 -4
- data/doc/Chef/Knife/GithubDiff.html +26 -16
- data/doc/Chef/Knife/GithubList.html +2 -2
- data/doc/KnifeGithubCleanup.html +1 -1
- data/doc/KnifeGithubCleanup/GithubCleanup.html +1 -1
- data/doc/KnifeGithubSearch.html +1 -1
- data/doc/KnifeGithubSearch/GithubSearch.html +1 -1
- data/doc/_index.html +1 -1
- data/doc/file.README.html +1 -1
- data/doc/index.html +1 -1
- data/doc/top-level-namespace.html +1 -1
- data/knife-github.gemspec +5 -5
- data/lib/chef/knife/github_base.rb +49 -28
- data/lib/chef/knife/github_cleanup.rb +4 -4
- data/lib/chef/knife/github_clone.rb +13 -11
- data/lib/chef/knife/github_config.rb +11 -0
- data/lib/chef/knife/github_create.rb +236 -0
- data/lib/chef/knife/github_deploy.rb +20 -39
- data/lib/chef/knife/github_diff.rb +3 -3
- data/lib/chef/knife/github_pin.rb +138 -0
- data/lib/knife-github/version.rb +1 -1
- metadata +27 -5
data/doc/Chef.html
CHANGED
@@ -123,7 +123,7 @@
|
|
123
123
|
</div>
|
124
124
|
|
125
125
|
<div id="footer">
|
126
|
-
Generated on Wed Oct 30
|
126
|
+
Generated on Wed Oct 30 21:59:25 2013 by
|
127
127
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
128
128
|
0.8.7.2 (ruby-1.9.3).
|
129
129
|
</div>
|
data/doc/Chef/Knife.html
CHANGED
@@ -129,7 +129,7 @@
|
|
129
129
|
</div>
|
130
130
|
|
131
131
|
<div id="footer">
|
132
|
-
Generated on Wed Oct 30
|
132
|
+
Generated on Wed Oct 30 21:59:25 2013 by
|
133
133
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
134
134
|
0.8.7.2 (ruby-1.9.3).
|
135
135
|
</div>
|
@@ -529,10 +529,10 @@
|
|
529
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'>"</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'>"</span></span>
|
530
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'>"</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'>"</span></span>
|
531
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'>"</span><span class='tstring_content'>
|
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'>"</span><span class='tstring_content'>
|
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'>"</span><span class='tstring_content'>
|
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'>"</span><span class='tstring_content'>
|
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'>"</span><span class='tstring_content'>gem_local_version : </span><span class='tstring_end'>"</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'>"</span><span class='tstring_content'>gem_repo_version : </span><span class='tstring_end'>"</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'>"</span><span class='tstring_content'>gem_downloads : </span><span class='tstring_end'>"</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'>"</span><span class='tstring_content'>gem_total_downloads : </span><span class='tstring_end'>"</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
536
|
|
537
537
|
<span class='kw'>rescue</span>
|
538
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'>"</span><span class='tstring_content'>INFO: Cannot verify gem version information from rubygems.org</span><span class='tstring_end'>"</span></span>
|
@@ -775,7 +775,7 @@
|
|
775
775
|
</div>
|
776
776
|
|
777
777
|
<div id="footer">
|
778
|
-
Generated on Wed Oct 30
|
778
|
+
Generated on Wed Oct 30 21:59:25 2013 by
|
779
779
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
780
780
|
0.8.7.2 (ruby-1.9.3).
|
781
781
|
</div>
|
@@ -218,7 +218,10 @@
|
|
218
218
|
96
|
219
219
|
97
|
220
220
|
98
|
221
|
-
99
|
221
|
+
99
|
222
|
+
100
|
223
|
+
101
|
224
|
+
102</pre>
|
222
225
|
</td>
|
223
226
|
<td>
|
224
227
|
<pre class="code"><span class="info file"># File 'lib/chef/knife/github_baselist.rb', line 26</span>
|
@@ -257,10 +260,13 @@
|
|
257
260
|
<span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:fields</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</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='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_n'>n</span><span class='op'>|</span> <span class='id identifier rubyid_object_list'>object_list</span> <span class='op'><<</span> <span class='lparen'>(</span><span class='lparen'>(</span><span class='id identifier rubyid_v'>v</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_n'>n</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span><span class='rbracket'>]</span><span class='rparen'>)</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'>n/a</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
258
261
|
<span class='kw'>else</span>
|
259
262
|
<span class='id identifier rubyid_color'>color</span> <span class='op'>=</span> <span class='symbol'>:white</span>
|
260
|
-
<span class='kw'>if</span> <span class='
|
263
|
+
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_match'>match</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='op'>&&</span> <span class='op'>!</span><span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:all</span><span class='rbracket'>]</span>
|
261
264
|
<span class='id identifier rubyid_matches'>matches</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='semicolon'>;</span> <span class='id identifier rubyid_match'>match</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_m'>m</span><span class='op'>|</span> <span class='id identifier rubyid_matches'>matches</span> <span class='op'><<</span> <span class='id identifier rubyid_v'>v</span><span class='lbracket'>[</span><span class='id identifier rubyid_m'>m</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='rbrace'>}</span>
|
262
|
-
<span class='kw'>
|
263
|
-
|
265
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_matches'>matches</span><span class='period'>.</span><span class='id identifier rubyid_uniq'>uniq</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'>==</span> <span class='int'>1</span>
|
266
|
+
<span class='kw'>next</span> <span class='kw'>if</span> <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:mismatch</span><span class='rbracket'>]</span>
|
267
|
+
<span class='kw'>else</span>
|
268
|
+
<span class='id identifier rubyid_color'>color</span> <span class='op'>=</span> <span class='symbol'>:yellow</span>
|
269
|
+
<span class='kw'>end</span>
|
264
270
|
<span class='kw'>end</span>
|
265
271
|
<span class='id identifier rubyid_columns'>columns</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_c'>c</span><span class='op'>|</span> <span class='id identifier rubyid_r'>r</span> <span class='op'>=</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</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='rparen'>)</span><span class='semicolon'>;</span> <span class='id identifier rubyid_object_list'>object_list</span> <span class='op'><<</span> <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_color'>color</span><span class='lparen'>(</span><span class='lparen'>(</span><span class='id identifier rubyid_v'>v</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='comma'>,</span> <span class='id identifier rubyid_color'>color</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>n/a</span><span class='tstring_end'>'</span></span> <span class='rbrace'>}</span>
|
266
272
|
<span class='kw'>end</span>
|
@@ -307,7 +313,7 @@
|
|
307
313
|
</div>
|
308
314
|
|
309
315
|
<div id="footer">
|
310
|
-
Generated on Wed Oct 30
|
316
|
+
Generated on Wed Oct 30 21:59:25 2013 by
|
311
317
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
312
318
|
0.8.7.2 (ruby-1.9.3).
|
313
319
|
</div>
|
@@ -332,7 +332,7 @@
|
|
332
332
|
</div>
|
333
333
|
|
334
334
|
<div id="footer">
|
335
|
-
Generated on Wed Oct 30
|
335
|
+
Generated on Wed Oct 30 21:59:25 2013 by
|
336
336
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
337
337
|
0.8.7.2 (ruby-1.9.3).
|
338
338
|
</div>
|
@@ -168,6 +168,7 @@
|
|
168
168
|
<pre class="lines">
|
169
169
|
|
170
170
|
|
171
|
+
41
|
171
172
|
42
|
172
173
|
43
|
173
174
|
44
|
@@ -220,11 +221,10 @@
|
|
220
221
|
91
|
221
222
|
92
|
222
223
|
93
|
223
|
-
94
|
224
|
-
95</pre>
|
224
|
+
94</pre>
|
225
225
|
</td>
|
226
226
|
<td>
|
227
|
-
<pre class="code"><span class="info file"># File 'lib/chef/knife/github_compare.rb', line
|
227
|
+
<pre class="code"><span class="info file"># File 'lib/chef/knife/github_compare.rb', line 41</span>
|
228
228
|
|
229
229
|
<span class='kw'>def</span> <span class='id identifier rubyid_run'>run</span>
|
230
230
|
<span class='comment'># validate base options from base module.
|
@@ -255,8 +255,8 @@
|
|
255
255
|
<span class='rbrace'>}</span>
|
256
256
|
<span class='kw'>else</span>
|
257
257
|
<span class='id identifier rubyid_cookbooks'>cookbooks</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_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
|
258
|
-
<span class='id identifier rubyid_get_all_repos'>get_all_repos</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_get_all_repos'>get_all_repos</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='id identifier rubyid_git_link'>git_link</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='id identifier rubyid_gh_url'>gh_url</span> <span class='op'>=</span> <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_color'>color</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>
|
259
|
-
<span class='id identifier rubyid_get_all_repos'>get_all_repos</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_get_all_repos'>get_all_repos</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</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='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='id identifier rubyid_gh_tag'>gh_tag</span> <span class='op'>=</span> <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_color'>color</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>
|
258
|
+
<span class='id identifier rubyid_get_all_repos'>get_all_repos</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_get_all_repos'>get_all_repos</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='id identifier rubyid_git_link'>git_link</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='id identifier rubyid_gh_url'>gh_url</span> <span class='op'>=</span> <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_color'>color</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Cannot find cookbook!</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='symbol'>:red</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_gh_url'>gh_url</span> <span class='op'>=</span> <span class='id identifier rubyid_get_all_repos'>get_all_repos</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='id identifier rubyid_git_link'>git_link</span><span class='rbracket'>]</span>
|
259
|
+
<span class='id identifier rubyid_get_all_repos'>get_all_repos</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_get_all_repos'>get_all_repos</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</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='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_get_all_repos'>get_all_repos</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</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='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='op'>?</span> <span class='id identifier rubyid_gh_tag'>gh_tag</span> <span class='op'>=</span> <span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_color'>color</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>No tags!</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='symbol'>:red</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_gh_tag'>gh_tag</span> <span class='op'>=</span> <span class='id identifier rubyid_get_all_repos'>get_all_repos</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</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>
|
260
260
|
<span class='id identifier rubyid_all_repos'>all_repos</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>name</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>latest_cb_tag</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_v'>v</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>versions</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</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='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>git_url</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_gh_url'>gh_url</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>latest_gh_tag</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_gh_tag'>gh_tag</span> <span class='rbrace'>}</span>
|
261
261
|
<span class='rbrace'>}</span>
|
262
262
|
<span class='kw'>end</span>
|
@@ -270,7 +270,7 @@
|
|
270
270
|
<span class='id identifier rubyid_repos'>repos</span> <span class='op'>=</span> <span class='id identifier rubyid_all_repos'>all_repos</span>
|
271
271
|
<span class='kw'>end</span>
|
272
272
|
|
273
|
-
<span class='id identifier rubyid_columns'>columns</span> <span class='op'>=</span> <span class='lbracket'>[</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>name,
|
273
|
+
<span class='id identifier rubyid_columns'>columns</span> <span class='op'>=</span> <span class='lbracket'>[</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>name,Chef Store</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>latest_cb_tag,Tag</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>git_url,Github Store</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>latest_gh_tag,Tag</span><span class='tstring_end'>'</span></span> <span class='rbracket'>]</span>
|
274
274
|
<span class='id identifier rubyid_match'>match</span> <span class='op'>=</span> <span class='lbracket'>[</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>latest_cb_tag</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>latest_gh_tag</span><span class='tstring_end'>'</span></span> <span class='rbracket'>]</span>
|
275
275
|
|
276
276
|
<span class='kw'>if</span> <span class='id identifier rubyid_repos'>repos</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_repos'>repos</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
@@ -290,7 +290,7 @@
|
|
290
290
|
</div>
|
291
291
|
|
292
292
|
<div id="footer">
|
293
|
-
Generated on Wed Oct 30
|
293
|
+
Generated on Wed Oct 30 21:59:26 2013 by
|
294
294
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
295
295
|
0.8.7.2 (ruby-1.9.3).
|
296
296
|
</div>
|
@@ -107,10 +107,10 @@
|
|
107
107
|
<p>Implements the knife github deploy function</p>
|
108
108
|
<table class="rdoc-list"><tr><td class="rdoc-term"><p>@author</p></td>
|
109
109
|
<td>
|
110
|
-
<p>
|
110
|
+
<p>Ian Southam (<isoutham@schubergphilis.com>)</p>
|
111
111
|
</td></tr><tr><td class="rdoc-term"><p>Copyright</p></td>
|
112
112
|
<td>
|
113
|
-
<p>Copyright (c) 2013
|
113
|
+
<p>Copyright (c) 2013 Ian Southam.</p>
|
114
114
|
</td></tr></table>
|
115
115
|
|
116
116
|
<p>This code is specific to our company workflow</p>
|
@@ -608,7 +608,7 @@ increment the version</p>
|
|
608
608
|
<span class='kw'>def</span> <span class='id identifier rubyid_choose_version'>choose_version</span><span class='lparen'>(</span><span class='id identifier rubyid_version'>version</span><span class='rparen'>)</span>
|
609
609
|
<span class='kw'>if</span> <span class='id identifier rubyid_version'>version</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>
|
610
610
|
<span class='id identifier rubyid_major'>major</span> <span class='op'>=</span> <span class='backref'>$1</span>
|
611
|
-
<span class='id identifier rubyid_minor'>minor</span> <span class='op'>=</span> <span class='backref'>$
|
611
|
+
<span class='id identifier rubyid_minor'>minor</span> <span class='op'>=</span> <span class='backref'>$2</span>
|
612
612
|
<span class='id identifier rubyid_patch'>patch</span> <span class='op'>=</span> <span class='backref'>$3</span>
|
613
613
|
<span class='id identifier rubyid_major'>major</span> <span class='op'>=</span> <span class='id identifier rubyid_major'>major</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='op'>+</span> <span class='int'>1</span> <span class='kw'>if</span> <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:major</span><span class='rbracket'>]</span>
|
614
614
|
<span class='id identifier rubyid_minor'>minor</span> <span class='op'>=</span> <span class='id identifier rubyid_minor'>minor</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='op'>+</span> <span class='int'>1</span> <span class='kw'>if</span> <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:minor</span><span class='rbracket'>]</span>
|
@@ -1440,7 +1440,7 @@ the user chooses not to increment the version</p>
|
|
1440
1440
|
</div>
|
1441
1441
|
|
1442
1442
|
<div id="footer">
|
1443
|
-
Generated on Wed Oct 30
|
1443
|
+
Generated on Wed Oct 30 21:59:25 2013 by
|
1444
1444
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1445
1445
|
0.8.7.2 (ruby-1.9.3).
|
1446
1446
|
</div>
|
@@ -212,11 +212,6 @@
|
|
212
212
|
<pre class="lines">
|
213
213
|
|
214
214
|
|
215
|
-
105
|
216
|
-
106
|
217
|
-
107
|
218
|
-
108
|
219
|
-
109
|
220
215
|
110
|
221
216
|
111
|
222
217
|
112
|
@@ -237,10 +232,15 @@
|
|
237
232
|
127
|
238
233
|
128
|
239
234
|
129
|
240
|
-
130
|
235
|
+
130
|
236
|
+
131
|
237
|
+
132
|
238
|
+
133
|
239
|
+
134
|
240
|
+
135</pre>
|
241
241
|
</td>
|
242
242
|
<td>
|
243
|
-
<pre class="code"><span class="info file"># File 'lib/chef/knife/github_diff.rb', line
|
243
|
+
<pre class="code"><span class="info file"># File 'lib/chef/knife/github_diff.rb', line 110</span>
|
244
244
|
|
245
245
|
<span class='kw'>def</span> <span class='id identifier rubyid_do_diff'>do_diff</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_version'>version</span><span class='rparen'>)</span>
|
246
246
|
<span class='comment'># Check to see if there is a tag matching the version
|
@@ -288,11 +288,6 @@
|
|
288
288
|
<pre class="lines">
|
289
289
|
|
290
290
|
|
291
|
-
132
|
292
|
-
133
|
293
|
-
134
|
294
|
-
135
|
295
|
-
136
|
296
291
|
137
|
297
292
|
138
|
298
293
|
139
|
@@ -303,10 +298,15 @@
|
|
303
298
|
144
|
304
299
|
145
|
305
300
|
146
|
306
|
-
147
|
301
|
+
147
|
302
|
+
148
|
303
|
+
149
|
304
|
+
150
|
305
|
+
151
|
306
|
+
152</pre>
|
307
307
|
</td>
|
308
308
|
<td>
|
309
|
-
<pre class="code"><span class="info file"># File 'lib/chef/knife/github_diff.rb', line
|
309
|
+
<pre class="code"><span class="info file"># File 'lib/chef/knife/github_diff.rb', line 137</span>
|
310
310
|
|
311
311
|
<span class='kw'>def</span> <span class='id identifier rubyid_get_cookbook_copy'>get_cookbook_copy</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_version'>version</span><span class='rparen'>)</span>
|
312
312
|
<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'>"</span><span class='embexpr_beg'>#{</span><span class='ivar'>@github_tmp</span><span class='rbrace'>}</span><span class='tstring_content'>/cb</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
@@ -396,7 +396,12 @@
|
|
396
396
|
100
|
397
397
|
101
|
398
398
|
102
|
399
|
-
103
|
399
|
+
103
|
400
|
+
104
|
401
|
+
105
|
402
|
+
106
|
403
|
+
107
|
404
|
+
108</pre>
|
400
405
|
</td>
|
401
406
|
<td>
|
402
407
|
<pre class="code"><span class="info file"># File 'lib/chef/knife/github_diff.rb', line 51</span>
|
@@ -442,6 +447,11 @@
|
|
442
447
|
<span class='id identifier rubyid_get_clone'>get_clone</span><span class='lparen'>(</span><span class='id identifier rubyid_github_link'>github_link</span><span class='comma'>,</span> <span class='ivar'>@cookbook_name</span><span class='rparen'>)</span>
|
443
448
|
<span class='kw'>else</span> <span class='comment'># Copy downloaded version to #{@github_tmp}/git
|
444
449
|
</span> <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>
|
450
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_cpath'>cpath</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
451
|
+
<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'>"</span><span class='tstring_content'>Cannot find any local repository with the name: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@cookbook_name</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
452
|
+
<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'>"</span><span class='tstring_content'>Please use the option -g if you want to diff the github repository</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
453
|
+
<span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span>
|
454
|
+
<span class='kw'>end</span>
|
445
455
|
<span class='id identifier rubyid_tpath'>tpath</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</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'>"</span></span>
|
446
456
|
<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_tpath'>tpath</span><span class='rparen'>)</span>
|
447
457
|
<span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_makedirs'>makedirs</span><span class='lparen'>(</span><span class='id identifier rubyid_tpath'>tpath</span><span class='rparen'>)</span>
|
@@ -464,7 +474,7 @@
|
|
464
474
|
</div>
|
465
475
|
|
466
476
|
<div id="footer">
|
467
|
-
Generated on Wed Oct 30
|
477
|
+
Generated on Wed Oct 30 21:59:25 2013 by
|
468
478
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
469
479
|
0.8.7.2 (ruby-1.9.3).
|
470
480
|
</div>
|
@@ -271,7 +271,7 @@
|
|
271
271
|
<span class='id identifier rubyid_repos'>repos</span> <span class='op'>=</span> <span class='id identifier rubyid_all_repos'>all_repos</span>
|
272
272
|
<span class='kw'>end</span>
|
273
273
|
|
274
|
-
<span class='id identifier rubyid_columns'>columns</span> <span class='op'>=</span> <span class='lbracket'>[</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>name,
|
274
|
+
<span class='id identifier rubyid_columns'>columns</span> <span class='op'>=</span> <span class='lbracket'>[</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>name,Chef Store</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>git_url,Github Store</span><span class='tstring_end'>'</span></span> <span class='rbracket'>]</span>
|
275
275
|
|
276
276
|
<span class='kw'>if</span> <span class='id identifier rubyid_repos'>repos</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_repos'>repos</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
277
277
|
<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'>"</span><span class='tstring_content'>No repositories found.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
@@ -290,7 +290,7 @@
|
|
290
290
|
</div>
|
291
291
|
|
292
292
|
<div id="footer">
|
293
|
-
Generated on Wed Oct 30
|
293
|
+
Generated on Wed Oct 30 21:59:25 2013 by
|
294
294
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
295
295
|
0.8.7.2 (ruby-1.9.3).
|
296
296
|
</div>
|
data/doc/KnifeGithubCleanup.html
CHANGED
@@ -106,7 +106,7 @@
|
|
106
106
|
</div>
|
107
107
|
|
108
108
|
<div id="footer">
|
109
|
-
Generated on Wed Oct 30
|
109
|
+
Generated on Wed Oct 30 21:59:25 2013 by
|
110
110
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
111
111
|
0.8.7.2 (ruby-1.9.3).
|
112
112
|
</div>
|
@@ -416,7 +416,7 @@
|
|
416
416
|
</div>
|
417
417
|
|
418
418
|
<div id="footer">
|
419
|
-
Generated on Wed Oct 30
|
419
|
+
Generated on Wed Oct 30 21:59:26 2013 by
|
420
420
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
421
421
|
0.8.7.2 (ruby-1.9.3).
|
422
422
|
</div>
|
data/doc/KnifeGithubSearch.html
CHANGED
@@ -106,7 +106,7 @@
|
|
106
106
|
</div>
|
107
107
|
|
108
108
|
<div id="footer">
|
109
|
-
Generated on Wed Oct 30
|
109
|
+
Generated on Wed Oct 30 21:59:25 2013 by
|
110
110
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
111
111
|
0.8.7.2 (ruby-1.9.3).
|
112
112
|
</div>
|
@@ -316,7 +316,7 @@
|
|
316
316
|
</div>
|
317
317
|
|
318
318
|
<div id="footer">
|
319
|
-
Generated on Wed Oct 30
|
319
|
+
Generated on Wed Oct 30 21:59:25 2013 by
|
320
320
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
321
321
|
0.8.7.2 (ruby-1.9.3).
|
322
322
|
</div>
|
data/doc/_index.html
CHANGED
@@ -197,7 +197,7 @@
|
|
197
197
|
</div>
|
198
198
|
|
199
199
|
<div id="footer">
|
200
|
-
Generated on Wed Oct 30
|
200
|
+
Generated on Wed Oct 30 21:59:25 2013 by
|
201
201
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
202
202
|
0.8.7.2 (ruby-1.9.3).
|
203
203
|
</div>
|
data/doc/file.README.html
CHANGED
@@ -109,7 +109,7 @@ But in case of any problems, the cache files can be safely deleted.</p>
|
|
109
109
|
</div></div>
|
110
110
|
|
111
111
|
<div id="footer">
|
112
|
-
Generated on Wed Oct 30
|
112
|
+
Generated on Wed Oct 30 21:59:25 2013 by
|
113
113
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
114
114
|
0.8.7.2 (ruby-1.9.3).
|
115
115
|
</div>
|
data/doc/index.html
CHANGED
@@ -109,7 +109,7 @@ But in case of any problems, the cache files can be safely deleted.</p>
|
|
109
109
|
</div></div>
|
110
110
|
|
111
111
|
<div id="footer">
|
112
|
-
Generated on Wed Oct 30
|
112
|
+
Generated on Wed Oct 30 21:59:25 2013 by
|
113
113
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
114
114
|
0.8.7.2 (ruby-1.9.3).
|
115
115
|
</div>
|
@@ -105,7 +105,7 @@
|
|
105
105
|
</div>
|
106
106
|
|
107
107
|
<div id="footer">
|
108
|
-
Generated on Wed Oct 30
|
108
|
+
Generated on Wed Oct 30 21:59:25 2013 by
|
109
109
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
110
110
|
0.8.7.2 (ruby-1.9.3).
|
111
111
|
</div>
|
data/knife-github.gemspec
CHANGED
@@ -8,16 +8,16 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.has_rdoc = false
|
10
10
|
s.extra_rdoc_files = ["LICENSE" ]
|
11
|
-
s.authors = ["Sander Botman"]
|
12
|
-
s.email = ["sbotman@schubergphilis.com"]
|
11
|
+
s.authors = ["Sander Botman", "Ian Southam"]
|
12
|
+
s.email = ["sbotman@schubergphilis.com", "isoutham@schubergphilis.com"]
|
13
13
|
s.homepage = "https://github.com/schubergphilis/knife-github"
|
14
|
-
s.summary = %q{Github interaction support for
|
14
|
+
s.summary = %q{Github interaction support for chef's knife cli tool}
|
15
15
|
s.description = s.summary
|
16
16
|
s.files = `git ls-files`.split("\n")
|
17
17
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
19
|
s.require_paths = ["lib"]
|
20
|
-
|
20
|
+
s.license = 'Apache 2.0'
|
21
21
|
s.add_dependency "mixlib-versioning", ">= 1.0.0"
|
22
|
-
|
22
|
+
s.add_dependency "chef", ">= 10.0.0"
|
23
23
|
end
|
@@ -29,6 +29,7 @@ class Chef
|
|
29
29
|
deps do
|
30
30
|
require 'chef/mixin/shell_out'
|
31
31
|
require 'mixlib/versioning'
|
32
|
+
require 'chef/knife/github_config'
|
32
33
|
end
|
33
34
|
|
34
35
|
option :github_url,
|
@@ -116,7 +117,17 @@ class Chef
|
|
116
117
|
|
117
118
|
def locate_config_value(key)
|
118
119
|
key = key.to_sym
|
119
|
-
|
120
|
+
central_config = "/etc/githubrc.rb"
|
121
|
+
if File.exists?(central_config)
|
122
|
+
begin
|
123
|
+
Github::Config.from_file(central_config)
|
124
|
+
rescue
|
125
|
+
Chef::Log.error("Something is wrong within your central config file: #{central_config}")
|
126
|
+
Chef::Log.error("You will need to fix or remove this file to continue!")
|
127
|
+
exit 1
|
128
|
+
end
|
129
|
+
end
|
130
|
+
config[key] || Chef::Config[:knife][key] || Github::Config[key]
|
120
131
|
end
|
121
132
|
|
122
133
|
def get_repo_clone_link
|
@@ -189,6 +200,8 @@ class Chef
|
|
189
200
|
end
|
190
201
|
|
191
202
|
def get_repos_github(org)
|
203
|
+
# Get all repo's from cache file
|
204
|
+
|
192
205
|
# Get all repo's for the org from github
|
193
206
|
arr = []
|
194
207
|
page = 1
|
@@ -197,25 +210,25 @@ class Chef
|
|
197
210
|
params = {'response' => 'json', 'page' => page }
|
198
211
|
result = send_request(url, params)
|
199
212
|
break if result.nil? || result.count < 1
|
200
|
-
result.each { |key|
|
201
|
-
if key['tags_url']
|
202
|
-
tags = get_tags(key)
|
203
|
-
key['tags'] = tags unless tags.nil? || tags.empty?
|
204
|
-
key['latest_tag'] = get_latest_tag(tags)
|
205
|
-
arr << key
|
206
|
-
else
|
207
|
-
arr << key
|
208
|
-
end
|
209
|
-
}
|
213
|
+
result.each { |key| arr << key }
|
210
214
|
page = page + 1
|
211
215
|
end
|
216
|
+
# WE WILL REMOVE THIS, GETTING TAGS FOR EVERY REPO IS VERY SLOW!
|
217
|
+
# if key['tags_url']
|
218
|
+
# tags = get_tags(key)
|
219
|
+
# key['tags'] = tags unless tags.nil? || tags.empty?
|
220
|
+
# key['latest_tag'] = get_latest_tag(tags)
|
221
|
+
# arr << key
|
222
|
+
# else
|
223
|
+
# arr << key
|
224
|
+
# end
|
225
|
+
#}
|
212
226
|
arr
|
213
227
|
end
|
214
228
|
|
215
229
|
def get_tags(repo)
|
216
230
|
params = {'response' => 'json'}
|
217
|
-
|
218
|
-
tags
|
231
|
+
send_request(repo['tags_url'], params)
|
219
232
|
end
|
220
233
|
|
221
234
|
def get_latest_tag(tags)
|
@@ -291,8 +304,8 @@ class Chef
|
|
291
304
|
end
|
292
305
|
|
293
306
|
def add_tag(version)
|
294
|
-
|
295
|
-
Dir.chdir(
|
307
|
+
cookbook_path = get_cookbook_path(@cookbook_name)
|
308
|
+
Dir.chdir(cookbook_path)
|
296
309
|
Chef::Log.debug "Adding tag"
|
297
310
|
output = `git tag -a "#{version}" -m "Added tag #{version}" 2>&1`
|
298
311
|
if $?.exitstatus != 0
|
@@ -302,31 +315,39 @@ class Chef
|
|
302
315
|
end
|
303
316
|
end
|
304
317
|
|
305
|
-
def
|
318
|
+
def get_cookbook_path(cookbook_name)
|
306
319
|
cookbook_path = config[:cookbook_path] || Chef::Config[:cookbook_path]
|
307
320
|
if cookbook_path.nil? || cookbook_path.empty?
|
308
321
|
Chef::Log.error("Please specify a cookbook path")
|
309
322
|
exit 1
|
310
323
|
end
|
311
324
|
|
325
|
+
cookbook_path = [ cookbook_path ] if cookbook_path.is_a?(String)
|
326
|
+
|
312
327
|
unless File.exists?(cookbook_path.first) && File.directory?(cookbook_path.first)
|
313
328
|
Chef::Log.error("Cannot find the directory: #{cookbook_path.first}")
|
314
329
|
exit 1
|
315
330
|
end
|
316
331
|
|
317
332
|
cookbook_path = File.join(cookbook_path.first,cookbook_name)
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
333
|
+
end
|
334
|
+
|
335
|
+
# Get the version number in the git version of the cookbook
|
336
|
+
# @param version [String] Version
|
337
|
+
def get_cookbook_version()
|
338
|
+
version = nil
|
339
|
+
cookbook_path = get_cookbook_path(@cookbook_name)
|
340
|
+
File.foreach("#{cookbook_path}/metadata.rb") do |line|
|
341
|
+
if line =~ /version.*['"](.*)['"]/i
|
342
|
+
version = $1
|
343
|
+
break
|
344
|
+
end
|
345
|
+
end
|
346
|
+
if version.nil?
|
347
|
+
Chef::Log.error("Cannot get the version for cookbook #{@cookbook_name}")
|
348
|
+
exit 1
|
349
|
+
end
|
350
|
+
version
|
330
351
|
end
|
331
352
|
|
332
353
|
end
|