Sha256: d93daab5e6f07dab82dc8768ab326a5afa9aa9097055c6fcdea4e8678e858d0f
Contents?: true
Size: 622 Bytes
Versions: 6
Compression:
Stored size: 622 Bytes
Contents
require 'workarea/blog/import/wordpress/attachment' namespace :workarea do namespace :blog do desc 'Import attachments from Wordpress' task :import_wordpress_attachments, [:path] => :environment do |t, args| args.with_defaults(path: "#{Rails.root}/data/blog/wordpress.xml") puts 'Importing all assets...' doc = Nokogiri::XML(File.open(args[:path])) attachment_urls = doc.xpath("//item[wp:post_type='attachment']/wp:attachment_url").children.map(&:text) attachment_urls.each do |url| Workarea::Blog::Import::Wordpress::Attachment.new(url).save end end end end
Version data entries
6 entries across 6 versions & 1 rubygems