class WP2Middleman::Migrator
Attributes
posts[R]
Public Class Methods
new(wp_xml_export_file, body_to_markdown: false, include_fields: [])
click to toggle source
# File lib/wp2middleman/migrator.rb, line 7 def initialize(wp_xml_export_file, body_to_markdown: false, include_fields: []) @posts = WP2Middleman::PostCollection.from_file(wp_xml_export_file) .without_attachments .only_valid .to_middleman(body_to_markdown: body_to_markdown, include_fields: include_fields) end
Public Instance Methods
ensure_export_directory()
click to toggle source
# File lib/wp2middleman/migrator.rb, line 26 def ensure_export_directory unless File.directory? output_path FileUtils.mkdir_p output_path end end
migrate()
click to toggle source
# File lib/wp2middleman/migrator.rb, line 14 def migrate ensure_export_directory posts.each do |post| File.write(post.full_filename(output_path), post.file_content) end end
output_path()
click to toggle source
# File lib/wp2middleman/migrator.rb, line 22 def output_path "#{Dir.pwd}/export/" end