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.
- data/.gitignore +1 -0
- data/.yardopts +1 -0
- data/LICENSE +201 -201
- data/Rakefile +5 -0
- data/doc/Chef.html +132 -0
- data/doc/Chef/Knife.html +138 -0
- data/doc/Chef/Knife/GithubBase.html +784 -0
- data/doc/Chef/Knife/GithubBaseList.html +316 -0
- data/doc/Chef/Knife/GithubClone.html +341 -0
- data/doc/Chef/Knife/GithubCompare.html +299 -0
- data/doc/Chef/Knife/GithubDeploy.html +1449 -0
- data/doc/Chef/Knife/GithubDiff.html +473 -0
- data/doc/Chef/Knife/GithubList.html +299 -0
- data/doc/KnifeGithubCleanup.html +115 -0
- data/doc/KnifeGithubCleanup/GithubCleanup.html +425 -0
- data/doc/KnifeGithubSearch.html +115 -0
- data/doc/KnifeGithubSearch/GithubSearch.html +325 -0
- data/doc/_index.html +206 -0
- data/doc/class_list.html +54 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +338 -0
- data/doc/file.README.html +118 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +118 -0
- data/doc/js/app.js +214 -0
- data/doc/js/full_list.js +178 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +197 -0
- data/doc/top-level-namespace.html +114 -0
- data/lib/chef/knife/github_base.rb +4 -4
- data/lib/chef/knife/github_baselist.rb +6 -3
- data/lib/chef/knife/github_cleanup.rb +1 -1
- data/lib/chef/knife/{github_download.rb → github_clone.rb} +8 -8
- data/lib/chef/knife/github_compare.rb +3 -4
- data/lib/chef/knife/github_deploy.rb +89 -67
- data/lib/chef/knife/github_diff.rb +50 -20
- data/lib/chef/knife/github_list.rb +1 -1
- data/lib/knife-github/version.rb +1 -1
- metadata +32 -3
@@ -0,0 +1,299 @@
|
|
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::GithubCompare
|
8
|
+
|
9
|
+
— 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> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../../Chef.html" title="Chef (class)">Chef</a></span></span> » <span class='title'><span class='object_link'><a href="../Knife.html" title="Chef::Knife (class)">Knife</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">GithubCompare</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::GithubCompare
|
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"><span class='object_link'><a href="../Knife.html" title="Chef::Knife (class)">Chef::Knife</a></span></span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next"><span class='object_link'><a href="../Knife.html" title="Chef::Knife (class)">Chef::Knife</a></span></li>
|
82
|
+
|
83
|
+
<li class="next">Chef::Knife::GithubCompare</li>
|
84
|
+
|
85
|
+
</ul>
|
86
|
+
<a href="#" class="inheritanceTree">show all</a>
|
87
|
+
|
88
|
+
</dd>
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
<dt class="r2 last">Defined in:</dt>
|
99
|
+
<dd class="r2 last">lib/chef/knife/github_compare.rb</dd>
|
100
|
+
|
101
|
+
</dl>
|
102
|
+
<div class="clear"></div>
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
<h2>
|
113
|
+
Instance Method Summary
|
114
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
115
|
+
</h2>
|
116
|
+
|
117
|
+
<ul class="summary">
|
118
|
+
|
119
|
+
<li class="public ">
|
120
|
+
<span class="summary_signature">
|
121
|
+
|
122
|
+
<a href="#run-instance_method" title="#run (instance method)">- (Object) <strong>run</strong> </a>
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
</span>
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
137
|
+
|
138
|
+
</li>
|
139
|
+
|
140
|
+
|
141
|
+
</ul>
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
<div id="instance_method_details" class="method_details_list">
|
153
|
+
<h2>Instance Method Details</h2>
|
154
|
+
|
155
|
+
|
156
|
+
<div class="method_details first">
|
157
|
+
<h3 class="signature first" id="run-instance_method">
|
158
|
+
|
159
|
+
- (<tt>Object</tt>) <strong>run</strong>
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
</h3><table class="source_code">
|
166
|
+
<tr>
|
167
|
+
<td>
|
168
|
+
<pre class="lines">
|
169
|
+
|
170
|
+
|
171
|
+
42
|
172
|
+
43
|
173
|
+
44
|
174
|
+
45
|
175
|
+
46
|
176
|
+
47
|
177
|
+
48
|
178
|
+
49
|
179
|
+
50
|
180
|
+
51
|
181
|
+
52
|
182
|
+
53
|
183
|
+
54
|
184
|
+
55
|
185
|
+
56
|
186
|
+
57
|
187
|
+
58
|
188
|
+
59
|
189
|
+
60
|
190
|
+
61
|
191
|
+
62
|
192
|
+
63
|
193
|
+
64
|
194
|
+
65
|
195
|
+
66
|
196
|
+
67
|
197
|
+
68
|
198
|
+
69
|
199
|
+
70
|
200
|
+
71
|
201
|
+
72
|
202
|
+
73
|
203
|
+
74
|
204
|
+
75
|
205
|
+
76
|
206
|
+
77
|
207
|
+
78
|
208
|
+
79
|
209
|
+
80
|
210
|
+
81
|
211
|
+
82
|
212
|
+
83
|
213
|
+
84
|
214
|
+
85
|
215
|
+
86
|
216
|
+
87
|
217
|
+
88
|
218
|
+
89
|
219
|
+
90
|
220
|
+
91
|
221
|
+
92
|
222
|
+
93
|
223
|
+
94
|
224
|
+
95</pre>
|
225
|
+
</td>
|
226
|
+
<td>
|
227
|
+
<pre class="code"><span class="info file"># File 'lib/chef/knife/github_compare.rb', line 42</span>
|
228
|
+
|
229
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_run'>run</span>
|
230
|
+
<span class='comment'># validate base options from base module.
|
231
|
+
</span> <span class='id identifier rubyid_validate_base_options'>validate_base_options</span>
|
232
|
+
|
233
|
+
<span class='comment'># Display information if debug mode is on.
|
234
|
+
</span> <span class='id identifier rubyid_display_debug_info'>display_debug_info</span>
|
235
|
+
|
236
|
+
<span class='comment'># Gather all repo information from github.
|
237
|
+
</span> <span class='id identifier rubyid_get_all_repos'>get_all_repos</span> <span class='op'>=</span> <span class='id identifier rubyid_get_all_repos'>get_all_repos</span><span class='lparen'>(</span><span class='ivar'>@github_organizations</span><span class='period'>.</span><span class='id identifier rubyid_reverse'>reverse</span><span class='rparen'>)</span>
|
238
|
+
|
239
|
+
<span class='comment'># Get all chef cookbooks and versions.
|
240
|
+
</span> <span class='id identifier rubyid_cookbooks'>cookbooks</span> <span class='op'>=</span> <span class='id identifier rubyid_rest'>rest</span><span class='period'>.</span><span class='id identifier rubyid_get_rest'>get_rest</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/cookbooks?num_version=1</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
241
|
+
|
242
|
+
<span class='comment'>#Get the github link
|
243
|
+
</span> <span class='id identifier rubyid_git_link'>git_link</span> <span class='op'>=</span> <span class='id identifier rubyid_get_repo_clone_link'>get_repo_clone_link</span>
|
244
|
+
|
245
|
+
<span class='comment'># Filter all repo information based on the tags that we can find
|
246
|
+
</span> <span class='kw'>if</span> <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:fields</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:fieldlist</span><span class='rbracket'>]</span>
|
247
|
+
<span class='id identifier rubyid_all_repos'>all_repos</span> <span class='op'>=</span> <span class='id identifier rubyid_get_all_repos'>get_all_repos</span>
|
248
|
+
<span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:fields</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>name</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <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_nil?'>nil?</span> <span class='op'>||</span> <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_empty?'>empty?</span>
|
249
|
+
<span class='kw'>else</span>
|
250
|
+
<span class='id identifier rubyid_all_repos'>all_repos</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
251
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:all</span><span class='rbracket'>]</span>
|
252
|
+
<span class='id identifier rubyid_get_all_repos'>get_all_repos</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>
|
253
|
+
<span class='id identifier rubyid_cookbooks'>cookbooks</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_cookbooks'>cookbooks</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'>versions</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_version'>version</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span> <span class='op'>:</span> <span class='id identifier rubyid_version'>version</span> <span class='op'>=</span> <span class='id identifier rubyid_cookbooks'>cookbooks</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'>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>
|
254
|
+
<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_version'>version</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_v'>v</span><span class='lbracket'>[</span><span class='id identifier rubyid_git_link'>git_link</span><span class='rbracket'>]</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_v'>v</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='rbrace'>}</span>
|
255
|
+
<span class='rbrace'>}</span>
|
256
|
+
<span class='kw'>else</span>
|
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'>ERROR: 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_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'>ERROR: 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
|
+
<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
|
+
<span class='rbrace'>}</span>
|
262
|
+
<span class='kw'>end</span>
|
263
|
+
<span class='kw'>end</span>
|
264
|
+
|
265
|
+
<span class='comment'># Filter only on the cookbook name if its given on the command line
|
266
|
+
</span> <span class='ivar'>@cookbook_name</span> <span class='op'>=</span> <span class='id identifier rubyid_name_args'>name_args</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='kw'>unless</span> <span class='id identifier rubyid_name_args'>name_args</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
267
|
+
<span class='kw'>if</span> <span class='ivar'>@cookbook_name</span>
|
268
|
+
<span class='id identifier rubyid_repos'>repos</span> <span class='op'>=</span> <span class='id identifier rubyid_all_repos'>all_repos</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</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> <span class='id identifier rubyid_v'>v</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='ivar'>@cookbook_name</span> <span class='rbrace'>}</span>
|
269
|
+
<span class='kw'>else</span>
|
270
|
+
<span class='id identifier rubyid_repos'>repos</span> <span class='op'>=</span> <span class='id identifier rubyid_all_repos'>all_repos</span>
|
271
|
+
<span class='kw'>end</span>
|
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,Name</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,Link</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
|
+
<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
|
+
|
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
|
+
<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>
|
278
|
+
<span class='kw'>else</span>
|
279
|
+
<span class='id identifier rubyid_display_info'>display_info</span><span class='lparen'>(</span><span class='id identifier rubyid_repos'>repos</span><span class='comma'>,</span> <span class='id identifier rubyid_columns'>columns</span><span class='comma'>,</span> <span class='id identifier rubyid_match'>match</span><span class='rparen'>)</span>
|
280
|
+
<span class='kw'>end</span>
|
281
|
+
|
282
|
+
<span class='kw'>end</span></pre>
|
283
|
+
</td>
|
284
|
+
</tr>
|
285
|
+
</table>
|
286
|
+
</div>
|
287
|
+
|
288
|
+
</div>
|
289
|
+
|
290
|
+
</div>
|
291
|
+
|
292
|
+
<div id="footer">
|
293
|
+
Generated on Wed Oct 30 20:03:34 2013 by
|
294
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
295
|
+
0.8.7.2 (ruby-1.9.3).
|
296
|
+
</div>
|
297
|
+
|
298
|
+
</body>
|
299
|
+
</html>
|
@@ -0,0 +1,1449 @@
|
|
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::GithubDeploy
|
8
|
+
|
9
|
+
— 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> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../../Chef.html" title="Chef (class)">Chef</a></span></span> » <span class='title'><span class='object_link'><a href="../Knife.html" title="Chef::Knife (class)">Knife</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">GithubDeploy</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::GithubDeploy
|
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"><span class='object_link'><a href="../Knife.html" title="Chef::Knife (class)">Chef::Knife</a></span></span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next"><span class='object_link'><a href="../Knife.html" title="Chef::Knife (class)">Chef::Knife</a></span></li>
|
82
|
+
|
83
|
+
<li class="next">Chef::Knife::GithubDeploy</li>
|
84
|
+
|
85
|
+
</ul>
|
86
|
+
<a href="#" class="inheritanceTree">show all</a>
|
87
|
+
|
88
|
+
</dd>
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
<dt class="r2 last">Defined in:</dt>
|
99
|
+
<dd class="r2 last">lib/chef/knife/github_deploy.rb</dd>
|
100
|
+
|
101
|
+
</dl>
|
102
|
+
<div class="clear"></div>
|
103
|
+
|
104
|
+
<h2>Overview</h2><div class="docstring">
|
105
|
+
<div class="discussion">
|
106
|
+
|
107
|
+
<p>Implements the knife github deploy function</p>
|
108
|
+
<table class="rdoc-list"><tr><td class="rdoc-term"><p>@author</p></td>
|
109
|
+
<td>
|
110
|
+
<p>Sander Botman (<sbotman@schubergphilis.com>)</p>
|
111
|
+
</td></tr><tr><td class="rdoc-term"><p>Copyright</p></td>
|
112
|
+
<td>
|
113
|
+
<p>Copyright (c) 2013 Sander Botman.</p>
|
114
|
+
</td></tr></table>
|
115
|
+
|
116
|
+
<p>This code is specific to our company workflow</p>
|
117
|
+
|
118
|
+
<h2>Overview</h2>
|
119
|
+
|
120
|
+
<p>All modes presume you have used github download to download a cookbook or
|
121
|
+
are creating a new cookbook</p>
|
122
|
+
|
123
|
+
<h3>Examples</h3>
|
124
|
+
|
125
|
+
<p>Deploy a development version of cookbook to your chef server</p>
|
126
|
+
|
127
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_knife'>knife</span> <span class='id identifier rubyid_github'>github</span> <span class='id identifier rubyid_deploy'>deploy</span> <span class='id identifier rubyid_cookbook_name'>cookbook_name</span></code></pre>
|
128
|
+
|
129
|
+
<p>Deploy a release version of cookbook to your chef server</p>
|
130
|
+
|
131
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_knife'>knife</span> <span class='id identifier rubyid_github'>github</span> <span class='id identifier rubyid_deploy'>deploy</span> <span class='id identifier rubyid_cookbook_name'>cookbook_name</span> <span class='op'>-</span><span class='id identifier rubyid_f'>f</span></code></pre>
|
132
|
+
|
133
|
+
<h3>Options</h3>
|
134
|
+
|
135
|
+
<p>-f Operate in final release mode -p Update the patch component of the
|
136
|
+
version -m Update the minor component of the version -M Update the minor
|
137
|
+
component of the version</p>
|
138
|
+
|
139
|
+
<h2>Operation Modes</h2>
|
140
|
+
|
141
|
+
<p>Development (default)</p>
|
142
|
+
|
143
|
+
<p>This will take a cookbook name Do some basic version checks (if the current
|
144
|
+
cookbook is frozen) and upload it</p>
|
145
|
+
|
146
|
+
<p>If the cookbook is frozen it will force you to choose a new version and
|
147
|
+
update the metadata accordingly</p>
|
148
|
+
|
149
|
+
<p>Release (-f)</p>
|
150
|
+
|
151
|
+
<p>You will be forced to select a new version. You can choose via the options
|
152
|
+
whether to increment the Major/minor or patch revision numbers The version
|
153
|
+
will be tagged Uploaded to the Chef server and frozen</p>
|
154
|
+
|
155
|
+
<h2>Version numbers</h2>
|
156
|
+
|
157
|
+
<p>You can choose a specific version number by specifying it on the command
|
158
|
+
line.</p>
|
159
|
+
|
160
|
+
<p>If you do not specify a version, the version will be the version in your
|
161
|
+
cookbook's metadata</p>
|
162
|
+
|
163
|
+
<p>A warning is issued if the version is lower than the version in github</p>
|
164
|
+
|
165
|
+
|
166
|
+
</div>
|
167
|
+
</div>
|
168
|
+
<div class="tags">
|
169
|
+
|
170
|
+
|
171
|
+
</div>
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
<h2>
|
180
|
+
Instance Method Summary
|
181
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
182
|
+
</h2>
|
183
|
+
|
184
|
+
<ul class="summary">
|
185
|
+
|
186
|
+
<li class="public ">
|
187
|
+
<span class="summary_signature">
|
188
|
+
|
189
|
+
<a href="#checkout_tag-instance_method" title="#checkout_tag (instance method)">- (Object) <strong>checkout_tag</strong>(version) </a>
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
</span>
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
<span class="summary_desc"><div class='inline'>
|
204
|
+
<p>If a tag is available in github check it out Potentially quite dangerous as
|
205
|
+
it could cause code to get rolled back.</p>
|
206
|
+
</div></span>
|
207
|
+
|
208
|
+
</li>
|
209
|
+
|
210
|
+
|
211
|
+
<li class="public ">
|
212
|
+
<span class="summary_signature">
|
213
|
+
|
214
|
+
<a href="#choose_version-instance_method" title="#choose_version (instance method)">- (String) <strong>choose_version</strong>(version) </a>
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
</span>
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
<span class="summary_desc"><div class='inline'>
|
229
|
+
<p>Increment the current version according to the config options <a
|
230
|
+
href="http://major">config</a> <a href="http://minor">config</a> <a
|
231
|
+
href="http://patch">config</a> Method will exit if the user chooses not to
|
232
|
+
increment the version.</p>
|
233
|
+
</div></span>
|
234
|
+
|
235
|
+
</li>
|
236
|
+
|
237
|
+
|
238
|
+
<li class="public ">
|
239
|
+
<span class="summary_signature">
|
240
|
+
|
241
|
+
<a href="#cookbook_upload-instance_method" title="#cookbook_upload (instance method)">- (Object) <strong>cookbook_upload</strong> </a>
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
</span>
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
<span class="summary_desc"><div class='inline'>
|
256
|
+
<p>Upload the cookbook to chef server If mode is final, freeze the cookbook.</p>
|
257
|
+
</div></span>
|
258
|
+
|
259
|
+
</li>
|
260
|
+
|
261
|
+
|
262
|
+
<li class="public ">
|
263
|
+
<span class="summary_signature">
|
264
|
+
|
265
|
+
<a href="#do_commit-instance_method" title="#do_commit (instance method)">- (Object) <strong>do_commit</strong>(version, push) </a>
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
</span>
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
<span class="summary_desc"><div class='inline'>
|
280
|
+
<p>Commit changes in git.</p>
|
281
|
+
</div></span>
|
282
|
+
|
283
|
+
</li>
|
284
|
+
|
285
|
+
|
286
|
+
<li class="public ">
|
287
|
+
<span class="summary_signature">
|
288
|
+
|
289
|
+
<a href="#get_cookbook_chef_versions-instance_method" title="#get_cookbook_chef_versions (instance method)">- (Object) <strong>get_cookbook_chef_versions</strong> </a>
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
</span>
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
<span class="summary_desc"><div class='inline'>
|
304
|
+
<p>Get a sorted array of version for the cookbook.</p>
|
305
|
+
</div></span>
|
306
|
+
|
307
|
+
</li>
|
308
|
+
|
309
|
+
|
310
|
+
<li class="public ">
|
311
|
+
<span class="summary_signature">
|
312
|
+
|
313
|
+
<a href="#get_cookbook_path-instance_method" title="#get_cookbook_path (instance method)">- (String) <strong>get_cookbook_path</strong>(cookbook) </a>
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
</span>
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
<span class="summary_desc"><div class='inline'>
|
328
|
+
<p>Determine if the current cookbook path is valid and that there is a
|
329
|
+
cookbook of the correct name in there.</p>
|
330
|
+
</div></span>
|
331
|
+
|
332
|
+
</li>
|
333
|
+
|
334
|
+
|
335
|
+
<li class="public ">
|
336
|
+
<span class="summary_signature">
|
337
|
+
|
338
|
+
<a href="#get_cookbook_version-instance_method" title="#get_cookbook_version (instance method)">- (Object) <strong>get_cookbook_version</strong> </a>
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
</span>
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
<span class="summary_desc"><div class='inline'>
|
353
|
+
<p>Get the version number in the git version of the cookbook.</p>
|
354
|
+
</div></span>
|
355
|
+
|
356
|
+
</li>
|
357
|
+
|
358
|
+
|
359
|
+
<li class="public ">
|
360
|
+
<span class="summary_signature">
|
361
|
+
|
362
|
+
<a href="#run-instance_method" title="#run (instance method)">- (Object) <strong>run</strong> </a>
|
363
|
+
|
364
|
+
|
365
|
+
|
366
|
+
</span>
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
|
376
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
377
|
+
|
378
|
+
</li>
|
379
|
+
|
380
|
+
|
381
|
+
<li class="public ">
|
382
|
+
<span class="summary_signature">
|
383
|
+
|
384
|
+
<a href="#set_cookbook_version-instance_method" title="#set_cookbook_version (instance method)">- (Object) <strong>set_cookbook_version</strong>(version) </a>
|
385
|
+
|
386
|
+
|
387
|
+
|
388
|
+
</span>
|
389
|
+
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
|
398
|
+
<span class="summary_desc"><div class='inline'>
|
399
|
+
<p>Set the version in metadata.rb.</p>
|
400
|
+
</div></span>
|
401
|
+
|
402
|
+
</li>
|
403
|
+
|
404
|
+
|
405
|
+
<li class="public ">
|
406
|
+
<span class="summary_signature">
|
407
|
+
|
408
|
+
<a href="#up_version-instance_method" title="#up_version (instance method)">- (String) <strong>up_version</strong>(version) </a>
|
409
|
+
|
410
|
+
|
411
|
+
|
412
|
+
</span>
|
413
|
+
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
|
422
|
+
<span class="summary_desc"><div class='inline'>
|
423
|
+
<p>Ask user to increment current/desired version number Method will exit if
|
424
|
+
the user chooses not to increment the version.</p>
|
425
|
+
</div></span>
|
426
|
+
|
427
|
+
</li>
|
428
|
+
|
429
|
+
|
430
|
+
</ul>
|
431
|
+
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
<div id="instance_method_details" class="method_details_list">
|
442
|
+
<h2>Instance Method Details</h2>
|
443
|
+
|
444
|
+
|
445
|
+
<div class="method_details first">
|
446
|
+
<h3 class="signature first" id="checkout_tag-instance_method">
|
447
|
+
|
448
|
+
- (<tt>Object</tt>) <strong>checkout_tag</strong>(version)
|
449
|
+
|
450
|
+
|
451
|
+
|
452
|
+
|
453
|
+
|
454
|
+
</h3><div class="docstring">
|
455
|
+
<div class="discussion">
|
456
|
+
|
457
|
+
<p>If a tag is available in github check it out Potentially quite dangerous as
|
458
|
+
it could cause code to get rolled back</p>
|
459
|
+
|
460
|
+
|
461
|
+
</div>
|
462
|
+
</div>
|
463
|
+
<div class="tags">
|
464
|
+
<p class="tag_title">Parameters:</p>
|
465
|
+
<ul class="param">
|
466
|
+
|
467
|
+
<li>
|
468
|
+
|
469
|
+
<span class='name'>version</span>
|
470
|
+
|
471
|
+
|
472
|
+
<span class='type'>(<tt>String</tt>)</span>
|
473
|
+
|
474
|
+
|
475
|
+
|
476
|
+
—
|
477
|
+
<div class='inline'>
|
478
|
+
<p>Version</p>
|
479
|
+
</div>
|
480
|
+
|
481
|
+
</li>
|
482
|
+
|
483
|
+
</ul>
|
484
|
+
|
485
|
+
|
486
|
+
</div><table class="source_code">
|
487
|
+
<tr>
|
488
|
+
<td>
|
489
|
+
<pre class="lines">
|
490
|
+
|
491
|
+
|
492
|
+
270
|
493
|
+
271
|
494
|
+
272
|
495
|
+
273
|
496
|
+
274
|
497
|
+
275
|
498
|
+
276
|
499
|
+
277
|
500
|
+
278
|
501
|
+
279</pre>
|
502
|
+
</td>
|
503
|
+
<td>
|
504
|
+
<pre class="code"><span class="info file"># File 'lib/chef/knife/github_deploy.rb', line 270</span>
|
505
|
+
|
506
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_checkout_tag'>checkout_tag</span><span class='lparen'>(</span><span class='id identifier rubyid_version'>version</span><span class='rparen'>)</span>
|
507
|
+
<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'>Checking out tag </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_version'>version</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
508
|
+
<span class='id identifier rubyid_cpath'>cpath</span> <span class='op'>=</span> <span class='id identifier rubyid_get_cookbook_path'>get_cookbook_path</span><span class='lparen'>(</span><span class='ivar'>@cookbook_name</span><span class='rparen'>)</span>
|
509
|
+
<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><span class='semicolon'>;</span>
|
510
|
+
<span class='backtick'>`</span><span class='tstring_content'>git checkout -b </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_version'>version</span><span class='rbrace'>}</span><span class='tstring_end'>`</span></span>
|
511
|
+
<span class='kw'>if</span> <span class='op'>!</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>
|
512
|
+
<span class='id identifier rubyid_ui'>ui</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'>Failed to checkout branch </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_version'>version</span><span class='rbrace'>}</span><span class='tstring_content'> of </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>
|
513
|
+
<span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span>
|
514
|
+
<span class='kw'>end</span>
|
515
|
+
<span class='kw'>end</span></pre>
|
516
|
+
</td>
|
517
|
+
</tr>
|
518
|
+
</table>
|
519
|
+
</div>
|
520
|
+
|
521
|
+
<div class="method_details ">
|
522
|
+
<h3 class="signature " id="choose_version-instance_method">
|
523
|
+
|
524
|
+
- (<tt>String</tt>) <strong>choose_version</strong>(version)
|
525
|
+
|
526
|
+
|
527
|
+
|
528
|
+
|
529
|
+
|
530
|
+
</h3><div class="docstring">
|
531
|
+
<div class="discussion">
|
532
|
+
|
533
|
+
<p>Increment the current version according to the config options <a
|
534
|
+
href="http://major">config</a> <a href="http://minor">config</a> <a
|
535
|
+
href="http://patch">config</a> Method will exit if the user chooses not to
|
536
|
+
increment the version</p>
|
537
|
+
|
538
|
+
|
539
|
+
</div>
|
540
|
+
</div>
|
541
|
+
<div class="tags">
|
542
|
+
<p class="tag_title">Parameters:</p>
|
543
|
+
<ul class="param">
|
544
|
+
|
545
|
+
<li>
|
546
|
+
|
547
|
+
<span class='name'>version</span>
|
548
|
+
|
549
|
+
|
550
|
+
<span class='type'>(<tt>String</tt>)</span>
|
551
|
+
|
552
|
+
|
553
|
+
|
554
|
+
—
|
555
|
+
<div class='inline'>
|
556
|
+
<p>Version</p>
|
557
|
+
</div>
|
558
|
+
|
559
|
+
</li>
|
560
|
+
|
561
|
+
</ul>
|
562
|
+
|
563
|
+
<p class="tag_title">Returns:</p>
|
564
|
+
<ul class="return">
|
565
|
+
|
566
|
+
<li>
|
567
|
+
|
568
|
+
|
569
|
+
<span class='type'>(<tt>String</tt>)</span>
|
570
|
+
|
571
|
+
|
572
|
+
|
573
|
+
—
|
574
|
+
<div class='inline'>
|
575
|
+
<p>New version number</p>
|
576
|
+
</div>
|
577
|
+
|
578
|
+
</li>
|
579
|
+
|
580
|
+
</ul>
|
581
|
+
|
582
|
+
</div><table class="source_code">
|
583
|
+
<tr>
|
584
|
+
<td>
|
585
|
+
<pre class="lines">
|
586
|
+
|
587
|
+
|
588
|
+
234
|
589
|
+
235
|
590
|
+
236
|
591
|
+
237
|
592
|
+
238
|
593
|
+
239
|
594
|
+
240
|
595
|
+
241
|
596
|
+
242
|
597
|
+
243
|
598
|
+
244
|
599
|
+
245
|
600
|
+
246
|
601
|
+
247
|
602
|
+
248
|
603
|
+
249</pre>
|
604
|
+
</td>
|
605
|
+
<td>
|
606
|
+
<pre class="code"><span class="info file"># File 'lib/chef/knife/github_deploy.rb', line 234</span>
|
607
|
+
|
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
|
+
<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
|
+
<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'>$1</span>
|
612
|
+
<span class='id identifier rubyid_patch'>patch</span> <span class='op'>=</span> <span class='backref'>$3</span>
|
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
|
+
<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>
|
615
|
+
<span class='id identifier rubyid_patch'>patch</span> <span class='op'>=</span> <span class='id identifier rubyid_patch'>patch</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'>:patch</span><span class='rbracket'>]</span>
|
616
|
+
<span class='id identifier rubyid_version'>version</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_major'>major</span><span class='rbrace'>}</span><span class='tstring_content'>.</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_minor'>minor</span><span class='rbrace'>}</span><span class='tstring_content'>.</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_patch'>patch</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
617
|
+
<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'>New version is </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_version'>version</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
618
|
+
<span class='kw'>else</span>
|
619
|
+
<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'>Version is in a format I cannot auto auto-update</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
620
|
+
<span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span>
|
621
|
+
<span class='kw'>end</span>
|
622
|
+
<span class='id identifier rubyid_version'>version</span>
|
623
|
+
<span class='kw'>end</span></pre>
|
624
|
+
</td>
|
625
|
+
</tr>
|
626
|
+
</table>
|
627
|
+
</div>
|
628
|
+
|
629
|
+
<div class="method_details ">
|
630
|
+
<h3 class="signature " id="cookbook_upload-instance_method">
|
631
|
+
|
632
|
+
- (<tt>Object</tt>) <strong>cookbook_upload</strong>
|
633
|
+
|
634
|
+
|
635
|
+
|
636
|
+
|
637
|
+
|
638
|
+
</h3><div class="docstring">
|
639
|
+
<div class="discussion">
|
640
|
+
|
641
|
+
<p>Upload the cookbook to chef server If mode is final, freeze the cookbook</p>
|
642
|
+
|
643
|
+
|
644
|
+
</div>
|
645
|
+
</div>
|
646
|
+
<div class="tags">
|
647
|
+
|
648
|
+
|
649
|
+
</div><table class="source_code">
|
650
|
+
<tr>
|
651
|
+
<td>
|
652
|
+
<pre class="lines">
|
653
|
+
|
654
|
+
|
655
|
+
253
|
656
|
+
254
|
657
|
+
255
|
658
|
+
256
|
659
|
+
257
|
660
|
+
258
|
661
|
+
259
|
662
|
+
260
|
663
|
+
261
|
664
|
+
262
|
665
|
+
263
|
666
|
+
264</pre>
|
667
|
+
</td>
|
668
|
+
<td>
|
669
|
+
<pre class="code"><span class="info file"># File 'lib/chef/knife/github_deploy.rb', line 253</span>
|
670
|
+
|
671
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_cookbook_upload'>cookbook_upload</span><span class='lparen'>(</span><span class='rparen'>)</span>
|
672
|
+
<span class='comment'># Git meuk should not be uploaded use chefignore file instead
|
673
|
+
</span> <span class='comment'># FileUtils.remove_entry("#{@github_tmp}/git/#{@cookbook_name}/.git")
|
674
|
+
</span> <span class='id identifier rubyid_args'>args</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>cookbook</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>upload</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='ivar'>@cookbook_name</span> <span class='rbracket'>]</span>
|
675
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:final</span><span class='rbracket'>]</span>
|
676
|
+
<span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>--freeze</span><span class='tstring_end'>"</span></span>
|
677
|
+
<span class='kw'>end</span>
|
678
|
+
<span class='id identifier rubyid_upload'>upload</span> <span class='op'>=</span> <span class='const'>Chef</span><span class='op'>::</span><span class='const'>Knife</span><span class='op'>::</span><span class='const'>CookbookUpload</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
679
|
+
<span class='comment'>#upload.config[:cookbook_path] = "#{@github_tmp}/git"
|
680
|
+
</span> <span class='comment'># plugin will throw its own errors
|
681
|
+
</span> <span class='id identifier rubyid_upload'>upload</span><span class='period'>.</span><span class='id identifier rubyid_run'>run</span>
|
682
|
+
<span class='kw'>end</span></pre>
|
683
|
+
</td>
|
684
|
+
</tr>
|
685
|
+
</table>
|
686
|
+
</div>
|
687
|
+
|
688
|
+
<div class="method_details ">
|
689
|
+
<h3 class="signature " id="do_commit-instance_method">
|
690
|
+
|
691
|
+
- (<tt>Object</tt>) <strong>do_commit</strong>(version, push)
|
692
|
+
|
693
|
+
|
694
|
+
|
695
|
+
|
696
|
+
|
697
|
+
</h3><div class="docstring">
|
698
|
+
<div class="discussion">
|
699
|
+
|
700
|
+
<p>Commit changes in git</p>
|
701
|
+
|
702
|
+
|
703
|
+
</div>
|
704
|
+
</div>
|
705
|
+
<div class="tags">
|
706
|
+
<p class="tag_title">Parameters:</p>
|
707
|
+
<ul class="param">
|
708
|
+
|
709
|
+
<li>
|
710
|
+
|
711
|
+
<span class='name'>version</span>
|
712
|
+
|
713
|
+
|
714
|
+
<span class='type'>(<tt>String</tt>)</span>
|
715
|
+
|
716
|
+
|
717
|
+
|
718
|
+
—
|
719
|
+
<div class='inline'>
|
720
|
+
<p>cookbook version</p>
|
721
|
+
</div>
|
722
|
+
|
723
|
+
</li>
|
724
|
+
|
725
|
+
<li>
|
726
|
+
|
727
|
+
<span class='name'>push</span>
|
728
|
+
|
729
|
+
|
730
|
+
<span class='type'>(<tt>Bool</tt>)</span>
|
731
|
+
|
732
|
+
|
733
|
+
|
734
|
+
—
|
735
|
+
<div class='inline'>
|
736
|
+
<p>true is the cookbook should also be pushed</p>
|
737
|
+
</div>
|
738
|
+
|
739
|
+
</li>
|
740
|
+
|
741
|
+
</ul>
|
742
|
+
|
743
|
+
|
744
|
+
</div><table class="source_code">
|
745
|
+
<tr>
|
746
|
+
<td>
|
747
|
+
<pre class="lines">
|
748
|
+
|
749
|
+
|
750
|
+
318
|
751
|
+
319
|
752
|
+
320
|
753
|
+
321
|
754
|
+
322
|
755
|
+
323
|
756
|
+
324
|
757
|
+
325
|
758
|
+
326
|
759
|
+
327
|
760
|
+
328
|
761
|
+
329
|
762
|
+
330
|
763
|
+
331
|
764
|
+
332
|
765
|
+
333
|
766
|
+
334
|
767
|
+
335
|
768
|
+
336
|
769
|
+
337
|
770
|
+
338</pre>
|
771
|
+
</td>
|
772
|
+
<td>
|
773
|
+
<pre class="code"><span class="info file"># File 'lib/chef/knife/github_deploy.rb', line 318</span>
|
774
|
+
|
775
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_do_commit'>do_commit</span><span class='lparen'>(</span><span class='id identifier rubyid_version'>version</span><span class='comma'>,</span> <span class='id identifier rubyid_push'>push</span><span class='rparen'>)</span>
|
776
|
+
<span class='id identifier rubyid_cpath'>cpath</span> <span class='op'>=</span> <span class='id identifier rubyid_get_cookbook_path'>get_cookbook_path</span><span class='lparen'>(</span><span class='ivar'>@cookbook_name</span><span class='rparen'>)</span>
|
777
|
+
<span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_chdir'>chdir</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cpath'>cpath</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
778
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_cpath'>cpath</span>
|
779
|
+
<span class='id identifier rubyid_output'>output</span> <span class='op'>=</span> <span class='backtick'>`</span><span class='tstring_content'>git commit -a -m "Deploy </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_version'>version</span><span class='rbrace'>}</span><span class='tstring_content'>" 2>&1</span><span class='tstring_end'>`</span></span>
|
780
|
+
<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>
|
781
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_output'>output</span> <span class='op'>!~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>nothing to commit</span><span class='regexp_end'>/</span></span>
|
782
|
+
<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'>Could not commit </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>
|
783
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_output'>output</span>
|
784
|
+
<span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span>
|
785
|
+
<span class='kw'>end</span>
|
786
|
+
<span class='kw'>end</span>
|
787
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_push'>push</span>
|
788
|
+
<span class='id identifier rubyid_output'>output</span> <span class='op'>=</span> <span class='backtick'>`</span><span class='tstring_content'>git push --tags 2>&1</span><span class='tstring_end'>`</span></span>
|
789
|
+
<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>
|
790
|
+
<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'>Could not push tag for: </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>
|
791
|
+
<span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span>
|
792
|
+
<span class='kw'>end</span>
|
793
|
+
<span class='id identifier rubyid_output'>output</span> <span class='op'>=</span> <span class='backtick'>`</span><span class='tstring_content'>git push 2>&1</span><span class='tstring_end'>`</span></span>
|
794
|
+
<span class='kw'>end</span>
|
795
|
+
<span class='kw'>end</span></pre>
|
796
|
+
</td>
|
797
|
+
</tr>
|
798
|
+
</table>
|
799
|
+
</div>
|
800
|
+
|
801
|
+
<div class="method_details ">
|
802
|
+
<h3 class="signature " id="get_cookbook_chef_versions-instance_method">
|
803
|
+
|
804
|
+
- (<tt>Object</tt>) <strong>get_cookbook_chef_versions</strong>
|
805
|
+
|
806
|
+
|
807
|
+
|
808
|
+
|
809
|
+
|
810
|
+
</h3><div class="docstring">
|
811
|
+
<div class="discussion">
|
812
|
+
|
813
|
+
<p>Get a sorted array of version for the cookbook</p>
|
814
|
+
|
815
|
+
|
816
|
+
</div>
|
817
|
+
</div>
|
818
|
+
<div class="tags">
|
819
|
+
|
820
|
+
|
821
|
+
</div><table class="source_code">
|
822
|
+
<tr>
|
823
|
+
<td>
|
824
|
+
<pre class="lines">
|
825
|
+
|
826
|
+
|
827
|
+
282
|
828
|
+
283
|
829
|
+
284
|
830
|
+
285
|
831
|
+
286
|
832
|
+
287</pre>
|
833
|
+
</td>
|
834
|
+
<td>
|
835
|
+
<pre class="code"><span class="info file"># File 'lib/chef/knife/github_deploy.rb', line 282</span>
|
836
|
+
|
837
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_get_cookbook_chef_versions'>get_cookbook_chef_versions</span> <span class='lparen'>(</span><span class='rparen'>)</span>
|
838
|
+
<span class='id identifier rubyid_cookbooks'>cookbooks</span> <span class='op'>=</span> <span class='id identifier rubyid_rest'>rest</span><span class='period'>.</span><span class='id identifier rubyid_get_rest'>get_rest</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/cookbooks/</span><span class='embexpr_beg'>#{</span><span class='ivar'>@cookbook_name</span><span class='rbrace'>}</span><span class='tstring_content'>?num_version=all</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
839
|
+
<span class='id identifier rubyid_cookbooks'>cookbooks</span><span class='lbracket'>[</span><span class='ivar'>@cookbook_name</span><span class='rbracket'>]</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='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
|
840
|
+
<span class='ivar'>@versions</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</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'>version</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
841
|
+
<span class='kw'>end</span>
|
842
|
+
<span class='kw'>end</span></pre>
|
843
|
+
</td>
|
844
|
+
</tr>
|
845
|
+
</table>
|
846
|
+
</div>
|
847
|
+
|
848
|
+
<div class="method_details ">
|
849
|
+
<h3 class="signature " id="get_cookbook_path-instance_method">
|
850
|
+
|
851
|
+
- (<tt>String</tt>) <strong>get_cookbook_path</strong>(cookbook)
|
852
|
+
|
853
|
+
|
854
|
+
|
855
|
+
|
856
|
+
|
857
|
+
</h3><div class="docstring">
|
858
|
+
<div class="discussion">
|
859
|
+
|
860
|
+
<p>Determine if the current cookbook path is valid and that there is a
|
861
|
+
cookbook of the correct name in there</p>
|
862
|
+
|
863
|
+
|
864
|
+
</div>
|
865
|
+
</div>
|
866
|
+
<div class="tags">
|
867
|
+
<p class="tag_title">Parameters:</p>
|
868
|
+
<ul class="param">
|
869
|
+
|
870
|
+
<li>
|
871
|
+
|
872
|
+
<span class='name'>cookbook</span>
|
873
|
+
|
874
|
+
|
875
|
+
<span class='type'>(<tt>String</tt>)</span>
|
876
|
+
|
877
|
+
|
878
|
+
|
879
|
+
—
|
880
|
+
<div class='inline'>
|
881
|
+
<p>cookbook name</p>
|
882
|
+
</div>
|
883
|
+
|
884
|
+
</li>
|
885
|
+
|
886
|
+
</ul>
|
887
|
+
|
888
|
+
<p class="tag_title">Returns:</p>
|
889
|
+
<ul class="return">
|
890
|
+
|
891
|
+
<li>
|
892
|
+
|
893
|
+
|
894
|
+
<span class='type'>(<tt>String</tt>)</span>
|
895
|
+
|
896
|
+
|
897
|
+
|
898
|
+
—
|
899
|
+
<div class='inline'>
|
900
|
+
<p>Path to cookbook</p>
|
901
|
+
</div>
|
902
|
+
|
903
|
+
</li>
|
904
|
+
|
905
|
+
</ul>
|
906
|
+
|
907
|
+
</div><table class="source_code">
|
908
|
+
<tr>
|
909
|
+
<td>
|
910
|
+
<pre class="lines">
|
911
|
+
|
912
|
+
|
913
|
+
311
|
914
|
+
312
|
915
|
+
313</pre>
|
916
|
+
</td>
|
917
|
+
<td>
|
918
|
+
<pre class="code"><span class="info file"># File 'lib/chef/knife/github_deploy.rb', line 311</span>
|
919
|
+
|
920
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_get_cookbook_path'>get_cookbook_path</span><span class='lparen'>(</span><span class='id identifier rubyid_cookbook'>cookbook</span><span class='rparen'>)</span>
|
921
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_cookbook_path_valid?'>cookbook_path_valid?</span><span class='lparen'>(</span><span class='id identifier rubyid_cookbook'>cookbook</span><span class='comma'>,</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
922
|
+
<span class='kw'>end</span></pre>
|
923
|
+
</td>
|
924
|
+
</tr>
|
925
|
+
</table>
|
926
|
+
</div>
|
927
|
+
|
928
|
+
<div class="method_details ">
|
929
|
+
<h3 class="signature " id="get_cookbook_version-instance_method">
|
930
|
+
|
931
|
+
- (<tt>Object</tt>) <strong>get_cookbook_version</strong>
|
932
|
+
|
933
|
+
|
934
|
+
|
935
|
+
|
936
|
+
|
937
|
+
</h3><div class="docstring">
|
938
|
+
<div class="discussion">
|
939
|
+
|
940
|
+
<p>Get the version number in the git version of the cookbook</p>
|
941
|
+
|
942
|
+
|
943
|
+
</div>
|
944
|
+
</div>
|
945
|
+
<div class="tags">
|
946
|
+
<p class="tag_title">Parameters:</p>
|
947
|
+
<ul class="param">
|
948
|
+
|
949
|
+
<li>
|
950
|
+
|
951
|
+
<span class='name'>version</span>
|
952
|
+
|
953
|
+
|
954
|
+
<span class='type'>(<tt>String</tt>)</span>
|
955
|
+
|
956
|
+
|
957
|
+
|
958
|
+
—
|
959
|
+
<div class='inline'>
|
960
|
+
<p>Version</p>
|
961
|
+
</div>
|
962
|
+
|
963
|
+
</li>
|
964
|
+
|
965
|
+
</ul>
|
966
|
+
|
967
|
+
|
968
|
+
</div><table class="source_code">
|
969
|
+
<tr>
|
970
|
+
<td>
|
971
|
+
<pre class="lines">
|
972
|
+
|
973
|
+
|
974
|
+
291
|
975
|
+
292
|
976
|
+
293
|
977
|
+
294
|
978
|
+
295
|
979
|
+
296
|
980
|
+
297
|
981
|
+
298
|
982
|
+
299
|
983
|
+
300
|
984
|
+
301
|
985
|
+
302
|
986
|
+
303
|
987
|
+
304
|
988
|
+
305</pre>
|
989
|
+
</td>
|
990
|
+
<td>
|
991
|
+
<pre class="code"><span class="info file"># File 'lib/chef/knife/github_deploy.rb', line 291</span>
|
992
|
+
|
993
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_get_cookbook_version'>get_cookbook_version</span><span class='lparen'>(</span><span class='rparen'>)</span>
|
994
|
+
<span class='id identifier rubyid_version'>version</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
995
|
+
<span class='id identifier rubyid_cpath'>cpath</span> <span class='op'>=</span> <span class='id identifier rubyid_get_cookbook_path'>get_cookbook_path</span><span class='lparen'>(</span><span class='ivar'>@cookbook_name</span><span class='rparen'>)</span>
|
996
|
+
<span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_foreach'>foreach</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cpath'>cpath</span><span class='rbrace'>}</span><span class='tstring_content'>/metadata.rb</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_line'>line</span><span class='op'>|</span>
|
997
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_line'>line</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>version.*"(.*)"</span><span class='regexp_end'>/i</span></span>
|
998
|
+
<span class='id identifier rubyid_version'>version</span> <span class='op'>=</span> <span class='backref'>$1</span>
|
999
|
+
<span class='kw'>break</span>
|
1000
|
+
<span class='kw'>end</span>
|
1001
|
+
<span class='kw'>end</span>
|
1002
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_version'>version</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1003
|
+
<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 get the version for cookbook </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>
|
1004
|
+
<span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span>
|
1005
|
+
<span class='kw'>end</span>
|
1006
|
+
<span class='id identifier rubyid_version'>version</span>
|
1007
|
+
<span class='kw'>end</span></pre>
|
1008
|
+
</td>
|
1009
|
+
</tr>
|
1010
|
+
</table>
|
1011
|
+
</div>
|
1012
|
+
|
1013
|
+
<div class="method_details ">
|
1014
|
+
<h3 class="signature " id="run-instance_method">
|
1015
|
+
|
1016
|
+
- (<tt>Object</tt>) <strong>run</strong>
|
1017
|
+
|
1018
|
+
|
1019
|
+
|
1020
|
+
|
1021
|
+
|
1022
|
+
</h3><table class="source_code">
|
1023
|
+
<tr>
|
1024
|
+
<td>
|
1025
|
+
<pre class="lines">
|
1026
|
+
|
1027
|
+
|
1028
|
+
94
|
1029
|
+
95
|
1030
|
+
96
|
1031
|
+
97
|
1032
|
+
98
|
1033
|
+
99
|
1034
|
+
100
|
1035
|
+
101
|
1036
|
+
102
|
1037
|
+
103
|
1038
|
+
104
|
1039
|
+
105
|
1040
|
+
106
|
1041
|
+
107
|
1042
|
+
108
|
1043
|
+
109
|
1044
|
+
110
|
1045
|
+
111
|
1046
|
+
112
|
1047
|
+
113
|
1048
|
+
114
|
1049
|
+
115
|
1050
|
+
116
|
1051
|
+
117
|
1052
|
+
118
|
1053
|
+
119
|
1054
|
+
120
|
1055
|
+
121
|
1056
|
+
122
|
1057
|
+
123
|
1058
|
+
124
|
1059
|
+
125
|
1060
|
+
126
|
1061
|
+
127
|
1062
|
+
128
|
1063
|
+
129
|
1064
|
+
130
|
1065
|
+
131
|
1066
|
+
132
|
1067
|
+
133
|
1068
|
+
134
|
1069
|
+
135
|
1070
|
+
136
|
1071
|
+
137
|
1072
|
+
138
|
1073
|
+
139
|
1074
|
+
140
|
1075
|
+
141
|
1076
|
+
142
|
1077
|
+
143
|
1078
|
+
144
|
1079
|
+
145
|
1080
|
+
146
|
1081
|
+
147
|
1082
|
+
148
|
1083
|
+
149
|
1084
|
+
150
|
1085
|
+
151
|
1086
|
+
152
|
1087
|
+
153
|
1088
|
+
154
|
1089
|
+
155
|
1090
|
+
156
|
1091
|
+
157
|
1092
|
+
158
|
1093
|
+
159
|
1094
|
+
160
|
1095
|
+
161
|
1096
|
+
162
|
1097
|
+
163
|
1098
|
+
164
|
1099
|
+
165
|
1100
|
+
166
|
1101
|
+
167
|
1102
|
+
168
|
1103
|
+
169
|
1104
|
+
170
|
1105
|
+
171
|
1106
|
+
172
|
1107
|
+
173
|
1108
|
+
174
|
1109
|
+
175
|
1110
|
+
176
|
1111
|
+
177
|
1112
|
+
178
|
1113
|
+
179
|
1114
|
+
180
|
1115
|
+
181
|
1116
|
+
182
|
1117
|
+
183
|
1118
|
+
184
|
1119
|
+
185
|
1120
|
+
186
|
1121
|
+
187
|
1122
|
+
188
|
1123
|
+
189
|
1124
|
+
190
|
1125
|
+
191
|
1126
|
+
192
|
1127
|
+
193
|
1128
|
+
194
|
1129
|
+
195
|
1130
|
+
196
|
1131
|
+
197
|
1132
|
+
198
|
1133
|
+
199
|
1134
|
+
200
|
1135
|
+
201
|
1136
|
+
202
|
1137
|
+
203
|
1138
|
+
204</pre>
|
1139
|
+
</td>
|
1140
|
+
<td>
|
1141
|
+
<pre class="code"><span class="info file"># File 'lib/chef/knife/github_deploy.rb', line 94</span>
|
1142
|
+
|
1143
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_run'>run</span>
|
1144
|
+
<span class='comment'># Main run entry point for the class
|
1145
|
+
</span>
|
1146
|
+
<span class='id identifier rubyid_validate_base_options'>validate_base_options</span>
|
1147
|
+
|
1148
|
+
<span class='id identifier rubyid_display_debug_info'>display_debug_info</span>
|
1149
|
+
|
1150
|
+
<span class='comment'># Gather all repo information from github.
|
1151
|
+
</span> <span class='id identifier rubyid_get_all_repos'>get_all_repos</span> <span class='op'>=</span> <span class='id identifier rubyid_get_all_repos'>get_all_repos</span><span class='lparen'>(</span><span class='ivar'>@github_organizations</span><span class='period'>.</span><span class='id identifier rubyid_reverse'>reverse</span><span class='rparen'>)</span>
|
1152
|
+
|
1153
|
+
<span class='comment'># Get all chef cookbooks and versions (hopefully chef does the error handeling).
|
1154
|
+
</span> <span class='id identifier rubyid_cookbooks'>cookbooks</span> <span class='op'>=</span> <span class='id identifier rubyid_rest'>rest</span><span class='period'>.</span><span class='id identifier rubyid_get_rest'>get_rest</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/cookbooks?num_version=1</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1155
|
+
|
1156
|
+
<span class='ivar'>@versions</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
1157
|
+
<span class='id identifier rubyid_cookbook_version'>cookbook_version</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
1158
|
+
<span class='ivar'>@cookbook_name</span> <span class='op'>=</span> <span class='id identifier rubyid_name_args'>name_args</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='kw'>unless</span> <span class='id identifier rubyid_name_args'>name_args</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
1159
|
+
<span class='id identifier rubyid_cookbook_version'>cookbook_version</span> <span class='op'>=</span> <span class='id identifier rubyid_name_args'>name_args</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span> <span class='kw'>unless</span> <span class='id identifier rubyid_name_args'>name_args</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1160
|
+
|
1161
|
+
<span class='kw'>if</span> <span class='ivar'>@cookbook_name</span>
|
1162
|
+
<span class='id identifier rubyid_repo'>repo</span> <span class='op'>=</span> <span class='id identifier rubyid_get_all_repos'>get_all_repos</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</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> <span class='id identifier rubyid_v'>v</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='ivar'>@cookbook_name</span> <span class='rbrace'>}</span>
|
1163
|
+
<span class='kw'>else</span>
|
1164
|
+
<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'>Cookbook not in git. You must add it to git to use deploy</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1165
|
+
<span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span>
|
1166
|
+
<span class='kw'>end</span>
|
1167
|
+
|
1168
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_repo'>repo</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
1169
|
+
<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'>Cookbook not in git. You must add it to git to use deploy</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1170
|
+
<span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span>
|
1171
|
+
<span class='kw'>end</span>
|
1172
|
+
|
1173
|
+
<span class='comment'># is the cookbook in the cookbook_path?
|
1174
|
+
</span> <span class='kw'>if</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><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1175
|
+
<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'>Cookbook is not in cookbook path</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1176
|
+
<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'>"</span><span class='tstring_content'>HINT: knife github clone </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>
|
1177
|
+
<span class='id identifier rubyid_exit'>exit</span> <span class='int'>1</span>
|
1178
|
+
<span class='kw'>end</span>
|
1179
|
+
|
1180
|
+
<span class='comment'># ----------------------------- #
|
1181
|
+
</span> <span class='comment'># The version can come
|
1182
|
+
</span> <span class='comment'># 1. From the command line
|
1183
|
+
</span> <span class='comment'># 2. From the cookbook
|
1184
|
+
</span> <span class='comment'># ----------------------------- #
|
1185
|
+
</span> <span class='kw'>if</span> <span class='id identifier rubyid_cookbook_version'>cookbook_version</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1186
|
+
<span class='id identifier rubyid_cookbook_version'>cookbook_version</span> <span class='op'>=</span> <span class='id identifier rubyid_get_cookbook_version'>get_cookbook_version</span><span class='lparen'>(</span><span class='rparen'>)</span>
|
1187
|
+
<span class='kw'>end</span>
|
1188
|
+
<span class='comment'># Next check to see if the version in git is way ahead
|
1189
|
+
</span> <span class='kw'>if</span> <span class='op'>!</span> <span class='id identifier rubyid_get_all_repos'>get_all_repos</span><span class='lbracket'>[</span><span class='ivar'>@cookbook_name</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>
|
1190
|
+
<span class='id identifier rubyid_cb1'>cb1</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_cookbook_version'>cookbook_version</span><span class='rparen'>)</span>
|
1191
|
+
<span class='id identifier rubyid_cb2'>cb2</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_get_all_repos'>get_all_repos</span><span class='lbracket'>[</span><span class='ivar'>@cookbook_name</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='rparen'>)</span>
|
1192
|
+
<span class='kw'>if</span><span class='lparen'>(</span><span class='id identifier rubyid_cb2'>cb2</span> <span class='op'>></span> <span class='id identifier rubyid_cb1'>cb1</span><span class='rparen'>)</span>
|
1193
|
+
<span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_confirm'>confirm</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Version in github </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cb2'>cb2</span><span class='rbrace'>}</span><span class='tstring_content'> is greater than the version you want to deploy </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cb1'>cb1</span><span class='rbrace'>}</span><span class='tstring_content'> - Continue</span><span class='tstring_end'>"</span></span>
|
1194
|
+
<span class='kw'>end</span>
|
1195
|
+
<span class='kw'>end</span>
|
1196
|
+
|
1197
|
+
<span class='id identifier rubyid_inChef'>inChef</span> <span class='op'>=</span> <span class='kw'>true</span>
|
1198
|
+
<span class='id identifier rubyid_isFrozen'>isFrozen</span> <span class='op'>=</span> <span class='kw'>false</span>
|
1199
|
+
<span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:major</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:minor</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1200
|
+
<span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:patch</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>false</span>
|
1201
|
+
<span class='kw'>end</span>
|
1202
|
+
<span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:major</span><span class='rbracket'>]</span> <span class='op'>&&</span> <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:minor</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1203
|
+
<span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:minor</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>false</span>
|
1204
|
+
<span class='kw'>end</span>
|
1205
|
+
|
1206
|
+
<span class='kw'>begin</span>
|
1207
|
+
<span class='id identifier rubyid_isFrozen'>isFrozen</span> <span class='op'>=</span> <span class='id identifier rubyid_rest'>rest</span><span class='period'>.</span><span class='id identifier rubyid_get_rest'>get_rest</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>cookbooks/</span><span class='embexpr_beg'>#{</span><span class='ivar'>@cookbook_name</span><span class='rbrace'>}</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cookbook_version'>cookbook_version</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_frozen_version?'>frozen_version?</span>
|
1208
|
+
<span class='kw'>rescue</span>
|
1209
|
+
<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'>"</span><span class='embexpr_beg'>#{</span><span class='ivar'>@cookbook_name</span><span class='rbrace'>}</span><span class='tstring_content'> is not yet in chef</span><span class='tstring_end'>"</span></span>
|
1210
|
+
<span class='id identifier rubyid_inChef'>inChef</span> <span class='op'>=</span> <span class='kw'>false</span>
|
1211
|
+
<span class='kw'>end</span>
|
1212
|
+
|
1213
|
+
|
1214
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:final</span><span class='rbracket'>]</span>
|
1215
|
+
<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'>Using Final mode</span><span class='tstring_end'>"</span></span>
|
1216
|
+
|
1217
|
+
<span class='kw'>else</span>
|
1218
|
+
<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'>Using Development mode</span><span class='tstring_end'>"</span></span>
|
1219
|
+
<span class='kw'>end</span>
|
1220
|
+
<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'>Cookbook is frozen</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_isFrozen'>isFrozen</span>
|
1221
|
+
|
1222
|
+
<span class='comment'># Might be first upload so need to catch that cookbook does not exist!
|
1223
|
+
</span> <span class='id identifier rubyid_get_cookbook_chef_versions'>get_cookbook_chef_versions</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='op'>!</span> <span class='id identifier rubyid_inChef'>inChef</span>
|
1224
|
+
|
1225
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:final</span><span class='rbracket'>]</span>
|
1226
|
+
<span class='id identifier rubyid_cookbook_version'>cookbook_version</span> <span class='op'>=</span> <span class='id identifier rubyid_up_version'>up_version</span><span class='lparen'>(</span><span class='id identifier rubyid_cookbook_version'>cookbook_version</span><span class='rparen'>)</span>
|
1227
|
+
|
1228
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_repo'>repo</span><span class='lbracket'>[</span><span class='ivar'>@cookbook_name</span><span class='rbracket'>]</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='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='op'>|</span> <span class='id identifier rubyid_k'>k</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='id identifier rubyid_cookbook_version'>cookbook_version</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
1229
|
+
<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'>"</span><span class='tstring_content'>Cookbook </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cookbook_version'>cookbook_version</span><span class='rbrace'>}</span><span class='tstring_content'> has no tag in Git</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1230
|
+
<span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_confirm'>confirm</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Shall I add a tag for you?</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1231
|
+
<span class='id identifier rubyid_set_cookbook_version'>set_cookbook_version</span><span class='lparen'>(</span><span class='id identifier rubyid_cookbook_version'>cookbook_version</span><span class='rparen'>)</span>
|
1232
|
+
<span class='id identifier rubyid_add_tag'>add_tag</span><span class='lparen'>(</span><span class='id identifier rubyid_cookbook_version'>cookbook_version</span><span class='rparen'>)</span>
|
1233
|
+
<span class='kw'>else</span>
|
1234
|
+
<span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_confirm'>confirm</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Tag </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cookbook_version'>cookbook_version</span><span class='rbrace'>}</span><span class='tstring_content'> exists - did you make this for this release?</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1235
|
+
<span class='id identifier rubyid_checkout_tag'>checkout_tag</span><span class='lparen'>(</span><span class='id identifier rubyid_cookbook_version'>cookbook_version</span><span class='rparen'>)</span>
|
1236
|
+
<span class='id identifier rubyid_set_cookbook_version'>set_cookbook_version</span><span class='lparen'>(</span><span class='id identifier rubyid_cookbook_version'>cookbook_version</span><span class='rparen'>)</span>
|
1237
|
+
<span class='kw'>end</span>
|
1238
|
+
|
1239
|
+
<span class='id identifier rubyid_do_commit'>do_commit</span><span class='lparen'>(</span><span class='id identifier rubyid_cookbook_version'>cookbook_version</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
1240
|
+
<span class='kw'>end</span>
|
1241
|
+
|
1242
|
+
<span class='comment'># In Dev mode the version of the cookbook does not need to change
|
1243
|
+
</span> <span class='comment'># If however the cookbook is frozen, then the version has to change
|
1244
|
+
</span> <span class='kw'>if</span> <span class='op'>!</span> <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:final</span><span class='rbracket'>]</span> <span class='op'>&&</span> <span class='id identifier rubyid_isFrozen'>isFrozen</span>
|
1245
|
+
<span class='id identifier rubyid_cookbook_version'>cookbook_version</span> <span class='op'>=</span> <span class='id identifier rubyid_up_version'>up_version</span><span class='lparen'>(</span><span class='id identifier rubyid_cookbook_version'>cookbook_version</span><span class='rparen'>)</span>
|
1246
|
+
<span class='id identifier rubyid_set_cookbook_version'>set_cookbook_version</span><span class='lparen'>(</span><span class='id identifier rubyid_cookbook_version'>cookbook_version</span><span class='rparen'>)</span>
|
1247
|
+
<span class='id identifier rubyid_do_commit'>do_commit</span><span class='lparen'>(</span><span class='id identifier rubyid_cookbook_version'>cookbook_version</span><span class='comma'>,</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
1248
|
+
<span class='kw'>end</span>
|
1249
|
+
|
1250
|
+
<span class='comment'># If we have gotten this far we can just upload the cookbook
|
1251
|
+
</span> <span class='id identifier rubyid_cookbook_upload'>cookbook_upload</span><span class='lparen'>(</span><span class='rparen'>)</span>
|
1252
|
+
|
1253
|
+
<span class='kw'>end</span></pre>
|
1254
|
+
</td>
|
1255
|
+
</tr>
|
1256
|
+
</table>
|
1257
|
+
</div>
|
1258
|
+
|
1259
|
+
<div class="method_details ">
|
1260
|
+
<h3 class="signature " id="set_cookbook_version-instance_method">
|
1261
|
+
|
1262
|
+
- (<tt>Object</tt>) <strong>set_cookbook_version</strong>(version)
|
1263
|
+
|
1264
|
+
|
1265
|
+
|
1266
|
+
|
1267
|
+
|
1268
|
+
</h3><div class="docstring">
|
1269
|
+
<div class="discussion">
|
1270
|
+
|
1271
|
+
<p>Set the version in metadata.rb</p>
|
1272
|
+
|
1273
|
+
|
1274
|
+
</div>
|
1275
|
+
</div>
|
1276
|
+
<div class="tags">
|
1277
|
+
<p class="tag_title">Parameters:</p>
|
1278
|
+
<ul class="param">
|
1279
|
+
|
1280
|
+
<li>
|
1281
|
+
|
1282
|
+
<span class='name'>version</span>
|
1283
|
+
|
1284
|
+
|
1285
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1286
|
+
|
1287
|
+
|
1288
|
+
|
1289
|
+
—
|
1290
|
+
<div class='inline'>
|
1291
|
+
<p>cookbook version</p>
|
1292
|
+
</div>
|
1293
|
+
|
1294
|
+
</li>
|
1295
|
+
|
1296
|
+
</ul>
|
1297
|
+
|
1298
|
+
|
1299
|
+
</div><table class="source_code">
|
1300
|
+
<tr>
|
1301
|
+
<td>
|
1302
|
+
<pre class="lines">
|
1303
|
+
|
1304
|
+
|
1305
|
+
343
|
1306
|
+
344
|
1307
|
+
345
|
1308
|
+
346
|
1309
|
+
347
|
1310
|
+
348
|
1311
|
+
349
|
1312
|
+
350
|
1313
|
+
351
|
1314
|
+
352
|
1315
|
+
353</pre>
|
1316
|
+
</td>
|
1317
|
+
<td>
|
1318
|
+
<pre class="code"><span class="info file"># File 'lib/chef/knife/github_deploy.rb', line 343</span>
|
1319
|
+
|
1320
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_set_cookbook_version'>set_cookbook_version</span><span class='lparen'>(</span><span class='id identifier rubyid_version'>version</span><span class='rparen'>)</span>
|
1321
|
+
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_get_cookbook_version'>get_cookbook_version</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='op'>!=</span> <span class='id identifier rubyid_version'>version</span>
|
1322
|
+
<span class='id identifier rubyid_contents'>contents</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span>
|
1323
|
+
<span class='id identifier rubyid_cpath'>cpath</span> <span class='op'>=</span> <span class='id identifier rubyid_get_cookbook_path'>get_cookbook_path</span><span class='lparen'>(</span><span class='ivar'>@cookbook_name</span><span class='rparen'>)</span>
|
1324
|
+
<span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_foreach'>foreach</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cpath'>cpath</span><span class='rbrace'>}</span><span class='tstring_content'>/metadata.rb</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_line'>line</span><span class='op'>|</span>
|
1325
|
+
<span class='id identifier rubyid_line'>line</span><span class='period'>.</span><span class='id identifier rubyid_gsub!'>gsub!</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>(version[\t\s]+)(.*)</span><span class='regexp_end'>/i</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\\1 \"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_version'>version</span><span class='rbrace'>}</span><span class='tstring_content'>\"\n</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1326
|
+
<span class='id identifier rubyid_contents'>contents</span> <span class='op'>=</span> <span class='id identifier rubyid_contents'>contents</span> <span class='op'><<</span> <span class='id identifier rubyid_line'>line</span>
|
1327
|
+
<span class='kw'>end</span>
|
1328
|
+
<span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cpath'>cpath</span><span class='rbrace'>}</span><span class='tstring_content'>/metadata.rb</span><span class='tstring_end'>"</span></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='id identifier rubyid_contents'>contents</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
1329
|
+
<span class='kw'>return</span> <span class='kw'>true</span>
|
1330
|
+
<span class='kw'>end</span></pre>
|
1331
|
+
</td>
|
1332
|
+
</tr>
|
1333
|
+
</table>
|
1334
|
+
</div>
|
1335
|
+
|
1336
|
+
<div class="method_details ">
|
1337
|
+
<h3 class="signature " id="up_version-instance_method">
|
1338
|
+
|
1339
|
+
- (<tt>String</tt>) <strong>up_version</strong>(version)
|
1340
|
+
|
1341
|
+
|
1342
|
+
|
1343
|
+
|
1344
|
+
|
1345
|
+
</h3><div class="docstring">
|
1346
|
+
<div class="discussion">
|
1347
|
+
|
1348
|
+
<p>Ask user to increment current/desired version number Method will exit if
|
1349
|
+
the user chooses not to increment the version</p>
|
1350
|
+
|
1351
|
+
|
1352
|
+
</div>
|
1353
|
+
</div>
|
1354
|
+
<div class="tags">
|
1355
|
+
<p class="tag_title">Parameters:</p>
|
1356
|
+
<ul class="param">
|
1357
|
+
|
1358
|
+
<li>
|
1359
|
+
|
1360
|
+
<span class='name'>version</span>
|
1361
|
+
|
1362
|
+
|
1363
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1364
|
+
|
1365
|
+
|
1366
|
+
|
1367
|
+
—
|
1368
|
+
<div class='inline'>
|
1369
|
+
<p>Version</p>
|
1370
|
+
</div>
|
1371
|
+
|
1372
|
+
</li>
|
1373
|
+
|
1374
|
+
</ul>
|
1375
|
+
|
1376
|
+
<p class="tag_title">Returns:</p>
|
1377
|
+
<ul class="return">
|
1378
|
+
|
1379
|
+
<li>
|
1380
|
+
|
1381
|
+
|
1382
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1383
|
+
|
1384
|
+
|
1385
|
+
|
1386
|
+
—
|
1387
|
+
<div class='inline'>
|
1388
|
+
<p>New version number</p>
|
1389
|
+
</div>
|
1390
|
+
|
1391
|
+
</li>
|
1392
|
+
|
1393
|
+
</ul>
|
1394
|
+
|
1395
|
+
</div><table class="source_code">
|
1396
|
+
<tr>
|
1397
|
+
<td>
|
1398
|
+
<pre class="lines">
|
1399
|
+
|
1400
|
+
|
1401
|
+
212
|
1402
|
+
213
|
1403
|
+
214
|
1404
|
+
215
|
1405
|
+
216
|
1406
|
+
217
|
1407
|
+
218
|
1408
|
+
219
|
1409
|
+
220
|
1410
|
+
221
|
1411
|
+
222
|
1412
|
+
223
|
1413
|
+
224
|
1414
|
+
225</pre>
|
1415
|
+
</td>
|
1416
|
+
<td>
|
1417
|
+
<pre class="code"><span class="info file"># File 'lib/chef/knife/github_deploy.rb', line 212</span>
|
1418
|
+
|
1419
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_up_version'>up_version</span><span class='lparen'>(</span><span class='id identifier rubyid_version'>version</span><span class='rparen'>)</span>
|
1420
|
+
<span class='kw'>while</span> <span class='kw'>true</span> <span class='kw'>do</span>
|
1421
|
+
<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'>"</span><span class='tstring_content'>Trying to deploy version </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_version'>version</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1422
|
+
<span class='kw'>if</span> <span class='ivar'>@versions</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_version'>version</span><span class='rparen'>)</span>
|
1423
|
+
<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'>"</span><span class='tstring_content'>Version </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_version'>version</span><span class='rbrace'>}</span><span class='tstring_content'> is already in chef</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1424
|
+
<span class='id identifier rubyid_vt'>vt</span> <span class='op'>=</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>
|
1425
|
+
<span class='id identifier rubyid_ui'>ui</span><span class='period'>.</span><span class='id identifier rubyid_confirm'>confirm</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Shall I bump the version to </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_vt'>vt</span><span class='rbrace'>}</span><span class='tstring_content'> (No to Cancel)</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1426
|
+
<span class='id identifier rubyid_version'>version</span> <span class='op'>=</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>
|
1427
|
+
<span class='kw'>else</span>
|
1428
|
+
<span class='kw'>break</span>
|
1429
|
+
<span class='kw'>end</span>
|
1430
|
+
<span class='kw'>end</span>
|
1431
|
+
<span class='id identifier rubyid_version'>version</span>
|
1432
|
+
<span class='kw'>end</span></pre>
|
1433
|
+
</td>
|
1434
|
+
</tr>
|
1435
|
+
</table>
|
1436
|
+
</div>
|
1437
|
+
|
1438
|
+
</div>
|
1439
|
+
|
1440
|
+
</div>
|
1441
|
+
|
1442
|
+
<div id="footer">
|
1443
|
+
Generated on Wed Oct 30 20:03:34 2013 by
|
1444
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1445
|
+
0.8.7.2 (ruby-1.9.3).
|
1446
|
+
</div>
|
1447
|
+
|
1448
|
+
</body>
|
1449
|
+
</html>
|