9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/crust.rb', line 9
def self.generate(path, base_only)
if File.readable?(path)
files = read_files(path, base_only)
if files.length > 0
FileUtils.mkdir('output')
output = []
files.each do |generate|
puts "Generate #{generate.file_name}"
output << generate.generate_files
end
output.each do |generated|
generated.each { |name, contents| File.open(File.join('output', name), 'w') { |f| f.write(contents) } }
end
end
else
puts "Cannot read path #{path}"
end
end
|