Sha256: 8431aed6f342bd708a80eb3ae2182366f7bbbe82025e03e1ceb02bb906218218

Contents?: true

Size: 757 Bytes

Versions: 1

Compression:

Stored size: 757 Bytes

Contents

# frozen_string_literal: true
require 'tqdm'

task 'monarchy:reparentize' do
  p 'Monarchy reparentize...'

  Monarchy.resource_classes.with_progress.each do |klass|
    klass.all.each do |model|
      model.send(:assign_parent, true)
    end
  end

  Monarchy::Hierarchy.rebuild!
  p 'Monarchy reparentize ended!'
end

task 'monarchy:hierarchization' do
  p 'Monarchy hierarchization...'
  Monarchy.resource_classes.with_progress.each do |klass|
    klass.all.each do |model|
      model.send(:ensure_hierarchy)
    end
  end
  p 'Monarchy hierarchization ended!'
end

task 'monarchy:rebuild' do
  p 'Rebuilding Monarchy...'

  Rake::Task['monarchy:hierarchization'].invoke
  Rake::Task['monarchy:reparentize'].invoke

  p 'Rebuilding Monarchy ended!'
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
monarchy-1.1.3 lib/tasks/monarchy_tasks.rake