Sha256: ccdcb62cfd28df8449aaaa61d9185fbbefbf922faf39280290c4b86d8ed86695

Contents?: true

Size: 590 Bytes

Versions: 4

Compression:

Stored size: 590 Bytes

Contents

# Pull in tasks from AF::Noid
af_noid = Gem::Specification.find_by_name 'active_fedora-noid'
load "#{af_noid.gem_dir}/lib/tasks/noid_tasks.rake"

namespace :sufia do
  namespace :noid do
    desc 'Migrate minter state file'
    task migrate_statefile: :environment do
      ENV['AFNOID_STATEFILE'] = Sufia.config.minter_statefile
      Rake::Task['active_fedora:noid:migrate_statefile'].invoke if needs_migration?(Sufia.config.minter_statefile)
    end
  end
end

def needs_migration?(statefile)
  !!YAML.load(File.open(statefile).read)
rescue Psych::SyntaxError, Errno::ENOENT
  false
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sufia-7.0.0.beta4 tasks/noid.rake
sufia-7.0.0.beta3 tasks/noid.rake
sufia-7.0.0.beta2 tasks/noid.rake
sufia-7.0.0.beta1 tasks/noid.rake