forked from github/develop.github.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
38 lines (29 loc) · 810 Bytes
/
Rakefile
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
require 'rubygems'
require 'erb'
require 'maruku'
def generate_page(page)
@pcontent = ''
# render markdown from page, if present
mpage = "pages/#{page}.markdown"
if File.exists?(mpage)
content = File.read(mpage)
doc = Maruku.new(content)
@pcontent += doc.to_html
@pcontent += '<br/><br/><hr/>'
end
@pcontent += '<div class="span-21 last"> </div><hr/>'
pname = "p/#{page}.html"
out = ERB.new(File.read('template/page.erb.html')).result
File.open(pname, 'w') { |f| f.write(out) }
end
# generate the site
desc "Generate the html files for the site"
task :gensite do
Dir["pages/*"].entries.each do |p|
(ignore, page) = p.split('/')
(pname, ignore) = page.split('.')
puts pname
generate_page(pname)
end
end
task :default => [:gensite]