Forked from newbamboo/migrate_articles_from_mephisto_markdown_files.rb
Created
August 20, 2009 20:21
-
-
Save corey/171331 to your computer and use it in GitHub Desktop.
This file contains 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
articles = Article.find(:all) | |
articles.each do |article| | |
published_at = "#{published_at.year}-#{published_at.month}-#{published_at.day}" | |
author = article.user.login | |
permalink = article.permalink | |
title = article.title | |
excerpt = article.excerpt | |
body = article.body | |
fp = File.open("_posts/#{'draft-' if article.published_at.nil?}#{published_at}-#{permalink}.markdown", 'w') | |
fp.write(%"--- | |
layout: post | |
title: \"#{title}\" | |
author: #{author} | |
--- | |
#{excerpt} | |
#{body}") | |
fp.close | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment