rook 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LGPL +504 -0
- data/README.txt +15 -6
- data/bin/rook +1 -1
- data/doc-api/classes/BZ2/Reader.html +24 -24
- data/doc-api/classes/Digest/Base.html +18 -18
- data/doc-api/classes/Enumerable.html +55 -55
- data/doc-api/classes/File.html +53 -6
- data/doc-api/classes/FileUtils.html +90 -90
- data/doc-api/classes/Kernel.html +48 -48
- data/doc-api/classes/Rook.html +18 -5
- data/doc-api/classes/Rook/Assertion.html +29 -14
- data/doc-api/classes/Rook/Commands.html +296 -364
- data/doc-api/classes/Rook/Cookbook.html +165 -60
- data/doc-api/classes/Rook/CookbookError.html +7 -7
- data/doc-api/classes/Rook/CookbookValidator.html +24 -24
- data/doc-api/classes/Rook/Kitchen.html +379 -224
- data/doc-api/classes/Rook/KitchenHelper.html +69 -69
- data/doc-api/classes/Rook/Main.html +47 -30
- data/doc-api/classes/Rook/Recipe.html +63 -35
- data/doc-api/classes/Rook/Util.html +72 -68
- data/doc-api/classes/Rook/Util/UndefinedPropertyError.html +6 -6
- data/doc-api/classes/Rook/{Parameters.html → ValueTable.html} +129 -123
- data/doc-api/created.rid +1 -1
- data/doc-api/files/rook/commands_rb.html +2 -2
- data/doc-api/files/rook/cookbook_rb.html +2 -2
- data/doc-api/files/rook/helper/bz2_rb.html +1 -1
- data/doc-api/files/rook/helper/digest_rb.html +1 -1
- data/doc-api/files/rook/helper/enumerable_rb.html +1 -1
- data/doc-api/files/rook/helper/file_rb.html +2 -2
- data/doc-api/files/rook/helper/fileutils_rb.html +1 -1
- data/doc-api/files/rook/helper/kernel_rb.html +1 -1
- data/doc-api/files/rook/kitchen_rb.html +2 -2
- data/doc-api/files/rook/main_rb.html +2 -2
- data/doc-api/files/rook/recipe_rb.html +2 -2
- data/doc-api/files/rook/util_rb.html +2 -2
- data/doc-api/files/rook_rb.html +2 -2
- data/doc-api/fr_class_index.html +1 -1
- data/doc-api/fr_file_index.html +0 -1
- data/doc-api/fr_method_index.html +148 -140
- data/doc-api/index.html +1 -1
- data/examples/hello_c/Rookbook.rb +1 -1
- data/examples/hello_c/Rookbook.yaml +8 -8
- data/examples/project/README.txt +2 -2
- data/examples/project/Rookbook.rb +20 -19
- data/examples/project/Rookbook.yaml +30 -28
- data/examples/project/bin/example +2 -2
- data/examples/project/example.gemspec +1 -1
- data/examples/project/lib/example.rb +2 -2
- data/examples/project/test/test.rb +2 -2
- data/lib/rook.rb +5 -2
- data/lib/rook/commands.rb +28 -17
- data/lib/rook/cookbook.rb +107 -92
- data/lib/rook/helper/bz2.rb +1 -1
- data/lib/rook/helper/digest.rb +1 -1
- data/lib/rook/helper/enumerable.rb +1 -1
- data/lib/rook/helper/file.rb +28 -3
- data/lib/rook/helper/fileutils.rb +1 -1
- data/lib/rook/helper/kernel.rb +1 -1
- data/lib/rook/kitchen.rb +138 -100
- data/lib/rook/main.rb +72 -47
- data/lib/rook/recipe.rb +51 -35
- data/lib/rook/rookbook.schema.yaml +34 -54
- data/lib/rook/util.rb +22 -8
- data/rook.gemspec +5 -5
- metadata +5 -7
- data/COPYING +0 -340
- data/doc-api/files/__/README_txt.html +0 -313
data/lib/rook/main.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
##
|
2
|
-
## $Rev:
|
3
|
-
## $Release: 0.
|
2
|
+
## $Rev: 37 $
|
3
|
+
## $Release: 0.2.0 $
|
4
4
|
## copyright(c) 2006 kuwata-lab.com all rights reserved.
|
5
5
|
##
|
6
6
|
|
@@ -27,25 +27,24 @@ module Rook
|
|
27
27
|
class Main
|
28
28
|
|
29
29
|
|
30
|
-
def initialize(argv=ARGV
|
30
|
+
def initialize(argv=ARGV)
|
31
31
|
@argv = argv
|
32
|
-
@stdout = stdout
|
33
|
-
@stderr = stderr
|
34
32
|
@options, @properties = parse_argv(@argv)
|
35
33
|
@options[?h] = true if @properties['help'] == true
|
36
34
|
@products = argv
|
37
35
|
end
|
38
36
|
|
39
37
|
|
40
|
-
def self.main(argv=ARGV
|
38
|
+
def self.main(argv=ARGV)
|
41
39
|
status = 0
|
42
40
|
begin
|
43
|
-
main = self.new(argv
|
44
|
-
main.execute()
|
41
|
+
main = self.new(argv)
|
42
|
+
output = main.execute()
|
43
|
+
#print output if output
|
45
44
|
rescue RookError => ex
|
46
45
|
status = 1
|
47
46
|
raise ex if $rook_debug
|
48
|
-
stderr.puts "*** error: #{ex.message}"
|
47
|
+
$stderr.puts "*** error: #{ex.message}"
|
49
48
|
end
|
50
49
|
exit status
|
51
50
|
end
|
@@ -65,9 +64,9 @@ module Rook
|
|
65
64
|
cmdname = File.basename($0)
|
66
65
|
#desc = "#{cmdname} - a SCM (software configuration management) tool like Make, Rake, Ant, or Cook.\n"
|
67
66
|
desc = "#{cmdname} - a SCM (Software Cooking Management) tool like Make, Rake, Ant, or Cook.\n"
|
68
|
-
|
69
|
-
|
70
|
-
|
67
|
+
puts version() if @options[?v]
|
68
|
+
puts desc if @options[?h]
|
69
|
+
puts help() if @options[?h]
|
71
70
|
return
|
72
71
|
end
|
73
72
|
|
@@ -77,20 +76,20 @@ module Rook
|
|
77
76
|
## bookname
|
78
77
|
bookname = @options[?f] || @options[?b]
|
79
78
|
if bookname
|
80
|
-
test(?f, bookname) or raise
|
79
|
+
test(?f, bookname) or raise _error("cookbook '#{bookname}' not found.")
|
81
80
|
else
|
82
81
|
['.yaml', '.yml', '.rb', ''].each do |suffix|
|
83
82
|
break if test(?f, bookname = "Rookbook#{suffix}")
|
84
83
|
break if test(?f, bookname = "rookbook#{suffix}")
|
85
84
|
bookname = nil
|
86
85
|
end
|
87
|
-
bookname or raise
|
86
|
+
bookname or raise _error("cookbook 'Rookbook.yaml' or 'Rookbook.rb' not found.")
|
88
87
|
end
|
89
88
|
|
90
89
|
## properties filename
|
91
90
|
propfile = @options[?P]
|
92
91
|
if propfile
|
93
|
-
test(?f, propfile) or raise
|
92
|
+
test(?f, propfile) or raise _error("file '#{propfile}' not found.")
|
94
93
|
else
|
95
94
|
%w[Rookbook.props properties.yaml].each do |f|
|
96
95
|
break propfile = f if test(?f, f)
|
@@ -108,23 +107,33 @@ module Rook
|
|
108
107
|
$rook_forced = @options[?F]
|
109
108
|
$rook_noexec = @options[?n] ? 1 : (@options[?N] ? 2 : nil)
|
110
109
|
|
111
|
-
# kitchen
|
112
|
-
props = { :verbose=>$rook_verbose, :forced=>$rook_forced, :noexec=>$rook_noexec }
|
113
|
-
kitchen = Kitchen.new(@properties, props)
|
114
|
-
|
115
110
|
## cookbook
|
116
|
-
|
111
|
+
style = bookname =~ /\.ya?ml\z/ ? :yaml : :ruby
|
112
|
+
if style == :yaml
|
117
113
|
flag_expand_tab = !options[?T]
|
118
114
|
begin
|
119
115
|
cookbook = Cookbook.new(bookname, true, flag_expand_tab)
|
120
116
|
rescue CookbookError => ex
|
121
|
-
|
117
|
+
$stderr.puts "validation error:"
|
122
118
|
ex.errors.each do |error|
|
123
119
|
e = error
|
124
|
-
|
120
|
+
$stderr.puts "#{bookname}:#{e.linenum}: [#{e.path}] #{e.message}"
|
125
121
|
end
|
126
122
|
return
|
127
123
|
end
|
124
|
+
end
|
125
|
+
|
126
|
+
## check
|
127
|
+
if @options[?c]
|
128
|
+
style == :yaml or raise _error("-c: cannot check Ruby-DSL style cookbook.")
|
129
|
+
cookbook.validate_rubycode()
|
130
|
+
return
|
131
|
+
end
|
132
|
+
|
133
|
+
## kitchen
|
134
|
+
props = { :verbose=>$rook_verbose, :forced=>$rook_forced, :noexec=>$rook_noexec }
|
135
|
+
kitchen = Kitchen.new(@properties, props)
|
136
|
+
if style == :yaml
|
128
137
|
kitchen.load_book(cookbook)
|
129
138
|
else
|
130
139
|
kitchen.load_script(bookname)
|
@@ -134,15 +143,21 @@ module Rook
|
|
134
143
|
if @options[?l] || @options[?L]
|
135
144
|
show_all = @options[?L] ? true : false
|
136
145
|
list_properties(kitchen, show_all)
|
137
|
-
|
146
|
+
puts
|
138
147
|
list_recipes(kitchen, @options[?L])
|
139
148
|
return
|
140
149
|
end
|
141
150
|
|
142
|
-
## show property value
|
151
|
+
## show property/parameter value
|
143
152
|
if @options[?p]
|
144
|
-
@options[?p].split(/,/).each do |
|
145
|
-
|
153
|
+
@options[?p].split(/,/).each do |name|
|
154
|
+
if kitchen.has_parameter?(name)
|
155
|
+
pp kitchen.get_parameter(name)
|
156
|
+
elsif kitchen.has_property?(name)
|
157
|
+
pp kitchen.get_property(name)
|
158
|
+
else
|
159
|
+
raise _error("-p #{name}: no such parameter or property.")
|
160
|
+
end
|
146
161
|
end
|
147
162
|
return
|
148
163
|
end
|
@@ -152,12 +167,12 @@ module Rook
|
|
152
167
|
products = @products
|
153
168
|
elsif kitchen.find_specific_recipe(:default)
|
154
169
|
products = [ :default ]
|
155
|
-
elsif prod = kitchen.
|
170
|
+
elsif prod = kitchen.get_parameter('rook_product')
|
156
171
|
products = [ prod ]
|
157
172
|
elsif prod = kitchen.get_property('rook_product')
|
158
173
|
products = [ prod ]
|
159
174
|
else
|
160
|
-
|
175
|
+
$stderr.puts "*** no product specified."
|
161
176
|
list_recipes(kitchen)
|
162
177
|
return
|
163
178
|
end
|
@@ -168,30 +183,37 @@ module Rook
|
|
168
183
|
kitchen.start_cooking(product)
|
169
184
|
end
|
170
185
|
|
186
|
+
return nil
|
187
|
+
|
171
188
|
end
|
172
189
|
|
173
190
|
|
174
191
|
private
|
175
192
|
|
176
193
|
|
194
|
+
def _error(message)
|
195
|
+
return CommandOptionError.new(message)
|
196
|
+
end
|
197
|
+
|
198
|
+
|
177
199
|
def list_properties(kitchen, show_all=false)
|
178
|
-
|
200
|
+
puts "properites:"
|
179
201
|
kitchen.properties.each do |hash|
|
180
202
|
next unless show_all || hash['access'] == 'public'
|
181
|
-
|
203
|
+
puts " %-18s = %s" % [hash['name'], hash['value'].inspect]
|
182
204
|
end
|
183
205
|
return unless show_all
|
184
|
-
|
185
|
-
kitchen.
|
186
|
-
|
206
|
+
puts "\nparameters:"
|
207
|
+
kitchen.parameters.each do |hash|
|
208
|
+
puts " %-18s = %s" % [hash['name'], hash['value'].inspect]
|
187
209
|
end
|
188
210
|
end
|
189
211
|
|
190
212
|
|
191
213
|
def list_recipes(kitchen, show_all=false)
|
192
|
-
|
214
|
+
puts "recipes:"
|
193
215
|
kitchen.recipes.each do |r|
|
194
|
-
|
216
|
+
puts " %-18s : %s" % [Util.to_str(r.product), r.desc] if show_all || r.public?
|
195
217
|
end
|
196
218
|
end
|
197
219
|
|
@@ -203,19 +225,20 @@ module Rook
|
|
203
225
|
s << "Usage: #{cmdname} [-hvTFnNqQVlLc] [-f bookname] [-k kanji] [-F[n]] product...\n"
|
204
226
|
s << " -h : help\n"
|
205
227
|
s << " -v : version\n"
|
206
|
-
s << " -t : expand tab character in cookbook\n"
|
228
|
+
#s << " -t : expand tab character in cookbook\n"
|
207
229
|
s << " -T : don't expand tab character in cookbook\n"
|
208
230
|
s << " -n : no execute\n"
|
209
231
|
s << " -N : never execute\n"
|
210
232
|
s << " -q : quiet\n"
|
211
233
|
s << " -Q : more quiet\n"
|
212
|
-
s << " -V : verbose\n"
|
234
|
+
#s << " -V : verbose\n"
|
213
235
|
s << " -l : list public recipes and properties\n"
|
214
|
-
s << " -L : list all recipes, properties, and
|
236
|
+
s << " -L : list all recipes, properties, and parameters\n"
|
215
237
|
s << " -c : validation check of cookbook\n"
|
216
|
-
s << " -F : execute
|
238
|
+
s << " -F : execute forcedly\n"
|
217
239
|
s << " -b bookname : cookbook name\n"
|
218
240
|
s << " -f bookname : equal to `-b bookname'\n"
|
241
|
+
s << " -P propfile : property file (default 'Rookbook.props'/'Properties.yaml')\n"
|
219
242
|
s << " -p property : show property value in 'pp' format\n"
|
220
243
|
s << " -k kanji : kanji code (euc/sjis/utf8)\n"
|
221
244
|
s << " -r file[,..] : require libraries\n"
|
@@ -225,11 +248,14 @@ module Rook
|
|
225
248
|
|
226
249
|
|
227
250
|
def version
|
228
|
-
return ('$Release: 0.
|
251
|
+
return ('$Release: 0.2.0 $' =~ /[\.\d]+/) && $&
|
229
252
|
end
|
230
253
|
|
231
254
|
|
232
255
|
def parse_argv(argv)
|
256
|
+
single_opts = "hvcTnNqQVlL"
|
257
|
+
argument_opts = "fbkrpP"
|
258
|
+
optional_opts = "FD"
|
233
259
|
options = {}
|
234
260
|
properties = {}
|
235
261
|
while !argv.empty? && argv[0][0] == ?-
|
@@ -237,7 +263,7 @@ module Rook
|
|
237
263
|
break if optstr == '-'
|
238
264
|
if optstr[1] == ?- # property
|
239
265
|
unless optstr =~ /\A--([a-zA-Z_]\w*)(?:=(.*))?\z/
|
240
|
-
raise
|
266
|
+
raise _error("#{optstr}: invalid option pattern.")
|
241
267
|
end
|
242
268
|
name = $1
|
243
269
|
value = YAML.load($2)
|
@@ -247,24 +273,23 @@ module Rook
|
|
247
273
|
while optstr && !optstr.empty?
|
248
274
|
optch = optstr[0]
|
249
275
|
optstr[0, 1] = ''
|
250
|
-
|
251
|
-
when ?h, ?v, ?c, ?t, ?T, ?n, ?N, ?q, ?Q, ?V, ?l, ?L
|
276
|
+
if single_opts.include?(optch)
|
252
277
|
options[optch] = true
|
253
|
-
|
278
|
+
elsif argument_opts.include?(optch)
|
254
279
|
arg = optstr.empty? ? argv.shift : optstr
|
255
280
|
unless arg
|
256
281
|
hash = { ?f => 'bookname', ?b => 'bookname', ?k => 'kanji code',
|
257
282
|
?r => 'library', ?p => 'property', }
|
258
|
-
raise
|
283
|
+
raise _error("-#{optch.chr}: #{hash[optch]} required.")
|
259
284
|
end
|
260
285
|
options[optch] = arg
|
261
286
|
optstr = nil
|
262
|
-
|
287
|
+
elsif optional_opts.include?(optch)
|
263
288
|
arg = optstr.empty? ? true : optstr
|
264
289
|
options[optch] = arg
|
265
290
|
optstr = nil
|
266
291
|
else
|
267
|
-
raise
|
292
|
+
raise _error("-#{optch.chr}: invalid option.")
|
268
293
|
end
|
269
294
|
end
|
270
295
|
end
|
data/lib/rook/recipe.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
##
|
2
|
-
## $Rev:
|
3
|
-
## $Release: 0.
|
2
|
+
## $Rev: 35 $
|
3
|
+
## $Release: 0.2.0 $
|
4
4
|
## copyright(c) 2006 kuwata-lab.com all rights reserved.
|
5
5
|
##
|
6
6
|
|
@@ -20,13 +20,13 @@ module Rook
|
|
20
20
|
## hash = {
|
21
21
|
## 'product'=>'hello.o',
|
22
22
|
## 'ingreds'=>['hello.c'],
|
23
|
-
## '
|
23
|
+
## 'toppings'=>['hello.h'],
|
24
24
|
## }
|
25
25
|
##
|
26
26
|
## recipe1 = Recipe.new(hash) { gcc -o #{@product} #{@ingred} }
|
27
27
|
## recipe1.invoke()
|
28
28
|
##
|
29
|
-
## hash['method'] = 'gcc -o #{@product} #{@ingred}'
|
29
|
+
## hash['method'] = 'sys "gcc -o #{@product} #{@ingred}"'
|
30
30
|
## recipe2 = Recipe.new(hash)
|
31
31
|
## recipe2.invoke()
|
32
32
|
##
|
@@ -44,10 +44,10 @@ module Rook
|
|
44
44
|
@ingreds = (hash['ingreds'] || []).flatten()
|
45
45
|
@coprods = (hash['coprods'] || []).flatten()
|
46
46
|
@byprods = (hash['byprods'] || []).flatten()
|
47
|
-
@
|
47
|
+
@toppings = (hash['toppings'] || []).flatten()
|
48
|
+
@params = hash['params']
|
48
49
|
@kind = hash['kind'] || _detect_kind(@product)
|
49
|
-
@
|
50
|
-
@method = hash['method']
|
50
|
+
@method = hash['method*']
|
51
51
|
@block = block || hash['block']
|
52
52
|
@desc = hash['desc'] || _default_desc(@product)
|
53
53
|
@access = hash['access'] || (@desc ? 'public' : 'private')
|
@@ -59,14 +59,19 @@ module Rook
|
|
59
59
|
@linenum = hash['linenum'] # start linenumber of method part
|
60
60
|
@pattern = _compile_pattern(@product) if @kind == 'generic'
|
61
61
|
end
|
62
|
-
attr_accessor :product, :ingreds, :coprods, :byprods, :
|
63
|
-
attr_accessor :
|
64
|
-
attr_accessor :bookname, :linenum, :pattern, :
|
62
|
+
attr_accessor :product, :ingreds, :coprods, :byprods, :toppings, :params
|
63
|
+
attr_accessor :kind, :method, :block, :desc, :access, :forced, :symbolic
|
64
|
+
attr_accessor :verbose, :fingerprint, :bookname, :linenum, :pattern, :matched
|
65
|
+
|
66
|
+
|
67
|
+
def matched=(val)
|
68
|
+
@matched = @m = val
|
69
|
+
end
|
65
70
|
|
66
71
|
|
67
72
|
#--
|
68
73
|
#def _member_names
|
69
|
-
# return %w[product ingreds coprods byprods
|
74
|
+
# return %w[product ingreds coprods byprods toppings desc kind method
|
70
75
|
# block access forced symbolic verbose bookname linenum]
|
71
76
|
#end
|
72
77
|
#private :_member_names
|
@@ -109,7 +114,7 @@ module Rook
|
|
109
114
|
def all_ingredients
|
110
115
|
list = []
|
111
116
|
list.concat @ingreds if @ingreds
|
112
|
-
list.concat @
|
117
|
+
list.concat @toppings if @toppings
|
113
118
|
return list
|
114
119
|
end
|
115
120
|
|
@@ -156,23 +161,22 @@ module Rook
|
|
156
161
|
|
157
162
|
def to_specific(product)
|
158
163
|
return self unless @pattern
|
159
|
-
|
160
|
-
|
161
|
-
|
164
|
+
matched = @pattern.match(product)
|
165
|
+
matched or raise RookError.new("product '#{product}' doesn't match to /#{@pattern.source}/")
|
166
|
+
recipe = self.dup
|
162
167
|
instance_variables.each do |var|
|
163
|
-
|
164
|
-
|
165
|
-
hash[w] = Util.expand_matches(instance_variable_get(var), matches)
|
168
|
+
val = Util.expand_matches(instance_variable_get(var), matched)
|
169
|
+
recipe.instance_variable_set(var, val)
|
166
170
|
end
|
167
|
-
|
168
|
-
recipe =
|
169
|
-
recipe.
|
171
|
+
recipe.instance_variable_set('@product', product)
|
172
|
+
recipe.kind = 'specific'
|
173
|
+
recipe.matched = matched
|
170
174
|
return recipe
|
171
175
|
end
|
172
176
|
|
173
177
|
|
174
|
-
def invoke(
|
175
|
-
Oven.new(self).bake(
|
178
|
+
def invoke(kitchen)
|
179
|
+
Oven.new(self).bake(kitchen)
|
176
180
|
end
|
177
181
|
|
178
182
|
|
@@ -185,21 +189,22 @@ module Rook
|
|
185
189
|
|
186
190
|
|
187
191
|
def initialize(recipe)
|
192
|
+
@recipe = recipe
|
188
193
|
recipe.instance_variables.each do |name|
|
189
194
|
value = recipe.instance_variable_get(name)
|
190
195
|
instance_variable_set(name, value)
|
191
196
|
end
|
192
|
-
@ingred
|
193
|
-
@coprod
|
194
|
-
@byprod
|
195
|
-
@
|
197
|
+
@ingred = @ingreds.first if @ingreds
|
198
|
+
@coprod = @coprods.first if @coprods
|
199
|
+
@byprod = @byprods.first if @byprods
|
200
|
+
@topping = @toppings.first if @toppings
|
196
201
|
end
|
197
202
|
|
198
203
|
|
199
|
-
def bake(
|
204
|
+
def bake(_kitchen)
|
200
205
|
## copy properties as instance variable
|
201
|
-
|
202
|
-
instance_variable_set("@#{name}",
|
206
|
+
_kitchen.property_names.each do |name|
|
207
|
+
instance_variable_set("@#{name}", _kitchen.get_property(name))
|
203
208
|
end
|
204
209
|
## invoke @block or @method
|
205
210
|
if @block
|
@@ -208,10 +213,21 @@ module Rook
|
|
208
213
|
## set variables as local vars
|
209
214
|
@_vars = {}
|
210
215
|
_code = []
|
211
|
-
|
212
|
-
@_vars[
|
213
|
-
_code << "#{
|
216
|
+
_kitchen.parameter_names.each do |_name|
|
217
|
+
@_vars[_name] = _kitchen.get_parameter(_name)
|
218
|
+
_code << "#{_name}=@_vars['#{_name}'];"
|
214
219
|
end
|
220
|
+
@recipe.params.each do |_param|
|
221
|
+
_name = _param['name']
|
222
|
+
if _name[-1] == ?*
|
223
|
+
_name = _name[0, _name.length-1]
|
224
|
+
_expr = _param['value']
|
225
|
+
_code << "#{_name}=(#{_expr});"
|
226
|
+
else
|
227
|
+
@_vars[_name] = _param['value']
|
228
|
+
_code << "#{_name}=@_vars['#{_name}'];"
|
229
|
+
end
|
230
|
+
end if @recipe.params
|
215
231
|
_code << @method
|
216
232
|
self.instance_eval(_code.join, @bookname, @linenum)
|
217
233
|
end
|
@@ -245,10 +261,10 @@ module Rook
|
|
245
261
|
# @pattern =~ product
|
246
262
|
# end
|
247
263
|
# def to_specific(product)
|
248
|
-
#
|
264
|
+
# matched = @pattern.match(product)
|
249
265
|
# hash = { 'product' => product }
|
250
266
|
# _member_names.each do |name|
|
251
|
-
# hash[name] = Util.expand_matches(instance_variable_get(name),
|
267
|
+
# hash[name] = Util.expand_matches(instance_variable_get(name), matched)
|
252
268
|
# end
|
253
269
|
# SpecificRecipe.new(hash)
|
254
270
|
# end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
##
|
2
2
|
## $Rev$
|
3
|
-
## $Release: 0.
|
3
|
+
## $Release: 0.2.0 $
|
4
4
|
## copyright(c) 2006 kuwata-lab.com all rights reserved.
|
5
5
|
##
|
6
6
|
|
@@ -34,10 +34,11 @@ mapping:
|
|
34
34
|
# "desc":
|
35
35
|
# type: str
|
36
36
|
|
37
|
-
"
|
37
|
+
"preparation*":
|
38
38
|
type: text
|
39
39
|
|
40
40
|
"libraries":
|
41
|
+
desc: (not implemented)
|
41
42
|
type: seq
|
42
43
|
sequence:
|
43
44
|
- type: str
|
@@ -48,32 +49,30 @@ mapping:
|
|
48
49
|
sequence:
|
49
50
|
- type: str
|
50
51
|
|
51
|
-
"properties
|
52
|
-
type: seq
|
53
|
-
sequence:
|
54
|
-
- type: map
|
55
|
-
name: PROPERTY
|
56
|
-
mapping:
|
57
|
-
"name":
|
58
|
-
type: str
|
59
|
-
required: yes
|
60
|
-
unique: yes
|
61
|
-
"desc":
|
62
|
-
type: str
|
63
|
-
"value":
|
64
|
-
type: any
|
65
|
-
"expr":
|
66
|
-
type: str
|
67
|
-
"access":
|
68
|
-
type: str
|
69
|
-
enum:
|
70
|
-
- public
|
71
|
-
- private
|
72
|
-
- protected
|
73
|
-
|
74
|
-
"variables*": *props1
|
52
|
+
# "properties": &props1
|
53
|
+
# type: seq
|
54
|
+
# sequence:
|
55
|
+
# - type: map
|
56
|
+
# name: PROPERTY
|
57
|
+
# mapping:
|
58
|
+
# "name":
|
59
|
+
# type: str
|
60
|
+
# required: yes
|
61
|
+
# unique: yes
|
62
|
+
# "desc":
|
63
|
+
# type: str
|
64
|
+
# "value":
|
65
|
+
# type: any
|
66
|
+
# "expr":
|
67
|
+
# type: str
|
68
|
+
# "access":
|
69
|
+
# type: str
|
70
|
+
# enum:
|
71
|
+
# - public
|
72
|
+
# - private
|
73
|
+
# - protected
|
75
74
|
|
76
|
-
"properties": &
|
75
|
+
"properties": &props
|
77
76
|
type: seq
|
78
77
|
sequence:
|
79
78
|
- type: map
|
@@ -90,52 +89,33 @@ mapping:
|
|
90
89
|
"=":
|
91
90
|
type: any
|
92
91
|
|
93
|
-
"
|
92
|
+
"parameters": *props
|
94
93
|
|
95
94
|
"recipes":
|
96
95
|
type: seq
|
97
96
|
sequence:
|
98
97
|
- type: map
|
99
98
|
mapping:
|
100
|
-
"product*":
|
101
|
-
type: str
|
102
99
|
"product":
|
103
100
|
type: any # str or symbol
|
104
101
|
name: MATERIAL
|
105
|
-
"ingreds
|
106
|
-
type: str
|
107
|
-
"ingreds":
|
108
|
-
type: seq
|
109
|
-
sequence:
|
110
|
-
- type: any # str or symbol
|
111
|
-
name: MATERIAL
|
112
|
-
"coprods*":
|
113
|
-
type: str
|
114
|
-
"coprods":
|
115
|
-
type: seq
|
116
|
-
sequence:
|
117
|
-
- type: any # str or symbol
|
118
|
-
name: MATERIAL
|
119
|
-
"byprods*":
|
120
|
-
type: str
|
121
|
-
"byprods":
|
102
|
+
"ingreds": &ingreds
|
122
103
|
type: seq
|
123
104
|
sequence:
|
124
105
|
- type: any # str or symbol
|
125
106
|
name: MATERIAL
|
126
|
-
"
|
127
|
-
|
128
|
-
"
|
107
|
+
"coprods": *ingreds
|
108
|
+
"byprods": *ingreds
|
109
|
+
"toppings":
|
129
110
|
type: seq
|
130
111
|
sequence:
|
131
112
|
- type: str
|
132
113
|
name: MATERIAL
|
114
|
+
"params": *props
|
133
115
|
"method*":
|
134
116
|
type: text
|
135
|
-
"method":
|
136
|
-
type: text
|
137
|
-
"desc":
|
138
|
-
type: str
|
117
|
+
# "method":
|
118
|
+
# type: text
|
139
119
|
"desc":
|
140
120
|
type: str
|
141
121
|
"access":
|