Sha256: f74151e0a6a516a195bc42648f87fe90e0a47ceba6d14f103e77a4309f1bbe14

Contents?: true

Size: 1.02 KB

Versions: 12

Compression:

Stored size: 1.02 KB

Contents

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

require_relative "lib/skin"

class AddTypeBootswatchSkin < Card::Migration::Core
  STYLE_INPUT_SEARCH = <<-JSON.strip_heredoc
    {"type": {"codename": ["in", "skin", "bootswatch_skin", "customized_bootswatch_skin"]}, "sort": "name"}
  JSON
  def up
    ensure_card "style: mods", codename: "style_mods",
                               type_id: Card::PointerID
    ensure_card "style: right sidebar", codename: "style_right_sidebar"
    Card::Cache.reset_all

    ensure_card "Bootswatch skin", type_id: Card::CardtypeID,
                                   codename: "bootswatch_skin"
    update_card %i[style right options], content: STYLE_INPUT_SEARCH
    Card::Cache.reset_all
    change_type_of_skins
  end

  def change_type_of_skins
    Skin.themes.each do |theme_name|
      skin_name = Skin.new(theme_name).skin_name
      puts "updating #{skin_name}"
      card = Card.fetch(skin_name)
      next puts "card not found" unless card
      card.update_attributes! type_id: Card::BootswatchSkinID
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
card-1.96.7 mod/bootstrap/db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-1.96.6 mod/bootstrap/db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-1.96.5 mod/bootstrap/db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-1.96.4 mod/bootstrap/db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-1.96.3 mod/bootstrap/db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-1.96.2 mod/bootstrap/db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-1.96.1 mod/bootstrap/db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-1.96.0 mod/bootstrap/db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-1.95.3 mod/bootstrap/db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-1.95.2 mod/bootstrap/db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-1.95.1 mod/bootstrap/db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-1.95.0 mod/bootstrap/db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb