Sha256: de17885ce3f066f07e94468701b6021d10f26b26aefbf211072d79fefda81756

Contents?: true

Size: 1.01 KB

Versions: 9

Compression:

Stored size: 1.01 KB

Contents

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

require_relative "lib/skin"

class AddTypeCustomizedBootswatchSkin < Cardio::Migration::Core
  def up
    rename_customized_bootswatch_skin
    Card.ensure name: "*stylesheets", codename: "stylesheets"
    Card.ensure name: "*bootswatch", codename: "bootswatch"
    Card.ensure name: "*variables", codename: "variables"
    Card.ensure name: "*colors", codename: "colors"

    Skin.themes.each do |theme_name|
      skin = Skin.new(theme_name)
      Card.ensure name: skin.skin_name, codename: skin.skin_codename
    end

    remove_deprecated_bootswatch_skins
  end

  def rename_customized_bootswatch_skin
    Card.ensure name: "Customized bootswatch skin",
                codename: "customized_bootswatch_skin",
                type: :cardtype
  end

  def remove_deprecated_bootswatch_skins
    Card.fetch("readable skin+image")&.update_column :codename, nil
    delete_code_card "readable skin"
    Card.fetch("paper skin+image")&.update_column :codename, nil
    delete_code_card "paper skin"
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
card-mod-bootstrap-0.15.6 db/migrate_core_cards/20180423143147_add_type_customized_bootswatch_skin.rb
card-mod-bootstrap-0.15.5 db/migrate_core_cards/20180423143147_add_type_customized_bootswatch_skin.rb
card-mod-bootstrap-0.15.4 db/migrate_core_cards/20180423143147_add_type_customized_bootswatch_skin.rb
card-mod-bootstrap-0.15.3 db/migrate_core_cards/20180423143147_add_type_customized_bootswatch_skin.rb
card-mod-bootstrap-0.15.1.2 db/migrate_core_cards/20180423143147_add_type_customized_bootswatch_skin.rb
card-mod-bootstrap-0.15.2.pre1 db/migrate_core_cards/20180423143147_add_type_customized_bootswatch_skin.rb
card-mod-bootstrap-0.15.1.1 db/migrate_core_cards/20180423143147_add_type_customized_bootswatch_skin.rb
card-mod-bootstrap-0.15.1 db/migrate_core_cards/20180423143147_add_type_customized_bootswatch_skin.rb
card-mod-bootstrap-0.15.0 db/migrate_core_cards/20180423143147_add_type_customized_bootswatch_skin.rb