Skip to content
This repository was archived by the owner on Oct 27, 2025. It is now read-only.

Commit 536a1d1

Browse files
committed
WIP: export rake task
1 parent e8aa02b commit 536a1d1

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

lib/tasks/export.rake

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
namespace :export do
2+
desc "Export live documents and assets"
3+
task live_documents_and_assets: :environment do
4+
documents = WhitehallMigration::DocumentExport.exportable_documents
5+
6+
puts "Exporting #{documents.count} live editions"
7+
8+
# TODO: delete the override below. We're temporarily only looking
9+
# at a pre-selected few for testing.
10+
documents = [Document.find_by(content_id: "c6c294fa-2800-40c5-89c8-be73c7cad1f4")]
11+
documents.each do |document|
12+
# hash = {
13+
# images: edition.revision.lead_image_revision.inspect,
14+
# attachments: # TODO attachments,
15+
# }
16+
17+
hash = WhitehallMigration::DocumentExport.export_to_hash(document)
18+
19+
pp hash
20+
end
21+
# TODO: think about how to avoid triggering an update to subscribers when republishing these docs.
22+
end
23+
end

0 commit comments

Comments
 (0)