Sha256: 5a305d8c95afe42b76358f404927f057713313c3211859d3535ce8b0408c4b75

Contents?: true

Size: 979 Bytes

Versions: 53

Compression:

Stored size: 979 Bytes

Contents

namespace :para do
  namespace :upgrade do
    desc <<-DESC
      Update database from SingletonResource to Form component without losing data
    DESC

    task singleton_to_form: :environment do
      class Para::Component::SingletonResource < Para::Component::Base
      end

      Para::Component::Base.where(type: 'Para::Component::SingletonResource').pluck(:identifier, :id).each do |identifier, id|
        if (form_component_id = Para::Component::Form.find_by_identifier(identifier).try(:id))
          Para::ComponentResource.where(component_id: id).update_all(component_id: form_component_id)
        end

        Para::Component::Base.where(id: id).destroy_all
      end
    end
  end

  namespace :components do
    desc <<-DESC
      Remove all components that are no longer referenced in the components.rb
      configuration file
    DESC

    task clean: :environment do
      require 'para/components_cleaner'
      Para::ComponentsCleaner.run
    end
  end
end

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
para-0.7.3.p5 lib/tasks/para_tasks.rake
para-0.7.3.p4 lib/tasks/para_tasks.rake
para-0.7.3.p3 lib/tasks/para_tasks.rake
para-0.7.3.p2 lib/tasks/para_tasks.rake
para-0.7.3.p1 lib/tasks/para_tasks.rake
para-0.7.3 lib/tasks/para_tasks.rake
para-0.7.2 lib/tasks/para_tasks.rake
para-0.7.1 lib/tasks/para_tasks.rake
para-0.7.0 lib/tasks/para_tasks.rake
para-0.6.9 lib/tasks/para_tasks.rake
para-0.6.8 lib/tasks/para_tasks.rake
para-0.6.7 lib/tasks/para_tasks.rake
para-0.6.3 lib/tasks/para_tasks.rake