Sha256: b471dc0664c30c5f469af2c79d4010f1fd0f2348a5b38dc763b370390fc24976

Contents?: true

Size: 860 Bytes

Versions: 12

Compression:

Stored size: 860 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|
      %i[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

12 entries across 12 versions & 1 rubygems

Version Path
card-1.104.2 db/migrate_core_cards/20160804112510_reorganize_scripts.rb
card-1.104.1 db/migrate_core_cards/20160804112510_reorganize_scripts.rb
card-1.104.0 db/migrate_core_cards/20160804112510_reorganize_scripts.rb
card-1.103.4 db/migrate_core_cards/20160804112510_reorganize_scripts.rb
card-1.103.3 db/migrate_core_cards/20160804112510_reorganize_scripts.rb
card-1.103.2 db/migrate_core_cards/20160804112510_reorganize_scripts.rb
card-1.103.1 db/migrate_core_cards/20160804112510_reorganize_scripts.rb
card-1.103.0 db/migrate_core_cards/20160804112510_reorganize_scripts.rb
card-1.101.7 db/migrate_core_cards/20160804112510_reorganize_scripts.rb
card-1.102.0 db/migrate_core_cards/20160804112510_reorganize_scripts.rb
card-1.101.6 db/migrate_core_cards/20160804112510_reorganize_scripts.rb
card-1.101.5 db/migrate_core_cards/20160804112510_reorganize_scripts.rb