Merge branch 'master' of git://github.com/SustainableWebsites/refinerycms-wordpress-import

This commit is contained in:
Marc Remolt 2011-06-03 10:36:53 +02:00
commit e367498ef0
2 changed files with 31 additions and 14 deletions

View File

@ -1,9 +1,11 @@
= Refinerycms-wordpress-import
This project ist an importer for WordPress XML dumps into refinerycms(-blog).
This project is an importer for WordPress XML dumps into refinerycms(-blog).
So far, only blog-relevant data gets imported, I'm working on the cms pages part.
Draft posts and posts with duplicate post titles are ignored (for now)
== Installation
As there is no official release out yet, just add this repos to your projects Gemfile:

View File

@ -35,10 +35,17 @@ module Refinery
raise "Referenced User doesn't exist! Make sure the authors are imported first." \
unless user
post = ::BlogPost.create! :title => title, :body => content_formatted, :draft => draft?,
:published_at => post_date, :created_at => post_date, :author => user,
begin
is_draft = draft? ? "true" : "false"
if !draft?
p "creating post " + title + " Draft status: " + is_draft
post = ::BlogPost.create! :title => title,
:body => content_formatted,
:draft => draft?,
:published_at => post_date,
:created_at => post_date,
:author => user,
:tag_list => tag_list
::BlogPost.transaction do
categories.each do |category|
post.categories << category.to_refinery
@ -51,6 +58,14 @@ module Refinery
end
end
else
p "Skipping draft post"
end
rescue Exception => e
# TODO if it's not an activerecord validation error about duplicate title then raise e
p e
end
post
end
end