Sha256: aea8156e14dbdbb8ae0628c99823732177dbf116e510a1ba746464a41a45395b

Contents?: true

Size: 665 Bytes

Versions: 6

Compression:

Stored size: 665 Bytes

Contents

require 'workarea/blog/import/wordpress/page'
require 'workarea/blog/import/wordpress/page_parser'

namespace :workarea do
  namespace :blog do
    desc 'Import posts from Wordpress'
    task :import_wordpress_pages, [:path] => :environment do |t, args|
      args.with_defaults(path: "#{Rails.root}/data/blog/wordpress.xml")
      puts 'Importing all Wordpress pages...'

      doc = Nokogiri::XML(File.open(args[:path]))

      all_pages = Workarea::Blog::Import::Wordpress::PageParser.new(doc).parse

      all_pages.each do |page|
        Workarea::Blog::Import::Wordpress::Page.new(page).save
      end
      puts 'Wordpress pages imported!'
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
workarea-blog-3.5.2 lib/tasks/import_wordpress_pages.rake
workarea-blog-3.5.1 lib/tasks/import_wordpress_pages.rake
workarea-blog-3.5.0 lib/tasks/import_wordpress_pages.rake
workarea-blog-3.4.9 lib/tasks/import_wordpress_pages.rake
workarea-blog-3.4.8 lib/tasks/import_wordpress_pages.rake
workarea-blog-3.4.7 lib/tasks/import_wordpress_pages.rake