Sha256: 6425e684610a8fea3d073afe6c9dbaf05e80c6a010ff6ddbe5bbf246cfa6e830

Contents?: true

Size: 1.01 KB

Versions: 8

Compression:

Stored size: 1.01 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! type_id: Card::BootswatchSkinID
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
card-1.100.0 mod/bootstrap/db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-1.99.6 mod/bootstrap/db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-1.99.5 mod/bootstrap/db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-1.99.4 mod/bootstrap/db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-1.99.3 mod/bootstrap/db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-1.99.2 mod/bootstrap/db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-1.99.1 mod/bootstrap/db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb
card-1.99.0 mod/bootstrap/db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb