mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
94db856f53
This updates the Rakefile to import the User Manual and also updates the manual itself to use correct headers.
52 lines
1.4 KiB
Ruby
52 lines
1.4 KiB
Ruby
require 'fileutils'
|
|
require 'erb'
|
|
|
|
task :generate => [:generate_usermanual] do
|
|
require 'rdiscount'
|
|
`rm -rf output`
|
|
FileUtils.mkdir("output")
|
|
`cat text/*.markdown > output/UserManual.markdown`
|
|
`cp -r assets/* output`
|
|
|
|
template = ERB.new(File.read("template.html"))
|
|
|
|
source = Dir.glob("text/*.markdown").each do |file|
|
|
contents = File.read(file)
|
|
body = Markdown.new(contents).to_html
|
|
@filename = File.basename(file).gsub(/markdown$/,"html")
|
|
File.open("output/" + @filename, "w") do |f|
|
|
f.puts template.result(binding)
|
|
end
|
|
end
|
|
|
|
# Add the user manual
|
|
FileUtils.mkdir("output/images/UserManual")
|
|
`cp -r UserManual/output/images/* output/images/UserManual`
|
|
@filename = 'user_manual.html'
|
|
body = File.read("UserManual/output/UserManual.html")
|
|
File.open("output/user_manual.html", "w") do |f|
|
|
f.puts template.result(binding)
|
|
end
|
|
|
|
`open output/index.html`
|
|
end
|
|
|
|
task :generate_usermanual do
|
|
require 'rdiscount'
|
|
`rm -rf UserManual/output`
|
|
FileUtils.mkdir("UserManual/output")
|
|
`cat UserManual/text/*.markdown > output/UserManual.markdown`
|
|
`cp -r UserManual/assets/images UserManual/output`
|
|
|
|
source = Dir.glob("UserManual/text/**/*.markdown").map do |file|
|
|
File.read(file)
|
|
end.join("\n")
|
|
body = Markdown.new(source).to_html
|
|
File.open("UserManual/output/UserManual.html", "w") do |f|
|
|
f.puts body
|
|
end
|
|
end
|
|
|
|
task :upload do
|
|
`rsync -a output/ sydney:public_html/gitx/`
|
|
end |