30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/zizu/cli.rb', line 30
def compile
excludes = check_exclusions(options[:exclude])
unless options[:output].nil?
dir = create_directory(options[:output])
end
basedir = "."
haml_files = Dir.glob("*.haml")
init_templates
haml_files.each do |f|
if excludes.include?(f)
next
else
html = haml_to_html(f)
if dir.nil?
html_name = f.chomp(".haml") + ".html"
else
html_name = dir + f.chomp(".haml") + ".html"
end
f = File.open( html_name, "w" )
f.write(html)
f.close
Zizu::success("created #{html_name}")
end
end
unless dir.nil?
FileUtils.cp_r( "scripts", dir )
Zizu::success("copying scripts directory")
FileUtils.cp_r( "styles", dir )
Zizu::success("copying styles directory")
FileUtils.cp_r( "images", dir )
Zizu::success("copying images directory")
end
end
|