100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
# File 'lib/linecook/commands/compile.rb', line 100
def process(*recipes)
helper_dirs.each do |helper_dir|
compile_helpers(helper_dir)
end
package = Package.new(load_env(package_file))
cookbook = Cookbook.new(*cookbook_path)
stdout = StringIO.new
recipes.each do |recipe_path|
recipe = Recipe.new(package, cookbook)
if recipe_path == '-'
recipe.instance_eval $stdin.read, 'stdin'
stdout.print recipe
else
recipe_path = File.expand_path(recipe_path)
recipe.register_as relative_path(input_dir, recipe_path).chomp('.rb')
recipe.instance_eval File.read(recipe_path), recipe_path
recipe.register_to package
end
end
package.export(output_dir) do |src, dest|
unless force
raise CommandError, "already exists: #{dest.inspect}"
end
FileUtils.rm_rf(dest)
true
end
$stdout << stdout.string
end
|