Skip to content
This repository was archived by the owner on Jan 8, 2022. It is now read-only.

[HOLD] Migration ( DO NOT USE) #507

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
Export all the collections
jcoyne committed May 27, 2021
commit 4b62d4ebec964eb563e2e650ceded34e1c90b30c
7 changes: 5 additions & 2 deletions bin/export-collections
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

# Usage:
# RAILS_ENV=production bin/export-collections > collections.jsonl

require_relative '../config/environment'
list = Hydrus::Collection.where(pid: 'druid:vq434wh5503') # Hydrus::Collection.all
list = Hydrus::Collection.all

def serialize(coll)
creator = coll.events.ng_xml.xpath('//event[text()="Collection created"]/@who').to_s
@@ -25,4 +28,4 @@ end

warn "Exporting #{list.count} collections"

list.map { |collection| serialize(collection) }
puts list.map { |collection| serialize(collection).to_json }