Sha256: a767b35ecfe7b5ce6d9e98ba8e61235b6e9fa3b36741f8309ffba1d23aa10197

Contents?: true

Size: 1.56 KB

Versions: 19

Compression:

Stored size: 1.56 KB

Contents

# -*- encoding : utf-8 -*-
require_relative "lib/skin"

class UpdateBootswatchThemesTo4Beta < Card::Migration::Core
  def up
    remove_old_stuff
    update_bootstrap_cards
    add_icon_cards

    puts "Updating bootstrap themes ..."
    Skin.themes.each do |theme_name|
      puts theme_name
      Skin.new(theme_name).create_or_update
    end
    update_bootstrap_default
    Card::Cache.reset_all
  end

  def update_bootstrap_cards
    %w[breakpoints functions variables core mixins].each do |n|
      ensure_scss "bootstrap: #{n}", codename: "bootstrap_#{n}"
      delete_code_card "style: bootstrap #{n}"
    end
    if Card::Codename.exist? :bootstrap_cards
      update_card :bootstrap_cards,
                  name: "style: bootstrap cards",
                  codename: "style_bootstrap_cards"
    end
  end

  def remove_old_stuff
    delete_code_card :bootswatch_shared
    delete_card "bootswatch theme+*right+*structure"
    Card[:all, :style].drop_item! "style: select2"
    Card[:all, :style].drop_item! "style: select2 bootstrap"
    delete_code_card :bootswatch_shared
  end

  def update_bootstrap_default
    ensure_card "bootstrap default skin+bootswatch theme",
                type_id: Card::ScssID,
                content: "{{bootstrap: functions}}" \
                         "{{bootstrap: variables}}" \
                         "{{bootstrap: core}}"
  end

  def add_icon_cards
    %w[font_awesome material_icons].each do |name|
      ensure_css name.tr("_", " "), codename: name
      Card["themeless bootstrap skin"].add_item! name.tr("_", " ")
    end
  end
end


Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
card-1.98.3 mod/bootstrap/db/migrate_core_cards/20170719163733_update_bootswatch_themes_to_4_beta.rb
card-1.98.2 mod/bootstrap/db/migrate_core_cards/20170719163733_update_bootswatch_themes_to_4_beta.rb
card-1.98.1 mod/bootstrap/db/migrate_core_cards/20170719163733_update_bootswatch_themes_to_4_beta.rb
card-1.98.0 mod/bootstrap/db/migrate_core_cards/20170719163733_update_bootswatch_themes_to_4_beta.rb
card-1.97.0.1 mod/bootstrap/db/migrate_core_cards/20170719163733_update_bootswatch_themes_to_4_beta.rb
card-1.97.0 mod/bootstrap/db/migrate_core_cards/20170719163733_update_bootswatch_themes_to_4_beta.rb
card-1.96.8 mod/bootstrap/db/migrate_core_cards/20170719163733_update_bootswatch_themes_to_4_beta.rb
card-1.96.7 mod/bootstrap/db/migrate_core_cards/20170719163733_update_bootswatch_themes_to_4_beta.rb
card-1.96.6 mod/bootstrap/db/migrate_core_cards/20170719163733_update_bootswatch_themes_to_4_beta.rb
card-1.96.5 mod/bootstrap/db/migrate_core_cards/20170719163733_update_bootswatch_themes_to_4_beta.rb
card-1.96.4 mod/bootstrap/db/migrate_core_cards/20170719163733_update_bootswatch_themes_to_4_beta.rb
card-1.96.3 mod/bootstrap/db/migrate_core_cards/20170719163733_update_bootswatch_themes_to_4_beta.rb
card-1.96.2 mod/bootstrap/db/migrate_core_cards/20170719163733_update_bootswatch_themes_to_4_beta.rb
card-1.96.1 mod/bootstrap/db/migrate_core_cards/20170719163733_update_bootswatch_themes_to_4_beta.rb
card-1.96.0 mod/bootstrap/db/migrate_core_cards/20170719163733_update_bootswatch_themes_to_4_beta.rb
card-1.95.3 mod/bootstrap/db/migrate_core_cards/20170719163733_update_bootswatch_themes_to_4_beta.rb
card-1.95.2 mod/bootstrap/db/migrate_core_cards/20170719163733_update_bootswatch_themes_to_4_beta.rb
card-1.95.1 mod/bootstrap/db/migrate_core_cards/20170719163733_update_bootswatch_themes_to_4_beta.rb
card-1.95.0 mod/bootstrap/db/migrate_core_cards/20170719163733_update_bootswatch_themes_to_4_beta.rb