Sha256: 94cb2fe3257e230319ca63e50cc7d8dfe818f499ebdad8512fd948d65579b707

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

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

require_relative "lib/skin"

class AddTypeCustomizedBootswatchSkin < Cardio::Migration::Transform
  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

4 entries across 4 versions & 1 rubygems

Version Path
card-mod-bootstrap-0.18.1 data/transform/20180423143147_add_type_customized_bootswatch_skin.rb
card-mod-bootstrap-0.18.0 data/transform/20180423143147_add_type_customized_bootswatch_skin.rb
card-mod-bootstrap-0.17.0 data/transform/20180423143147_add_type_customized_bootswatch_skin.rb
card-mod-bootstrap-0.16.0 data/transform/20180423143147_add_type_customized_bootswatch_skin.rb