Sha256: 7b8cf119c54be986a73f1ad59c0db13c14d16b365f7a8bc8b673031a92f61566

Contents?: true

Size: 863 Bytes

Versions: 5

Compression:

Stored size: 863 Bytes

Contents

# -*- encoding : utf-8 -*-

class ReorganizeScripts < Cardio::Migration::Core
  def up
    create_or_update! name: "*machine cache", codename: "machine_cache"
    ensure_card name: "script: mods", type_id: Card::PointerID,
                codename: "script_mods"
    ensure_card name: "script: editors", type_id: Card::PointerID,
                codename: "script_editors"

    update_script_rules
  end

  def update_script_rules
    Card.search(type_id: Card::PointerID,
                right: { codename: "script" },
                link_to: "script: slot").each do |script_rule|
      [:script_tinymce, :script_ace, :bootstrap_js].each do |codename|
        name = Card[codename].name
        script_rule.drop_item name
      end
      script_rule.add_item "script: editors"
      script_rule.add_item "script: mods"
      script_rule.save!
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
card-1.101.4 db/migrate_core_cards/20160804112510_reorganize_scripts.rb
card-1.101.3 db/migrate_core_cards/20160804112510_reorganize_scripts.rb
card-1.101.2 db/migrate_core_cards/20160804112510_reorganize_scripts.rb
card-1.101.1 db/migrate_core_cards/20160804112510_reorganize_scripts.rb
card-1.101.0 db/migrate_core_cards/20160804112510_reorganize_scripts.rb