rook 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +124 -37
- data/bin/rook +8 -902
- data/doc-api/classes/BZ2.html +111 -0
- data/doc-api/classes/BZ2/Reader.html +234 -0
- data/doc-api/classes/Digest.html +107 -0
- data/doc-api/classes/Digest/Base.html +254 -0
- data/doc-api/classes/Enumerable.html +430 -0
- data/doc-api/classes/File.html +208 -0
- data/doc-api/classes/FileUtils.html +758 -0
- data/doc-api/classes/Kernel.html +317 -0
- data/doc-api/classes/Rook.html +148 -0
- data/doc-api/classes/Rook/Assertion.html +164 -0
- data/doc-api/classes/Rook/AssertionError.html +111 -0
- data/doc-api/classes/Rook/CommandOptionError.html +113 -0
- data/doc-api/classes/Rook/Commands.html +1158 -0
- data/doc-api/classes/Rook/Cookbook.html +357 -0
- data/doc-api/classes/Rook/CookbookError.html +161 -0
- data/doc-api/classes/Rook/CookbookValidator.html +215 -0
- data/doc-api/classes/Rook/Kitchen.html +875 -0
- data/doc-api/classes/Rook/KitchenHelper.html +386 -0
- data/doc-api/classes/Rook/Main.html +325 -0
- data/doc-api/classes/Rook/Parameters.html +443 -0
- data/doc-api/classes/Rook/Recipe.html +546 -0
- data/doc-api/classes/Rook/RookError.html +111 -0
- data/doc-api/classes/Rook/Util.html +408 -0
- data/doc-api/classes/Rook/Util/UndefinedPropertyError.html +160 -0
- data/doc-api/created.rid +1 -0
- data/doc-api/files/__/README_txt.html +313 -0
- data/doc-api/files/rook/commands_rb.html +115 -0
- data/doc-api/files/rook/cookbook_rb.html +115 -0
- data/doc-api/files/rook/helper/bz2_rb.html +114 -0
- data/doc-api/files/rook/helper/digest_rb.html +114 -0
- data/doc-api/files/rook/helper/enumerable_rb.html +107 -0
- data/doc-api/files/rook/helper/file_rb.html +107 -0
- data/doc-api/files/rook/helper/fileutils_rb.html +124 -0
- data/doc-api/files/rook/helper/kernel_rb.html +107 -0
- data/doc-api/files/rook/kitchen_rb.html +117 -0
- data/doc-api/files/rook/main_rb.html +117 -0
- data/doc-api/files/rook/recipe_rb.html +114 -0
- data/doc-api/files/rook/util_rb.html +115 -0
- data/doc-api/files/rook_rb.html +122 -0
- data/doc-api/fr_class_index.html +50 -0
- data/doc-api/fr_file_index.html +40 -0
- data/doc-api/fr_method_index.html +181 -0
- data/doc-api/index.html +24 -0
- data/doc-api/rdoc-style.css +208 -0
- data/examples/hello_c/Rookbook.rb +37 -0
- data/examples/hello_c/Rookbook.yaml +45 -0
- data/examples/hello_c/hello.c +6 -3
- data/examples/project/README.txt +8 -0
- data/examples/project/Rookbook.props +1 -0
- data/examples/project/Rookbook.rb +120 -0
- data/examples/project/Rookbook.yaml +117 -0
- data/examples/project/bin/example +12 -0
- data/examples/project/example.gemspec +29 -0
- data/examples/project/lib/example.rb +36 -0
- data/examples/{archive → project}/lib/example/bar.rb +0 -0
- data/examples/{archive → project}/lib/example/baz.rb +0 -0
- data/examples/{archive → project}/lib/example/foo.rb +0 -0
- data/examples/project/setup.rb +1331 -0
- data/examples/project/test/test.rb +27 -0
- data/lib/rook.rb +50 -0
- data/lib/rook/commands.rb +426 -0
- data/lib/rook/cookbook.rb +237 -0
- data/lib/rook/helper/bz2.rb +39 -0
- data/lib/rook/helper/digest.rb +76 -0
- data/lib/rook/helper/enumerable.rb +121 -0
- data/lib/rook/helper/file.rb +50 -0
- data/lib/rook/helper/fileutils.rb +340 -0
- data/lib/rook/helper/kernel.rb +108 -0
- data/lib/rook/kitchen.rb +668 -0
- data/lib/rook/main.rb +280 -0
- data/lib/rook/recipe.rb +259 -0
- data/lib/rook/rookbook.schema.yaml +156 -0
- data/lib/rook/util.rb +172 -0
- data/rook.gemspec +56 -0
- metadata +139 -45
- data/examples/archive/COPYING +0 -340
- data/examples/archive/README.txt +0 -1
- data/examples/archive/Rookbook +0 -56
- data/examples/archive/bin/example +0 -0
- data/examples/archive/doc/index.html +0 -0
- data/examples/archive/doc/index.txt +0 -0
- data/examples/archive/lib/example.rb +0 -0
- data/examples/archive/test/test1.rb +0 -0
- data/examples/archive/test/test2.rb +0 -0
- data/examples/hello_c/Rookbook +0 -24
@@ -0,0 +1,215 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Rook::CookbookValidator</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Rook::CookbookValidator</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/rook/cookbook_rb.html">
|
59
|
+
rook/cookbook.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Kwalify::Validator
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div id="method-list">
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
87
|
+
|
88
|
+
<div class="name-list">
|
89
|
+
<a href="#M000079">create_error</a>
|
90
|
+
<a href="#M000078">new</a>
|
91
|
+
<a href="#M000080">validate_hook</a>
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
|
95
|
+
</div>
|
96
|
+
|
97
|
+
|
98
|
+
<!-- if includes -->
|
99
|
+
|
100
|
+
<div id="section">
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
<!-- if method_list -->
|
110
|
+
<div id="methods">
|
111
|
+
<h3 class="section-bar">Public Class methods</h3>
|
112
|
+
|
113
|
+
<div id="method-M000078" class="method-detail">
|
114
|
+
<a name="M000078"></a>
|
115
|
+
|
116
|
+
<div class="method-heading">
|
117
|
+
<a href="#M000078" class="method-signature">
|
118
|
+
<span class="method-name">new</span><span class="method-args">()</span>
|
119
|
+
</a>
|
120
|
+
</div>
|
121
|
+
|
122
|
+
<div class="method-description">
|
123
|
+
<p><a class="source-toggle" href="#"
|
124
|
+
onclick="toggleCode('M000078-source');return false;">[Source]</a></p>
|
125
|
+
<div class="method-source-code" id="M000078-source">
|
126
|
+
<pre>
|
127
|
+
<span class="ruby-comment cmt"># File rook/cookbook.rb, line 28</span>
|
128
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>()
|
129
|
+
<span class="ruby-keyword kw">super</span>(<span class="ruby-ivar">@@schema</span>)
|
130
|
+
<span class="ruby-keyword kw">end</span>
|
131
|
+
</pre>
|
132
|
+
</div>
|
133
|
+
</div>
|
134
|
+
</div>
|
135
|
+
|
136
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
137
|
+
|
138
|
+
<div id="method-M000079" class="method-detail">
|
139
|
+
<a name="M000079"></a>
|
140
|
+
|
141
|
+
<div class="method-heading">
|
142
|
+
<a href="#M000079" class="method-signature">
|
143
|
+
<span class="method-name">create_error</span><span class="method-args">(path, message)</span>
|
144
|
+
</a>
|
145
|
+
</div>
|
146
|
+
|
147
|
+
<div class="method-description">
|
148
|
+
<p><a class="source-toggle" href="#"
|
149
|
+
onclick="toggleCode('M000079-source');return false;">[Source]</a></p>
|
150
|
+
<div class="method-source-code" id="M000079-source">
|
151
|
+
<pre>
|
152
|
+
<span class="ruby-comment cmt"># File rook/cookbook.rb, line 33</span>
|
153
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_error</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">message</span>)
|
154
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-constant">Kwalify</span><span class="ruby-operator">::</span><span class="ruby-constant">ValidationError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">path</span>)
|
155
|
+
<span class="ruby-keyword kw">end</span>
|
156
|
+
</pre>
|
157
|
+
</div>
|
158
|
+
</div>
|
159
|
+
</div>
|
160
|
+
|
161
|
+
<div id="method-M000080" class="method-detail">
|
162
|
+
<a name="M000080"></a>
|
163
|
+
|
164
|
+
<div class="method-heading">
|
165
|
+
<a href="#M000080" class="method-signature">
|
166
|
+
<span class="method-name">validate_hook</span><span class="method-args">(value, rule, path, errors)</span>
|
167
|
+
</a>
|
168
|
+
</div>
|
169
|
+
|
170
|
+
<div class="method-description">
|
171
|
+
<p><a class="source-toggle" href="#"
|
172
|
+
onclick="toggleCode('M000080-source');return false;">[Source]</a></p>
|
173
|
+
<div class="method-source-code" id="M000080-source">
|
174
|
+
<pre>
|
175
|
+
<span class="ruby-comment cmt"># File rook/cookbook.rb, line 42</span>
|
176
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">validate_hook</span>(<span class="ruby-identifier">value</span>, <span class="ruby-identifier">rule</span>, <span class="ruby-identifier">path</span>, <span class="ruby-identifier">errors</span>)
|
177
|
+
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">name</span>
|
178
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'MATERIAL'</span>
|
179
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Symbol</span>)
|
180
|
+
<span class="ruby-identifier">errors</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">create_error</span>(<span class="ruby-identifier">path</span>, <span class="ruby-value str">"String or Symbol is required."</span>)
|
181
|
+
<span class="ruby-keyword kw">end</span>
|
182
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'PROPERTY'</span>
|
183
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">'value'</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">'expr'</span>)
|
184
|
+
<span class="ruby-identifier">errors</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">create_error</span>(<span class="ruby-identifier">path</span>, <span class="ruby-value str">"either 'value' or 'expr' is required."</span>)
|
185
|
+
<span class="ruby-keyword kw">end</span>
|
186
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'PROP'</span>
|
187
|
+
<span class="ruby-identifier">value</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
|
188
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">k</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
|
189
|
+
<span class="ruby-identifier">errors</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">error</span>(<span class="ruby-node">"#{path}/#{k}"</span>, <span class="ruby-value str">"property name is not a string."</span>)
|
190
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">k</span> <span class="ruby-operator">!~</span> <span class="ruby-regexp re">/\A[a-zA-Z_][-\w]*\*?\z/</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">k</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">'.desc'</span>
|
191
|
+
<span class="ruby-identifier">errors</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">error</span>(<span class="ruby-node">"#{path}/#{k}"</span>, <span class="ruby-value str">"invlaid property name."</span>)
|
192
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">k</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?*</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">v</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
|
193
|
+
<span class="ruby-identifier">errors</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">create_error</span>(<span class="ruby-node">"#{path}/#{k}"</span>, <span class="ruby-value str">"expr is not a string."</span>)
|
194
|
+
<span class="ruby-keyword kw">end</span>
|
195
|
+
<span class="ruby-keyword kw">end</span>
|
196
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">name</span>
|
197
|
+
<span class="ruby-keyword kw">end</span>
|
198
|
+
</pre>
|
199
|
+
</div>
|
200
|
+
</div>
|
201
|
+
</div>
|
202
|
+
|
203
|
+
|
204
|
+
</div>
|
205
|
+
|
206
|
+
|
207
|
+
</div>
|
208
|
+
|
209
|
+
|
210
|
+
<div id="validator-badges">
|
211
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
212
|
+
</div>
|
213
|
+
|
214
|
+
</body>
|
215
|
+
</html>
|
@@ -0,0 +1,875 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Rook::Kitchen</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Rook::Kitchen</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/rook/kitchen_rb.html">
|
59
|
+
rook/kitchen.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
<div id="description">
|
82
|
+
<p>
|
83
|
+
kitchen class
|
84
|
+
</p>
|
85
|
+
<p>
|
86
|
+
ex.
|
87
|
+
</p>
|
88
|
+
<pre>
|
89
|
+
cookbooks, errors = Cookbook.load_yamlfile('Rookbook.yaml')
|
90
|
+
kitchen = Kitchen.new
|
91
|
+
cookbooks.each { |book| kitchen.load_book(book) }
|
92
|
+
kitchen.start_cooking('product_name')
|
93
|
+
</pre>
|
94
|
+
|
95
|
+
</div>
|
96
|
+
|
97
|
+
|
98
|
+
</div>
|
99
|
+
|
100
|
+
<div id="method-list">
|
101
|
+
<h3 class="section-bar">Methods</h3>
|
102
|
+
|
103
|
+
<div class="name-list">
|
104
|
+
<a href="#M000119">add_material</a>
|
105
|
+
<a href="#M000116">add_precooking</a>
|
106
|
+
<a href="#M000117">add_property</a>
|
107
|
+
<a href="#M000121">add_recipe</a>
|
108
|
+
<a href="#M000120">add_recipe_hash</a>
|
109
|
+
<a href="#M000118">add_variable</a>
|
110
|
+
<a href="#M000126">cook</a>
|
111
|
+
<a href="#M000122">find_generic_recipe</a>
|
112
|
+
<a href="#M000124">find_recipe</a>
|
113
|
+
<a href="#M000123">find_specific_recipe</a>
|
114
|
+
<a href="#M000110">get_property</a>
|
115
|
+
<a href="#M000111">get_variable</a>
|
116
|
+
<a href="#M000108">has_property?</a>
|
117
|
+
<a href="#M000109">has_variable?</a>
|
118
|
+
<a href="#M000113">load_book</a>
|
119
|
+
<a href="#M000112">load_books</a>
|
120
|
+
<a href="#M000114">load_script</a>
|
121
|
+
<a href="#M000115">load_script!</a>
|
122
|
+
<a href="#M000107">new</a>
|
123
|
+
<a href="#M000125">start_cooking</a>
|
124
|
+
</div>
|
125
|
+
</div>
|
126
|
+
|
127
|
+
</div>
|
128
|
+
|
129
|
+
|
130
|
+
<!-- if includes -->
|
131
|
+
<div id="includes">
|
132
|
+
<h3 class="section-bar">Included Modules</h3>
|
133
|
+
|
134
|
+
<div id="includes-list">
|
135
|
+
<span class="include-name"><a href="Assertion.html">Assertion</a></span>
|
136
|
+
<span class="include-name"><a href="KitchenHelper.html">KitchenHelper</a></span>
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
|
140
|
+
<div id="section">
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
<div id="attribute-list">
|
147
|
+
<h3 class="section-bar">Attributes</h3>
|
148
|
+
|
149
|
+
<div class="name-list">
|
150
|
+
<table>
|
151
|
+
<tr class="top-aligned-row context-row">
|
152
|
+
<td class="context-item-name">materials</td>
|
153
|
+
<td class="context-item-value"> [R] </td>
|
154
|
+
<td class="context-item-desc"></td>
|
155
|
+
</tr>
|
156
|
+
<tr class="top-aligned-row context-row">
|
157
|
+
<td class="context-item-name">precookings</td>
|
158
|
+
<td class="context-item-value"> [R] </td>
|
159
|
+
<td class="context-item-desc"></td>
|
160
|
+
</tr>
|
161
|
+
<tr class="top-aligned-row context-row">
|
162
|
+
<td class="context-item-name">properties</td>
|
163
|
+
<td class="context-item-value"> [R] </td>
|
164
|
+
<td class="context-item-desc"></td>
|
165
|
+
</tr>
|
166
|
+
<tr class="top-aligned-row context-row">
|
167
|
+
<td class="context-item-name">recipes</td>
|
168
|
+
<td class="context-item-value"> [R] </td>
|
169
|
+
<td class="context-item-desc"></td>
|
170
|
+
</tr>
|
171
|
+
<tr class="top-aligned-row context-row">
|
172
|
+
<td class="context-item-name">variables</td>
|
173
|
+
<td class="context-item-value"> [R] </td>
|
174
|
+
<td class="context-item-desc"></td>
|
175
|
+
</tr>
|
176
|
+
</table>
|
177
|
+
</div>
|
178
|
+
</div>
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
<!-- if method_list -->
|
183
|
+
<div id="methods">
|
184
|
+
<h3 class="section-bar">Public Class methods</h3>
|
185
|
+
|
186
|
+
<div id="method-M000107" class="method-detail">
|
187
|
+
<a name="M000107"></a>
|
188
|
+
|
189
|
+
<div class="method-heading">
|
190
|
+
<a href="#M000107" class="method-signature">
|
191
|
+
<span class="method-name">new</span><span class="method-args">(properties={}, options={})</span>
|
192
|
+
</a>
|
193
|
+
</div>
|
194
|
+
|
195
|
+
<div class="method-description">
|
196
|
+
<p><a class="source-toggle" href="#"
|
197
|
+
onclick="toggleCode('M000107-source');return false;">[Source]</a></p>
|
198
|
+
<div class="method-source-code" id="M000107-source">
|
199
|
+
<pre>
|
200
|
+
<span class="ruby-comment cmt"># File rook/kitchen.rb, line 294</span>
|
201
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">properties</span>={}, <span class="ruby-identifier">options</span>={})
|
202
|
+
<span class="ruby-ivar">@parameters</span> = <span class="ruby-constant">Parameters</span>.<span class="ruby-identifier">new</span>
|
203
|
+
<span class="ruby-ivar">@properties</span> = []
|
204
|
+
<span class="ruby-ivar">@variables</span> = []
|
205
|
+
<span class="ruby-identifier">properties</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
|
206
|
+
<span class="ruby-identifier">add_property</span>({<span class="ruby-value str">'name'</span>=<span class="ruby-operator">></span><span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-value str">'value'</span>=<span class="ruby-operator">></span><span class="ruby-identifier">value</span>})
|
207
|
+
<span class="ruby-keyword kw">end</span>
|
208
|
+
<span class="ruby-ivar">@recipes</span> = []
|
209
|
+
<span class="ruby-ivar">@recipe_table</span> = {}
|
210
|
+
<span class="ruby-ivar">@materials</span> = []
|
211
|
+
<span class="ruby-ivar">@precookings</span> = []
|
212
|
+
<span class="ruby-ivar">@forced</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:forced</span>]
|
213
|
+
<span class="ruby-comment cmt">#@verbose = options[:verbose]</span>
|
214
|
+
<span class="ruby-comment cmt">#@noexec = options[:noexec]</span>
|
215
|
+
<span class="ruby-keyword kw">end</span>
|
216
|
+
</pre>
|
217
|
+
</div>
|
218
|
+
</div>
|
219
|
+
</div>
|
220
|
+
|
221
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
222
|
+
|
223
|
+
<div id="method-M000119" class="method-detail">
|
224
|
+
<a name="M000119"></a>
|
225
|
+
|
226
|
+
<div class="method-heading">
|
227
|
+
<a href="#M000119" class="method-signature">
|
228
|
+
<span class="method-name">add_material</span><span class="method-args">(material_str)</span>
|
229
|
+
</a>
|
230
|
+
</div>
|
231
|
+
|
232
|
+
<div class="method-description">
|
233
|
+
<p><a class="source-toggle" href="#"
|
234
|
+
onclick="toggleCode('M000119-source');return false;">[Source]</a></p>
|
235
|
+
<div class="method-source-code" id="M000119-source">
|
236
|
+
<pre>
|
237
|
+
<span class="ruby-comment cmt"># File rook/kitchen.rb, line 424</span>
|
238
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_material</span>(<span class="ruby-identifier">material_str</span>)
|
239
|
+
<span class="ruby-identifier">mat_str</span> = <span class="ruby-ivar">@parameters</span>.<span class="ruby-identifier">evaluate_value</span>(<span class="ruby-identifier">material_str</span>)
|
240
|
+
<span class="ruby-ivar">@materials</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">mat_str</span>
|
241
|
+
<span class="ruby-keyword kw">end</span>
|
242
|
+
</pre>
|
243
|
+
</div>
|
244
|
+
</div>
|
245
|
+
</div>
|
246
|
+
|
247
|
+
<div id="method-M000116" class="method-detail">
|
248
|
+
<a name="M000116"></a>
|
249
|
+
|
250
|
+
<div class="method-heading">
|
251
|
+
<a href="#M000116" class="method-signature">
|
252
|
+
<span class="method-name">add_precooking</span><span class="method-args">(code_str, bookname='', linenum=1)</span>
|
253
|
+
</a>
|
254
|
+
</div>
|
255
|
+
|
256
|
+
<div class="method-description">
|
257
|
+
<p><a class="source-toggle" href="#"
|
258
|
+
onclick="toggleCode('M000116-source');return false;">[Source]</a></p>
|
259
|
+
<div class="method-source-code" id="M000116-source">
|
260
|
+
<pre>
|
261
|
+
<span class="ruby-comment cmt"># File rook/kitchen.rb, line 374</span>
|
262
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_precooking</span>(<span class="ruby-identifier">code_str</span>, <span class="ruby-identifier">bookname</span>=<span class="ruby-value str">''</span>, <span class="ruby-identifier">linenum</span>=<span class="ruby-value">1</span>)
|
263
|
+
<span class="ruby-ivar">@precookings</span> <span class="ruby-operator"><<</span> [<span class="ruby-identifier">code_str</span>, <span class="ruby-identifier">bookname</span>, <span class="ruby-identifier">linenum</span>]
|
264
|
+
<span class="ruby-constant">Util</span>.<span class="ruby-identifier">evaluate</span>(<span class="ruby-identifier">code_str</span>, <span class="ruby-identifier">bookname</span>, <span class="ruby-identifier">linenum</span>) <span class="ruby-comment cmt"># or instance_eval?</span>
|
265
|
+
<span class="ruby-keyword kw">end</span>
|
266
|
+
</pre>
|
267
|
+
</div>
|
268
|
+
</div>
|
269
|
+
</div>
|
270
|
+
|
271
|
+
<div id="method-M000117" class="method-detail">
|
272
|
+
<a name="M000117"></a>
|
273
|
+
|
274
|
+
<div class="method-heading">
|
275
|
+
<a href="#M000117" class="method-signature">
|
276
|
+
<span class="method-name">add_property</span><span class="method-args">(hash, bookname='')</span>
|
277
|
+
</a>
|
278
|
+
</div>
|
279
|
+
|
280
|
+
<div class="method-description">
|
281
|
+
<p><a class="source-toggle" href="#"
|
282
|
+
onclick="toggleCode('M000117-source');return false;">[Source]</a></p>
|
283
|
+
<div class="method-source-code" id="M000117-source">
|
284
|
+
<pre>
|
285
|
+
<span class="ruby-comment cmt"># File rook/kitchen.rb, line 380</span>
|
286
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_property</span>(<span class="ruby-identifier">hash</span>, <span class="ruby-identifier">bookname</span>=<span class="ruby-value str">''</span>)
|
287
|
+
<span class="ruby-identifier">hash</span>[<span class="ruby-value str">'access'</span>] <span class="ruby-operator">||=</span> <span class="ruby-value str">'public'</span>
|
288
|
+
<span class="ruby-identifier">name</span> = <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'name'</span>]
|
289
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@parameters</span>.<span class="ruby-identifier">has_property?</span>(<span class="ruby-identifier">name</span>)
|
290
|
+
<span class="ruby-identifier">value</span> = <span class="ruby-ivar">@parameters</span>.<span class="ruby-identifier">get_property</span>(<span class="ruby-identifier">name</span>)
|
291
|
+
<span class="ruby-keyword kw">else</span>
|
292
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">'value'</span>)
|
293
|
+
<span class="ruby-identifier">value</span> = <span class="ruby-ivar">@parameters</span>.<span class="ruby-identifier">evaluate_value</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-value str">'value'</span>])
|
294
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">'expr'</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">'value*'</span>)
|
295
|
+
<span class="ruby-identifier">expr</span> = <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">'expr'</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'expr'</span>] <span class="ruby-operator">:</span> <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'value*'</span>]
|
296
|
+
<span class="ruby-identifier">expr</span> = <span class="ruby-ivar">@parameters</span>.<span class="ruby-identifier">evaluate_value</span>(<span class="ruby-identifier">expr</span>)
|
297
|
+
<span class="ruby-identifier">value</span> = <span class="ruby-ivar">@valuemap</span>.<span class="ruby-identifier">evaluate_expr</span>(<span class="ruby-identifier">expr</span>, <span class="ruby-identifier">bookname</span>, <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'linenum'</span>])
|
298
|
+
<span class="ruby-keyword kw">else</span>
|
299
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">RookError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"property '#{name}': no value."</span>)
|
300
|
+
<span class="ruby-keyword kw">end</span>
|
301
|
+
<span class="ruby-ivar">@parameters</span>.<span class="ruby-identifier">set_property</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>)
|
302
|
+
<span class="ruby-identifier">hash</span>[<span class="ruby-value str">'value'</span>] = <span class="ruby-identifier">value</span>
|
303
|
+
<span class="ruby-ivar">@properties</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">hash</span>
|
304
|
+
<span class="ruby-keyword kw">end</span>
|
305
|
+
<span class="ruby-comment cmt">#eval "$#{name} = value"</span>
|
306
|
+
<span class="ruby-keyword kw">end</span>
|
307
|
+
</pre>
|
308
|
+
</div>
|
309
|
+
</div>
|
310
|
+
</div>
|
311
|
+
|
312
|
+
<div id="method-M000121" class="method-detail">
|
313
|
+
<a name="M000121"></a>
|
314
|
+
|
315
|
+
<div class="method-heading">
|
316
|
+
<a href="#M000121" class="method-signature">
|
317
|
+
<span class="method-name">add_recipe</span><span class="method-args">(recipe)</span>
|
318
|
+
</a>
|
319
|
+
</div>
|
320
|
+
|
321
|
+
<div class="method-description">
|
322
|
+
<p><a class="source-toggle" href="#"
|
323
|
+
onclick="toggleCode('M000121-source');return false;">[Source]</a></p>
|
324
|
+
<div class="method-source-code" id="M000121-source">
|
325
|
+
<pre>
|
326
|
+
<span class="ruby-comment cmt"># File rook/kitchen.rb, line 447</span>
|
327
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_recipe</span>(<span class="ruby-identifier">recipe</span>)
|
328
|
+
<span class="ruby-ivar">@recipes</span>.<span class="ruby-identifier">delete_if</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">product</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">recipe</span>.<span class="ruby-identifier">product</span> } <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@recipe_table</span>[<span class="ruby-identifier">recipe</span>.<span class="ruby-identifier">product</span>]
|
329
|
+
<span class="ruby-ivar">@recipe_table</span>[<span class="ruby-identifier">recipe</span>.<span class="ruby-identifier">product</span>] = <span class="ruby-identifier">recipe</span>
|
330
|
+
<span class="ruby-ivar">@recipes</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">recipe</span>
|
331
|
+
<span class="ruby-keyword kw">end</span>
|
332
|
+
</pre>
|
333
|
+
</div>
|
334
|
+
</div>
|
335
|
+
</div>
|
336
|
+
|
337
|
+
<div id="method-M000120" class="method-detail">
|
338
|
+
<a name="M000120"></a>
|
339
|
+
|
340
|
+
<div class="method-heading">
|
341
|
+
<a href="#M000120" class="method-signature">
|
342
|
+
<span class="method-name">add_recipe_hash</span><span class="method-args">(hash)</span>
|
343
|
+
</a>
|
344
|
+
</div>
|
345
|
+
|
346
|
+
<div class="method-description">
|
347
|
+
<p><a class="source-toggle" href="#"
|
348
|
+
onclick="toggleCode('M000120-source');return false;">[Source]</a></p>
|
349
|
+
<div class="method-source-code" id="M000120-source">
|
350
|
+
<pre>
|
351
|
+
<span class="ruby-comment cmt"># File rook/kitchen.rb, line 430</span>
|
352
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_recipe_hash</span>(<span class="ruby-identifier">hash</span>)
|
353
|
+
<span class="ruby-node">%w[ingreds byprods coprods options]</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
|
354
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-node">"#{key}*"</span>)
|
355
|
+
<span class="ruby-identifier">val</span> = <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-node">"#{key}*"</span>)
|
356
|
+
<span class="ruby-identifier">assert</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>), <span class="ruby-node">"val.class=#{val.class}"</span>
|
357
|
+
<span class="ruby-identifier">val</span> = <span class="ruby-ivar">@parameters</span>.<span class="ruby-identifier">evaluate_expr</span>(<span class="ruby-identifier">val</span>)
|
358
|
+
<span class="ruby-identifier">val</span> = [ <span class="ruby-identifier">val</span> ] <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
|
359
|
+
<span class="ruby-identifier">hash</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">val</span>
|
360
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">key</span>)
|
361
|
+
<span class="ruby-identifier">val</span> = <span class="ruby-ivar">@parameters</span>.<span class="ruby-identifier">evaluate_expr</span>(<span class="ruby-identifier">val</span>)
|
362
|
+
<span class="ruby-identifier">hash</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">val</span>
|
363
|
+
<span class="ruby-keyword kw">end</span>
|
364
|
+
<span class="ruby-keyword kw">end</span>
|
365
|
+
<span class="ruby-identifier">r</span> = <span class="ruby-constant">Recipe</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-value str">'product'</span>])
|
366
|
+
<span class="ruby-identifier">add_recipe</span>(<span class="ruby-identifier">r</span>)
|
367
|
+
<span class="ruby-keyword kw">end</span>
|
368
|
+
</pre>
|
369
|
+
</div>
|
370
|
+
</div>
|
371
|
+
</div>
|
372
|
+
|
373
|
+
<div id="method-M000118" class="method-detail">
|
374
|
+
<a name="M000118"></a>
|
375
|
+
|
376
|
+
<div class="method-heading">
|
377
|
+
<a href="#M000118" class="method-signature">
|
378
|
+
<span class="method-name">add_variable</span><span class="method-args">(hash, bookname='')</span>
|
379
|
+
</a>
|
380
|
+
</div>
|
381
|
+
|
382
|
+
<div class="method-description">
|
383
|
+
<p><a class="source-toggle" href="#"
|
384
|
+
onclick="toggleCode('M000118-source');return false;">[Source]</a></p>
|
385
|
+
<div class="method-source-code" id="M000118-source">
|
386
|
+
<pre>
|
387
|
+
<span class="ruby-comment cmt"># File rook/kitchen.rb, line 403</span>
|
388
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_variable</span>(<span class="ruby-identifier">hash</span>, <span class="ruby-identifier">bookname</span>=<span class="ruby-value str">''</span>)
|
389
|
+
<span class="ruby-identifier">name</span> = <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'name'</span>]
|
390
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@parameters</span>.<span class="ruby-identifier">has_variable?</span>(<span class="ruby-identifier">name</span>)
|
391
|
+
<span class="ruby-ivar">@variables</span>.<span class="ruby-identifier">delete_if</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">h</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>[<span class="ruby-value str">'name'</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">name</span> }
|
392
|
+
<span class="ruby-keyword kw">end</span>
|
393
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">'value'</span>)
|
394
|
+
<span class="ruby-identifier">value</span> = <span class="ruby-ivar">@parameters</span>.<span class="ruby-identifier">evaluate_value</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-value str">'value'</span>])
|
395
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">'expr'</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">'value*'</span>)
|
396
|
+
<span class="ruby-identifier">expr</span> = <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">'expr'</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'expr'</span>] <span class="ruby-operator">:</span> <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'value*'</span>]
|
397
|
+
<span class="ruby-identifier">linenum</span> = <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'linenum'</span>] <span class="ruby-operator">||</span> <span class="ruby-value">1</span>
|
398
|
+
<span class="ruby-identifier">expr</span> = <span class="ruby-ivar">@parameters</span>.<span class="ruby-identifier">evaluate_value</span>(<span class="ruby-identifier">expr</span>)
|
399
|
+
<span class="ruby-identifier">value</span> = <span class="ruby-ivar">@parameters</span>.<span class="ruby-identifier">evaluate_expr</span>(<span class="ruby-identifier">expr</span>, <span class="ruby-identifier">bookname</span>, <span class="ruby-identifier">linenum</span>)
|
400
|
+
<span class="ruby-keyword kw">else</span>
|
401
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">RookError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"variable '#{name}': no value."</span>)
|
402
|
+
<span class="ruby-keyword kw">end</span>
|
403
|
+
<span class="ruby-ivar">@parameters</span>.<span class="ruby-identifier">set_variable</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>)
|
404
|
+
<span class="ruby-identifier">hash</span>[<span class="ruby-value str">'value'</span>] = <span class="ruby-identifier">value</span>
|
405
|
+
<span class="ruby-ivar">@variables</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">hash</span>
|
406
|
+
<span class="ruby-keyword kw">end</span>
|
407
|
+
</pre>
|
408
|
+
</div>
|
409
|
+
</div>
|
410
|
+
</div>
|
411
|
+
|
412
|
+
<div id="method-M000126" class="method-detail">
|
413
|
+
<a name="M000126"></a>
|
414
|
+
|
415
|
+
<div class="method-heading">
|
416
|
+
<a href="#M000126" class="method-signature">
|
417
|
+
<span class="method-name">cook</span><span class="method-args">(product, cooking, level=0, verbose=nil, parent_fingerprint=false)</span>
|
418
|
+
</a>
|
419
|
+
</div>
|
420
|
+
|
421
|
+
<div class="method-description">
|
422
|
+
<p>
|
423
|
+
cook product
|
424
|
+
</p>
|
425
|
+
<p>
|
426
|
+
return true when product recipe is invoked, else return false.
|
427
|
+
</p>
|
428
|
+
<p><a class="source-toggle" href="#"
|
429
|
+
onclick="toggleCode('M000126-source');return false;">[Source]</a></p>
|
430
|
+
<div class="method-source-code" id="M000126-source">
|
431
|
+
<pre>
|
432
|
+
<span class="ruby-comment cmt"># File rook/kitchen.rb, line 485</span>
|
433
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cook</span>(<span class="ruby-identifier">product</span>, <span class="ruby-identifier">cooking</span>, <span class="ruby-identifier">level</span>=<span class="ruby-value">0</span>, <span class="ruby-identifier">verbose</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">parent_fingerprint</span>=<span class="ruby-keyword kw">false</span>)
|
434
|
+
<span class="ruby-comment cmt">## check</span>
|
435
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@materials</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">product</span>)
|
436
|
+
<span class="ruby-identifier">log</span>(<span class="ruby-node">"skip '#{Util.to_str(product)}': material."</span>, <span class="ruby-identifier">level</span>, <span class="ruby-identifier">verbose</span>)
|
437
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
|
438
|
+
<span class="ruby-keyword kw">end</span>
|
439
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">cooking</span>.<span class="ruby-identifier">cooked?</span>(<span class="ruby-identifier">product</span>)
|
440
|
+
<span class="ruby-identifier">log</span>(<span class="ruby-node">"skip '#{Util.to_str(product)}': already cooked."</span>, <span class="ruby-identifier">level</span>, <span class="ruby-identifier">verbose</span>)
|
441
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
|
442
|
+
<span class="ruby-keyword kw">end</span>
|
443
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">cooking</span>.<span class="ruby-identifier">now_cooking?</span>(<span class="ruby-identifier">product</span>)
|
444
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">RookError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"'#{Util.to_str(product)}': recipe is recursively looped."</span>)
|
445
|
+
<span class="ruby-keyword kw">end</span>
|
446
|
+
|
447
|
+
<span class="ruby-comment cmt">## find recipe</span>
|
448
|
+
<span class="ruby-identifier">recipe</span> = <span class="ruby-identifier">find_recipe</span>(<span class="ruby-identifier">product</span>)
|
449
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">recipe</span>
|
450
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">product</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">test</span>(<span class="ruby-value">?e</span>, <span class="ruby-identifier">product</span>)
|
451
|
+
<span class="ruby-identifier">log</span>(<span class="ruby-node">"skip '#{Util.to_str(product)}': raw ingredient."</span>, <span class="ruby-identifier">level</span>, <span class="ruby-identifier">verbose</span>)
|
452
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
|
453
|
+
<span class="ruby-keyword kw">else</span>
|
454
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">RookError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"'#{Util.to_str(product)}': recipe not found."</span>)
|
455
|
+
<span class="ruby-keyword kw">end</span>
|
456
|
+
<span class="ruby-keyword kw">end</span>
|
457
|
+
<span class="ruby-identifier">recipe</span> = <span class="ruby-identifier">recipe</span>.<span class="ruby-identifier">to_specific</span>(<span class="ruby-identifier">product</span>)
|
458
|
+
|
459
|
+
<span class="ruby-comment cmt">## start cooking</span>
|
460
|
+
<span class="ruby-identifier">cooking</span>.<span class="ruby-identifier">start</span>(<span class="ruby-identifier">recipe</span>)
|
461
|
+
<span class="ruby-identifier">log</span>(<span class="ruby-node">"begin '#{Util.to_str(product)}'"</span>, <span class="ruby-identifier">level</span>, <span class="ruby-identifier">recipe</span>.<span class="ruby-identifier">verbose?</span>)
|
462
|
+
<span class="ruby-identifier">flag_exec</span> = <span class="ruby-ivar">@forced</span>
|
463
|
+
|
464
|
+
<span class="ruby-comment cmt">## ingredients</span>
|
465
|
+
<span class="ruby-identifier">ingreds</span> = <span class="ruby-identifier">recipe</span>.<span class="ruby-identifier">ingreds</span> <span class="ruby-value">? </span><span class="ruby-identifier">recipe</span>.<span class="ruby-identifier">ingreds</span>.<span class="ruby-identifier">dup</span> <span class="ruby-operator">:</span> []
|
466
|
+
<span class="ruby-identifier">ingreds</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">recipe</span>.<span class="ruby-identifier">options</span>.<span class="ruby-identifier">find_all</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">test</span>(<span class="ruby-value">?e</span>, <span class="ruby-identifier">f</span>) }) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">recipe</span>.<span class="ruby-identifier">options</span>
|
467
|
+
<span class="ruby-comment cmt"># ingreds.each do |ingred|</span>
|
468
|
+
<span class="ruby-comment cmt"># flag = cook(ingred, cooking, level+1, recipe.verbose?, recipe.fingerprint)</span>
|
469
|
+
<span class="ruby-comment cmt"># flag_exec = true if flag</span>
|
470
|
+
<span class="ruby-comment cmt"># end</span>
|
471
|
+
|
472
|
+
<span class="ruby-comment cmt">## execute when</span>
|
473
|
+
<span class="ruby-comment cmt">## * command-line option -F specified</span>
|
474
|
+
<span class="ruby-comment cmt">## * executed at least one recipe of ingredients</span>
|
475
|
+
<span class="ruby-comment cmt">## * recipe attribute 'forced' is true</span>
|
476
|
+
<span class="ruby-comment cmt">## * recipe is symbolic and has howoto part</span>
|
477
|
+
<span class="ruby-comment cmt">## * there isn't product</span>
|
478
|
+
<span class="ruby-comment cmt">## * recipe has no ingredient</span>
|
479
|
+
<span class="ruby-comment cmt">## * there is any ingredient which is newer than product</span>
|
480
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">flag_exec</span>
|
481
|
+
<span class="ruby-identifier">flag_exec</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">recipe</span>.<span class="ruby-identifier">forced?</span>
|
482
|
+
<span class="ruby-identifier">flag_exec</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">recipe</span>.<span class="ruby-identifier">symbolic?</span> <span class="ruby-operator">&&</span> (<span class="ruby-identifier">recipe</span>.<span class="ruby-identifier">method</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">recipe</span>.<span class="ruby-identifier">block</span>)
|
483
|
+
<span class="ruby-identifier">flag_exec</span> <span class="ruby-operator">||=</span> <span class="ruby-operator">!</span><span class="ruby-identifier">recipe</span>.<span class="ruby-identifier">symbolic?</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">test</span>(<span class="ruby-value">?e</span>, <span class="ruby-identifier">product</span>)
|
484
|
+
<span class="ruby-identifier">flag_exec</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">ingreds</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">&&</span> (<span class="ruby-identifier">recipe</span>.<span class="ruby-identifier">method</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">recipe</span>.<span class="ruby-identifier">block</span>)
|
485
|
+
<span class="ruby-keyword kw">end</span>
|
486
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">flag_exec</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">ingreds</span>.<span class="ruby-identifier">empty?</span>
|
487
|
+
<span class="ruby-identifier">prod_mtime</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">mtime</span>(<span class="ruby-identifier">product</span>)
|
488
|
+
<span class="ruby-identifier">flag_exec</span> = <span class="ruby-identifier">ingreds</span>.<span class="ruby-identifier">any?</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">test</span>(<span class="ruby-value">?e</span>, <span class="ruby-identifier">f</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">prod_mtime</span> <span class="ruby-operator"><</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">mtime</span>(<span class="ruby-identifier">f</span>) }
|
489
|
+
<span class="ruby-comment cmt">#unless flag_exec</span>
|
490
|
+
<span class="ruby-comment cmt"># log("skip '#{Util.to_str(product)}': newer than all ingredients.", level, recipe.verbose?)</span>
|
491
|
+
<span class="ruby-comment cmt">#end</span>
|
492
|
+
<span class="ruby-keyword kw">end</span>
|
493
|
+
|
494
|
+
<span class="ruby-comment cmt">## invoke ingredients' recipe</span>
|
495
|
+
<span class="ruby-comment cmt">#ingreds = recipe.ingreds ? recipe.ingreds.dup : []</span>
|
496
|
+
<span class="ruby-comment cmt">#ingreds.concat(recipe.options.find_all { |f| test(?e, f) }) if recipe.options</span>
|
497
|
+
<span class="ruby-identifier">ingreds</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ingred</span><span class="ruby-operator">|</span>
|
498
|
+
<span class="ruby-identifier">flag</span> = <span class="ruby-identifier">cook</span>(<span class="ruby-identifier">ingred</span>, <span class="ruby-identifier">cooking</span>, <span class="ruby-identifier">level</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>, <span class="ruby-identifier">recipe</span>.<span class="ruby-identifier">verbose?</span>, <span class="ruby-identifier">recipe</span>.<span class="ruby-identifier">fingerprint</span>)
|
499
|
+
<span class="ruby-identifier">flag_exec</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">flag</span>
|
500
|
+
<span class="ruby-keyword kw">end</span>
|
501
|
+
|
502
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">flag_exec</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">ingreds</span>.<span class="ruby-identifier">empty?</span>
|
503
|
+
<span class="ruby-identifier">log</span>(<span class="ruby-node">"skip '#{Util.to_str(product)}': newer than all ingredients."</span>, <span class="ruby-identifier">level</span>, <span class="ruby-identifier">recipe</span>.<span class="ruby-identifier">verbose?</span>)
|
504
|
+
<span class="ruby-keyword kw">end</span>
|
505
|
+
|
506
|
+
<span class="ruby-comment cmt">## execute method part</span>
|
507
|
+
<span class="ruby-identifier">fingerprint_value</span> = <span class="ruby-keyword kw">nil</span>
|
508
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">flag_exec</span>
|
509
|
+
<span class="ruby-identifier">flag_fp</span> = <span class="ruby-identifier">parent_fingerprint</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'ingreds'</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">recipe</span>.<span class="ruby-identifier">fingerprint</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'product'</span>
|
510
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">flag_fp</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">test</span>(<span class="ruby-value">?f</span>, <span class="ruby-identifier">product</span>)
|
511
|
+
<span class="ruby-identifier">fingerprint_value</span> = <span class="ruby-constant">Util</span>.<span class="ruby-identifier">fingerprint</span>(<span class="ruby-identifier">product</span>)
|
512
|
+
<span class="ruby-keyword kw">end</span>
|
513
|
+
<span class="ruby-identifier">report</span>(<span class="ruby-identifier">product</span>, <span class="ruby-identifier">level</span>, <span class="ruby-identifier">recipe</span>.<span class="ruby-identifier">verbose?</span>)
|
514
|
+
<span class="ruby-keyword kw">begin</span>
|
515
|
+
<span class="ruby-identifier">recipe</span>.<span class="ruby-identifier">invoke</span>(<span class="ruby-ivar">@parameters</span>)
|
516
|
+
<span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">ex</span>
|
517
|
+
<span class="ruby-identifier">prods</span> = [ <span class="ruby-identifier">recipe</span>.<span class="ruby-identifier">product</span> ]
|
518
|
+
<span class="ruby-identifier">prods</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">recipe</span>.<span class="ruby-identifier">coprods</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">recipe</span>.<span class="ruby-identifier">coprods</span>
|
519
|
+
<span class="ruby-identifier">prods</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
|
520
|
+
<span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">file</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">test</span>(<span class="ruby-value">?f</span>, <span class="ruby-identifier">file</span>)
|
521
|
+
<span class="ruby-identifier">log</span>(<span class="ruby-node">"removing '#{file}' because of #{ex.class.name} - #{ex.message}"</span>, <span class="ruby-identifier">level</span>, <span class="ruby-keyword kw">true</span>)
|
522
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">unlink</span>(<span class="ruby-identifier">file</span>)
|
523
|
+
<span class="ruby-keyword kw">end</span>
|
524
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">ex</span>
|
525
|
+
<span class="ruby-keyword kw">end</span>
|
526
|
+
<span class="ruby-keyword kw">end</span>
|
527
|
+
|
528
|
+
<span class="ruby-comment cmt">## validate whether product is generated</span>
|
529
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">recipe</span>.<span class="ruby-identifier">symbolic?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">test</span>(<span class="ruby-value">?e</span>, <span class="ruby-identifier">product</span>)
|
530
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">RookError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"product '#{Util.to_str(product)}': not generated"</span>)
|
531
|
+
<span class="ruby-keyword kw">end</span>
|
532
|
+
|
533
|
+
<span class="ruby-comment cmt">## fingerprint check</span>
|
534
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">fingerprint_value</span>
|
535
|
+
<span class="ruby-identifier">fp1</span> = <span class="ruby-identifier">fingerprint_value</span>
|
536
|
+
<span class="ruby-identifier">fp2</span> = <span class="ruby-constant">Util</span>.<span class="ruby-identifier">fingerprint</span>(<span class="ruby-identifier">product</span>)
|
537
|
+
<span class="ruby-identifier">op</span> = <span class="ruby-identifier">fp1</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">fp2</span> <span class="ruby-value">? </span><span class="ruby-value str">'=='</span> <span class="ruby-operator">:</span> <span class="ruby-value str">'!='</span>
|
538
|
+
<span class="ruby-identifier">log</span>(<span class="ruby-node">"fingerprint of #{product}: #{fp1} #{op} #{fp2}"</span>, <span class="ruby-identifier">level</span>, <span class="ruby-identifier">recipe</span>.<span class="ruby-identifier">verbose?</span>)
|
539
|
+
<span class="ruby-identifier">flag_exec</span> = <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">fp1</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">fp2</span>
|
540
|
+
<span class="ruby-keyword kw">end</span>
|
541
|
+
|
542
|
+
<span class="ruby-comment cmt">## finish cooking</span>
|
543
|
+
<span class="ruby-identifier">log</span>(<span class="ruby-node">"end '#{Util.to_str(product)}'"</span>, <span class="ruby-identifier">level</span>, <span class="ruby-identifier">recipe</span>.<span class="ruby-identifier">verbose?</span>)
|
544
|
+
<span class="ruby-identifier">cooking</span>.<span class="ruby-identifier">finish</span>(<span class="ruby-identifier">recipe</span>)
|
545
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">flag_exec</span>
|
546
|
+
|
547
|
+
<span class="ruby-keyword kw">end</span>
|
548
|
+
</pre>
|
549
|
+
</div>
|
550
|
+
</div>
|
551
|
+
</div>
|
552
|
+
|
553
|
+
<div id="method-M000122" class="method-detail">
|
554
|
+
<a name="M000122"></a>
|
555
|
+
|
556
|
+
<div class="method-heading">
|
557
|
+
<a href="#M000122" class="method-signature">
|
558
|
+
<span class="method-name">find_generic_recipe</span><span class="method-args">(product)</span>
|
559
|
+
</a>
|
560
|
+
</div>
|
561
|
+
|
562
|
+
<div class="method-description">
|
563
|
+
<p><a class="source-toggle" href="#"
|
564
|
+
onclick="toggleCode('M000122-source');return false;">[Source]</a></p>
|
565
|
+
<div class="method-source-code" id="M000122-source">
|
566
|
+
<pre>
|
567
|
+
<span class="ruby-comment cmt"># File rook/kitchen.rb, line 454</span>
|
568
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_generic_recipe</span>(<span class="ruby-identifier">product</span>)
|
569
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@recipes</span>.<span class="ruby-identifier">find</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">kind</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'generic'</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">match?</span>(<span class="ruby-identifier">product</span>) }
|
570
|
+
<span class="ruby-keyword kw">end</span>
|
571
|
+
</pre>
|
572
|
+
</div>
|
573
|
+
</div>
|
574
|
+
</div>
|
575
|
+
|
576
|
+
<div id="method-M000124" class="method-detail">
|
577
|
+
<a name="M000124"></a>
|
578
|
+
|
579
|
+
<div class="method-heading">
|
580
|
+
<a href="#M000124" class="method-signature">
|
581
|
+
<span class="method-name">find_recipe</span><span class="method-args">(product)</span>
|
582
|
+
</a>
|
583
|
+
</div>
|
584
|
+
|
585
|
+
<div class="method-description">
|
586
|
+
<p><a class="source-toggle" href="#"
|
587
|
+
onclick="toggleCode('M000124-source');return false;">[Source]</a></p>
|
588
|
+
<div class="method-source-code" id="M000124-source">
|
589
|
+
<pre>
|
590
|
+
<span class="ruby-comment cmt"># File rook/kitchen.rb, line 464</span>
|
591
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_recipe</span>(<span class="ruby-identifier">product</span>)
|
592
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">find_specific_recipe</span>(<span class="ruby-identifier">product</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">find_generic_recipe</span>(<span class="ruby-identifier">product</span>)
|
593
|
+
<span class="ruby-keyword kw">end</span>
|
594
|
+
</pre>
|
595
|
+
</div>
|
596
|
+
</div>
|
597
|
+
</div>
|
598
|
+
|
599
|
+
<div id="method-M000123" class="method-detail">
|
600
|
+
<a name="M000123"></a>
|
601
|
+
|
602
|
+
<div class="method-heading">
|
603
|
+
<a href="#M000123" class="method-signature">
|
604
|
+
<span class="method-name">find_specific_recipe</span><span class="method-args">(product)</span>
|
605
|
+
</a>
|
606
|
+
</div>
|
607
|
+
|
608
|
+
<div class="method-description">
|
609
|
+
<p><a class="source-toggle" href="#"
|
610
|
+
onclick="toggleCode('M000123-source');return false;">[Source]</a></p>
|
611
|
+
<div class="method-source-code" id="M000123-source">
|
612
|
+
<pre>
|
613
|
+
<span class="ruby-comment cmt"># File rook/kitchen.rb, line 459</span>
|
614
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_specific_recipe</span>(<span class="ruby-identifier">product</span>)
|
615
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@recipes</span>.<span class="ruby-identifier">find</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">kind</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'specific'</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">match?</span>(<span class="ruby-identifier">product</span>) }
|
616
|
+
<span class="ruby-keyword kw">end</span>
|
617
|
+
</pre>
|
618
|
+
</div>
|
619
|
+
</div>
|
620
|
+
</div>
|
621
|
+
|
622
|
+
<div id="method-M000110" class="method-detail">
|
623
|
+
<a name="M000110"></a>
|
624
|
+
|
625
|
+
<div class="method-heading">
|
626
|
+
<a href="#M000110" class="method-signature">
|
627
|
+
<span class="method-name">get_property</span><span class="method-args">(name)</span>
|
628
|
+
</a>
|
629
|
+
</div>
|
630
|
+
|
631
|
+
<div class="method-description">
|
632
|
+
<p><a class="source-toggle" href="#"
|
633
|
+
onclick="toggleCode('M000110-source');return false;">[Source]</a></p>
|
634
|
+
<div class="method-source-code" id="M000110-source">
|
635
|
+
<pre>
|
636
|
+
<span class="ruby-comment cmt"># File rook/kitchen.rb, line 322</span>
|
637
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_property</span>(<span class="ruby-identifier">name</span>)
|
638
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@parameters</span>.<span class="ruby-identifier">get_property</span>(<span class="ruby-identifier">name</span>)
|
639
|
+
<span class="ruby-keyword kw">end</span>
|
640
|
+
</pre>
|
641
|
+
</div>
|
642
|
+
</div>
|
643
|
+
</div>
|
644
|
+
|
645
|
+
<div id="method-M000111" class="method-detail">
|
646
|
+
<a name="M000111"></a>
|
647
|
+
|
648
|
+
<div class="method-heading">
|
649
|
+
<a href="#M000111" class="method-signature">
|
650
|
+
<span class="method-name">get_variable</span><span class="method-args">(name)</span>
|
651
|
+
</a>
|
652
|
+
</div>
|
653
|
+
|
654
|
+
<div class="method-description">
|
655
|
+
<p><a class="source-toggle" href="#"
|
656
|
+
onclick="toggleCode('M000111-source');return false;">[Source]</a></p>
|
657
|
+
<div class="method-source-code" id="M000111-source">
|
658
|
+
<pre>
|
659
|
+
<span class="ruby-comment cmt"># File rook/kitchen.rb, line 326</span>
|
660
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_variable</span>(<span class="ruby-identifier">name</span>)
|
661
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@parameters</span>.<span class="ruby-identifier">get_variable</span>(<span class="ruby-identifier">name</span>)
|
662
|
+
<span class="ruby-keyword kw">end</span>
|
663
|
+
</pre>
|
664
|
+
</div>
|
665
|
+
</div>
|
666
|
+
</div>
|
667
|
+
|
668
|
+
<div id="method-M000108" class="method-detail">
|
669
|
+
<a name="M000108"></a>
|
670
|
+
|
671
|
+
<div class="method-heading">
|
672
|
+
<a href="#M000108" class="method-signature">
|
673
|
+
<span class="method-name">has_property?</span><span class="method-args">(name)</span>
|
674
|
+
</a>
|
675
|
+
</div>
|
676
|
+
|
677
|
+
<div class="method-description">
|
678
|
+
<p>
|
679
|
+
attr_reader :forced, :quiet, :noexec
|
680
|
+
</p>
|
681
|
+
<p><a class="source-toggle" href="#"
|
682
|
+
onclick="toggleCode('M000108-source');return false;">[Source]</a></p>
|
683
|
+
<div class="method-source-code" id="M000108-source">
|
684
|
+
<pre>
|
685
|
+
<span class="ruby-comment cmt"># File rook/kitchen.rb, line 314</span>
|
686
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">has_property?</span>(<span class="ruby-identifier">name</span>)
|
687
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@parameters</span>.<span class="ruby-identifier">has_property?</span>(<span class="ruby-identifier">name</span>)
|
688
|
+
<span class="ruby-keyword kw">end</span>
|
689
|
+
</pre>
|
690
|
+
</div>
|
691
|
+
</div>
|
692
|
+
</div>
|
693
|
+
|
694
|
+
<div id="method-M000109" class="method-detail">
|
695
|
+
<a name="M000109"></a>
|
696
|
+
|
697
|
+
<div class="method-heading">
|
698
|
+
<a href="#M000109" class="method-signature">
|
699
|
+
<span class="method-name">has_variable?</span><span class="method-args">(name)</span>
|
700
|
+
</a>
|
701
|
+
</div>
|
702
|
+
|
703
|
+
<div class="method-description">
|
704
|
+
<p><a class="source-toggle" href="#"
|
705
|
+
onclick="toggleCode('M000109-source');return false;">[Source]</a></p>
|
706
|
+
<div class="method-source-code" id="M000109-source">
|
707
|
+
<pre>
|
708
|
+
<span class="ruby-comment cmt"># File rook/kitchen.rb, line 318</span>
|
709
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">has_variable?</span>(<span class="ruby-identifier">name</span>)
|
710
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@parameters</span>.<span class="ruby-identifier">has_variable?</span>(<span class="ruby-identifier">name</span>)
|
711
|
+
<span class="ruby-keyword kw">end</span>
|
712
|
+
</pre>
|
713
|
+
</div>
|
714
|
+
</div>
|
715
|
+
</div>
|
716
|
+
|
717
|
+
<div id="method-M000113" class="method-detail">
|
718
|
+
<a name="M000113"></a>
|
719
|
+
|
720
|
+
<div class="method-heading">
|
721
|
+
<a href="#M000113" class="method-signature">
|
722
|
+
<span class="method-name">load_book</span><span class="method-args">(cookbook)</span>
|
723
|
+
</a>
|
724
|
+
</div>
|
725
|
+
|
726
|
+
<div class="method-description">
|
727
|
+
<p><a class="source-toggle" href="#"
|
728
|
+
onclick="toggleCode('M000113-source');return false;">[Source]</a></p>
|
729
|
+
<div class="method-source-code" id="M000113-source">
|
730
|
+
<pre>
|
731
|
+
<span class="ruby-comment cmt"># File rook/kitchen.rb, line 335</span>
|
732
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_book</span>(<span class="ruby-identifier">cookbook</span>)
|
733
|
+
<span class="ruby-identifier">b</span> = <span class="ruby-identifier">cookbook</span>
|
734
|
+
<span class="ruby-comment cmt"># precooking</span>
|
735
|
+
<span class="ruby-identifier">b</span>.<span class="ruby-identifier">precookings</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">hash</span><span class="ruby-operator">|</span>
|
736
|
+
<span class="ruby-identifier">add_precooking</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-value str">'code'</span>], <span class="ruby-identifier">b</span>.<span class="ruby-identifier">bookname</span>, <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'linenum'</span>])
|
737
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">b</span>.<span class="ruby-identifier">precooking</span>
|
738
|
+
<span class="ruby-comment cmt"># properties</span>
|
739
|
+
<span class="ruby-identifier">b</span>.<span class="ruby-identifier">properties</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">hash</span><span class="ruby-operator">|</span>
|
740
|
+
<span class="ruby-identifier">hash</span>[<span class="ruby-value str">'bookname'</span>] = <span class="ruby-identifier">b</span>.<span class="ruby-identifier">bookname</span>
|
741
|
+
<span class="ruby-identifier">add_property</span>(<span class="ruby-identifier">hash</span>, <span class="ruby-identifier">b</span>.<span class="ruby-identifier">bookname</span>)
|
742
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">b</span>.<span class="ruby-identifier">properties</span>
|
743
|
+
<span class="ruby-comment cmt"># variables</span>
|
744
|
+
<span class="ruby-identifier">b</span>.<span class="ruby-identifier">variables</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">hash</span><span class="ruby-operator">|</span>
|
745
|
+
<span class="ruby-identifier">hash</span>[<span class="ruby-value str">'bookname'</span>] = <span class="ruby-identifier">b</span>.<span class="ruby-identifier">bookname</span>
|
746
|
+
<span class="ruby-identifier">add_variable</span>(<span class="ruby-identifier">hash</span>, <span class="ruby-identifier">b</span>.<span class="ruby-identifier">bookname</span>)
|
747
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">b</span>.<span class="ruby-identifier">variables</span>
|
748
|
+
<span class="ruby-comment cmt"># materials</span>
|
749
|
+
<span class="ruby-identifier">b</span>.<span class="ruby-identifier">materials</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">nonprod</span><span class="ruby-operator">|</span>
|
750
|
+
<span class="ruby-identifier">add_nonproduct</span>(<span class="ruby-identifier">nonprod</span>)
|
751
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">b</span>.<span class="ruby-identifier">materials</span>
|
752
|
+
<span class="ruby-comment cmt"># recipes</span>
|
753
|
+
<span class="ruby-identifier">b</span>.<span class="ruby-identifier">recipes</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">hash</span><span class="ruby-operator">|</span>
|
754
|
+
<span class="ruby-identifier">hash</span> = <span class="ruby-ivar">@parameters</span>.<span class="ruby-identifier">evaluate_value</span>(<span class="ruby-identifier">hash</span>)
|
755
|
+
<span class="ruby-identifier">hash</span>[<span class="ruby-value str">'bookname'</span>] = <span class="ruby-identifier">b</span>.<span class="ruby-identifier">bookname</span>
|
756
|
+
<span class="ruby-identifier">recipe</span> = <span class="ruby-constant">Recipe</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">hash</span>)
|
757
|
+
<span class="ruby-identifier">add_recipe</span>(<span class="ruby-identifier">recipe</span>)
|
758
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">b</span>.<span class="ruby-identifier">recipes</span>
|
759
|
+
<span class="ruby-keyword kw">end</span>
|
760
|
+
</pre>
|
761
|
+
</div>
|
762
|
+
</div>
|
763
|
+
</div>
|
764
|
+
|
765
|
+
<div id="method-M000112" class="method-detail">
|
766
|
+
<a name="M000112"></a>
|
767
|
+
|
768
|
+
<div class="method-heading">
|
769
|
+
<a href="#M000112" class="method-signature">
|
770
|
+
<span class="method-name">load_books</span><span class="method-args">(cookbooks)</span>
|
771
|
+
</a>
|
772
|
+
</div>
|
773
|
+
|
774
|
+
<div class="method-description">
|
775
|
+
<p><a class="source-toggle" href="#"
|
776
|
+
onclick="toggleCode('M000112-source');return false;">[Source]</a></p>
|
777
|
+
<div class="method-source-code" id="M000112-source">
|
778
|
+
<pre>
|
779
|
+
<span class="ruby-comment cmt"># File rook/kitchen.rb, line 330</span>
|
780
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_books</span>(<span class="ruby-identifier">cookbooks</span>)
|
781
|
+
<span class="ruby-identifier">cookboos</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">cookbook</span><span class="ruby-operator">|</span> <span class="ruby-identifier">load_book</span>(<span class="ruby-identifier">cookbook</span>) <span class="ruby-keyword kw">end</span>
|
782
|
+
<span class="ruby-keyword kw">end</span>
|
783
|
+
</pre>
|
784
|
+
</div>
|
785
|
+
</div>
|
786
|
+
</div>
|
787
|
+
|
788
|
+
<div id="method-M000114" class="method-detail">
|
789
|
+
<a name="M000114"></a>
|
790
|
+
|
791
|
+
<div class="method-heading">
|
792
|
+
<a href="#M000114" class="method-signature">
|
793
|
+
<span class="method-name">load_script</span><span class="method-args">(filename)</span>
|
794
|
+
</a>
|
795
|
+
</div>
|
796
|
+
|
797
|
+
<div class="method-description">
|
798
|
+
<p><a class="source-toggle" href="#"
|
799
|
+
onclick="toggleCode('M000114-source');return false;">[Source]</a></p>
|
800
|
+
<div class="method-source-code" id="M000114-source">
|
801
|
+
<pre>
|
802
|
+
<span class="ruby-comment cmt"># File rook/kitchen.rb, line 365</span>
|
803
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_script</span>(<span class="ruby-identifier">filename</span>)
|
804
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">instance_eval</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">filename</span>), <span class="ruby-identifier">filename</span>, <span class="ruby-value">1</span>
|
805
|
+
<span class="ruby-keyword kw">end</span>
|
806
|
+
</pre>
|
807
|
+
</div>
|
808
|
+
</div>
|
809
|
+
</div>
|
810
|
+
|
811
|
+
<div id="method-M000115" class="method-detail">
|
812
|
+
<a name="M000115"></a>
|
813
|
+
|
814
|
+
<div class="method-heading">
|
815
|
+
<a href="#M000115" class="method-signature">
|
816
|
+
<span class="method-name">load_script!</span><span class="method-args">(script, filename)</span>
|
817
|
+
</a>
|
818
|
+
</div>
|
819
|
+
|
820
|
+
<div class="method-description">
|
821
|
+
<p><a class="source-toggle" href="#"
|
822
|
+
onclick="toggleCode('M000115-source');return false;">[Source]</a></p>
|
823
|
+
<div class="method-source-code" id="M000115-source">
|
824
|
+
<pre>
|
825
|
+
<span class="ruby-comment cmt"># File rook/kitchen.rb, line 369</span>
|
826
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_script!</span>(<span class="ruby-identifier">script</span>, <span class="ruby-identifier">filename</span>)
|
827
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">instance_eval</span> <span class="ruby-identifier">script</span>, <span class="ruby-identifier">filename</span>, <span class="ruby-value">1</span>
|
828
|
+
<span class="ruby-keyword kw">end</span>
|
829
|
+
</pre>
|
830
|
+
</div>
|
831
|
+
</div>
|
832
|
+
</div>
|
833
|
+
|
834
|
+
<div id="method-M000125" class="method-detail">
|
835
|
+
<a name="M000125"></a>
|
836
|
+
|
837
|
+
<div class="method-heading">
|
838
|
+
<a href="#M000125" class="method-signature">
|
839
|
+
<span class="method-name">start_cooking</span><span class="method-args">(product)</span>
|
840
|
+
</a>
|
841
|
+
</div>
|
842
|
+
|
843
|
+
<div class="method-description">
|
844
|
+
<p><a class="source-toggle" href="#"
|
845
|
+
onclick="toggleCode('M000125-source');return false;">[Source]</a></p>
|
846
|
+
<div class="method-source-code" id="M000125-source">
|
847
|
+
<pre>
|
848
|
+
<span class="ruby-comment cmt"># File rook/kitchen.rb, line 469</span>
|
849
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start_cooking</span>(<span class="ruby-identifier">product</span>)
|
850
|
+
<span class="ruby-identifier">cooking</span> = <span class="ruby-constant">Cooking</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">product</span>)
|
851
|
+
<span class="ruby-keyword kw">begin</span>
|
852
|
+
<span class="ruby-identifier">cook</span>(<span class="ruby-identifier">product</span>, <span class="ruby-identifier">cooking</span>, <span class="ruby-value">0</span>)
|
853
|
+
<span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">ex</span>
|
854
|
+
<span class="ruby-identifier">log</span>(<span class="ruby-identifier">ex</span>.<span class="ruby-identifier">message</span>, <span class="ruby-value">0</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-value str">'*** '</span>)
|
855
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">ex</span>
|
856
|
+
<span class="ruby-keyword kw">end</span>
|
857
|
+
<span class="ruby-keyword kw">end</span>
|
858
|
+
</pre>
|
859
|
+
</div>
|
860
|
+
</div>
|
861
|
+
</div>
|
862
|
+
|
863
|
+
|
864
|
+
</div>
|
865
|
+
|
866
|
+
|
867
|
+
</div>
|
868
|
+
|
869
|
+
|
870
|
+
<div id="validator-badges">
|
871
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
872
|
+
</div>
|
873
|
+
|
874
|
+
</body>
|
875
|
+
</html>
|