Created
January 18, 2013 01:33
-
-
Save kennym/4561558 to your computer and use it in GitHub Desktop.
Convert Ruboto wiki entries to Jekyll entries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# Convert old jekyll release announcements to jekyll. | |
# | |
# Copies newly generated entries to `build/` | |
# | |
# 1. git clone git://github.com/ruboto/ruboto.wiki.git | |
# 2. cd ruboto.wiki | |
# 3. Run this script | |
require 'fileutils' | |
release_docs = Dir.glob("Ruboto-*-release*").each do |doc| | |
creation_date = %x( git log --date=short #{doc} | sed -n '3p' ).split[1] | |
file_name = "#{creation_date}-#{doc}" | |
title = doc.gsub(/\-/, " ").split("release")[0].strip | |
FileUtils.mkdir_p("build") | |
FileUtils.cp_r(doc, "build/#{file_name}") | |
File.open("build/#{file_name}", 'w') {|f| | |
f.puts "---" | |
f.puts "title : #{title}" | |
f.puts "---" | |
File.foreach(doc) do |li| | |
f.puts li | |
end | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment