Sha256: b7ee880ddae136c95cb190da0bc2535096c9ff9f2936e9f55cc2e2903e3ba441

Contents?: true

Size: 1.71 KB

Versions: 10

Compression:

Stored size: 1.71 KB

Contents

# frozen_string_literal: true

require "fileutils"
require "thor"

module Alchemy
  class Upgrader::SevenPointThree < Upgrader
    include Thor::Base
    include Thor::Actions

    source_root Alchemy::Engine.root.join("lib/generators/alchemy/install/files")

    class << self
      def remove_admin_stylesheets
        if File.exist? "vendor/assets/stylesheets/alchemy/admin/all.css"
          log "Removing Alchemy admin stylesheets."
          FileUtils.rm_f "vendor/assets/stylesheets/alchemy/admin/all.css"
        end
      end

      def generate_custom_css_entrypoint
        if File.exist? "app/assets/config/manifest.js"
          log "Generating alchemy/admin/custom.css entrypoint file."
          task.copy_file "custom.css", "app/assets/stylesheets/alchemy/admin/custom.css"
          task.append_to_file "app/assets/config/manifest.js", "//= link alchemy/admin/custom.css\n"
          todo(<<~TODO, "Custom styles have been moved to `app/assets/alchemy/admin/custom.css`")
            Check the new `app/assets/alchemy/admin/custom.css` file for any custom styles you might
            have added to the old `vendor/assets/stylesheets/alchemy/admin/all.css` file.
          TODO
        end
      end

      def show_resource_table_notice
        custom_modules = Alchemy::Modules.alchemy_modules.reject { _1["engine_name"] == "alchemy" }
        return if custom_modules.none?

        todo(<<~TODO, "Resource templates have been updated.")
          We updated the resource templates to use the newly introduced
          `Alchemy::Admin::Resource::Table` view component.

          Please update your resource templates accordingly.
        TODO
      end

      private

      def task
        @_task || new
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
alchemy_cms-7.4.2 lib/alchemy/upgrader/seven_point_three.rb
alchemy_cms-7.3.6 lib/alchemy/upgrader/seven_point_three.rb
alchemy_cms-7.4.1 lib/alchemy/upgrader/seven_point_three.rb
alchemy_cms-7.4.0 lib/alchemy/upgrader/seven_point_three.rb
alchemy_cms-7.3.5 lib/alchemy/upgrader/seven_point_three.rb
alchemy_cms-7.3.4 lib/alchemy/upgrader/seven_point_three.rb
alchemy_cms-7.3.3 lib/alchemy/upgrader/seven_point_three.rb
alchemy_cms-7.3.2 lib/alchemy/upgrader/seven_point_three.rb
alchemy_cms-7.3.1 lib/alchemy/upgrader/seven_point_three.rb
alchemy_cms-7.3.0 lib/alchemy/upgrader/seven_point_three.rb