11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/blacksmith/preprocessor.rb', line 11
def proccess(filename)
file = get_file(filename)
input_file = file.readlines
output = input_file.map { |line|
if line =~ /\/\/#/
case line
when /include/
included_filename = line.match(/include\s+(.*)/)[1].strip
proccess(included_filename)
when /insert/
include_arg = line.match(/insert\s+(.*)/)[1].strip
get_file(include_arg).read
when /if_env/
env = line.match(/if_env\s+(.*)/)[1].strip
if Blacksmith.config.env == env
line
else
''
end
else
line
end
else
line
end
}.join()
end
|