-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontroller.rb
More file actions
39 lines (31 loc) · 737 Bytes
/
controller.rb
File metadata and controls
39 lines (31 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
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
39
require 'yaml'
require 'sass'
helpers do
def link_to(url, text)
"<a href=\"#{url}.html\">#{text}</a>"
end
end
ignore ".git", 'meat.html.erb', 'meats.yml', 'helpers.rb', '.rvmrc'
layout 'layout.html.erb'
layout 'meat.html.erb' => 'layout.html.erb'
pages = ["about", "contact", "team"]
pages.each do |page|
layout "#{page}.html.erb" => 'pages.html.erb'
end
def generate(meat)
name = meat["name"]
header = meat["header"]
variants = meat["variants"]
before "#{name.downcase}.html.erb" do
instead render 'meat.html.erb',
locals: {
meat: name,
header: header,
variants: variants
}
end
end
meats = YAML::load(File.open('meats.yml'))
meats.each do |meat|
generate meat
end