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.12.4 lib/tasks/para_tasks.rake
para-0.12.3 lib/tasks/para_tasks.rake
para-0.12.2 lib/tasks/para_tasks.rake
para-0.12.1 lib/tasks/para_tasks.rake
para-0.12.0 lib/tasks/para_tasks.rake
para-0.11.4 lib/tasks/para_tasks.rake
para-0.11.3 lib/tasks/para_tasks.rake
para-0.11.2 lib/tasks/para_tasks.rake
para-0.11.1 lib/tasks/para_tasks.rake
para-0.11.0 lib/tasks/para_tasks.rake
para-0.10.0 lib/tasks/para_tasks.rake
para-0.9.4 lib/tasks/para_tasks.rake
para-0.9.3.3 lib/tasks/para_tasks.rake
para-0.9.3.2 lib/tasks/para_tasks.rake
para-0.9.3.1 lib/tasks/para_tasks.rake
para-0.9.2 lib/tasks/para_tasks.rake
para-0.9.0 lib/tasks/para_tasks.rake
para-0.8.15 lib/tasks/para_tasks.rake
para-0.8.14 lib/tasks/para_tasks.rake
para-0.8.13 lib/tasks/para_tasks.rake