Sha256: d515c9fd94e711cdb9158f4d73f8dfe498a3baa8122063beaca6f90fac045da8

Contents?: true

Size: 861 Bytes

Versions: 8

Compression:

Stored size: 861 Bytes

Contents

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

class ReorganizeScripts < Card::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

8 entries across 8 versions & 1 rubygems

Version Path
card-1.100.0 db/migrate_core_cards/20160804112510_reorganize_scripts.rb
card-1.99.6 db/migrate_core_cards/20160804112510_reorganize_scripts.rb
card-1.99.5 db/migrate_core_cards/20160804112510_reorganize_scripts.rb
card-1.99.4 db/migrate_core_cards/20160804112510_reorganize_scripts.rb
card-1.99.3 db/migrate_core_cards/20160804112510_reorganize_scripts.rb
card-1.99.2 db/migrate_core_cards/20160804112510_reorganize_scripts.rb
card-1.99.1 db/migrate_core_cards/20160804112510_reorganize_scripts.rb
card-1.99.0 db/migrate_core_cards/20160804112510_reorganize_scripts.rb