DG MS; exporter includes comments. exporter spec

This commit is contained in:
danielvincent 2010-10-07 14:10:14 -07:00
parent 7e8bf40a87
commit 09dad2d80f

View file

@ -4,11 +4,6 @@
module Diaspora module Diaspora
def self.bone(user)
exporter = Diaspora::Exporter.new(Diaspora::Exporters::XML)
exporter.execute(user)
end
class Exporter class Exporter
def initialize(strategy) def initialize(strategy)
self.class.send(:include, strategy) self.class.send(:include, strategy)
@ -22,7 +17,7 @@ module Diaspora
xml.user { xml.user {
xml.username user.username xml.username user.username
xml.serialized_private_key user.serialized_private_key xml.serialized_private_key user.serialized_private_key
xml.person user.person.to_xml xml.parent << user.person.to_xml
xml.aspects { xml.aspects {
user.aspects.each do |aspect| user.aspects.each do |aspect|
@ -36,8 +31,14 @@ module Diaspora
end end
} }
xml.posts { xml.posts {
aspect.posts.each do |post| aspect.posts.find_all_by_person_id(user.person.id).each do |post|
xml.post post.to_xml if post.respond_to? :to_xml post_doc = post.to_xml
post.comments.each do |comment|
post_doc << comment.to_xml
end
xml.post post_doc
end end
} }
} }