Sha256: 43292d90b4ff759a05becdb2a7a9aa4c5c0db6d87febf3549b204987cfe87068

Contents?: true

Size: 1.77 KB

Versions: 4

Compression:

Stored size: 1.77 KB

Contents

require 'active_fedora/cleaner'

# These should work for Sufia-based applications, although you will need to modify them
# accordingly if you namespace and conversion strategies differ.

namespace :fedora do

  namespace :migrate do
    desc "Migrates all objects in a Sufia-based application"
    task sufia: :environment do
      migrator = FedoraMigrate.migrate_repository(namespace: "sufia", options: {convert: "descMetadata"})
      migrator.report.save
    end

    desc "Migrates only relationships in a Sufia-based application"
    task relationships: :environment do
      migrator = FedoraMigrate::RepositoryMigrator.new("sufia")
      migrator.migrate_relationships
    end

    desc "Empties out the Fedora4 repository"
    task reset: :environment do
      FedoraMigrate::Logger.info "Removing all objects from the Fedora4 repository"
      ActiveFedora::Cleaner.clean!
    end

    desc "Migrate a single object"
    task :object, [:pid] => :environment do |t, args|
      raise "Please provide a pid, example changeme:1234" if args[:pid].nil?
      FedoraMigrate::ObjectMover.new(
        FedoraMigrate.source.connection.find(args[:pid]), 
        nil, 
        options: {convert: "descMetadata"}
      ).migrate
    end

    desc "Migrate the relationship for a single object"
    task :relationship, [:pid] => :environment do |t, args|
      raise "Please provide a pid, example changeme:1234" if args[:pid].nil?
      FedoraMigrate::RelsExtDatastreamMover.new(FedoraMigrate.source.connection.find(args[:pid])).migrate
    end

    desc "Report the results of a migration"
    task :report, [:file] => :environment do |t, args|
      raise "Please provide a path to a report.json file" if args[:file].nil?
      FedoraMigrate::MigrationReport.new(args[:file]).report_failures
    end
  
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fedora-migrate-0.5.0 lib/tasks/fedora-migrate.rake
fedora-migrate-0.4.0 lib/tasks/fedora-migrate.rake
fedora-migrate-0.3.0 lib/tasks/fedora-migrate.rake
fedora-migrate-0.2.0 lib/tasks/fedora-migrate.rake