Sha256: c140f515af61e79586cc0e639809699842b90777c2f949aadd8b653771090f0c

Contents?: true

Size: 958 Bytes

Versions: 11

Compression:

Stored size: 958 Bytes

Contents

# frozen_string_literal: true

module Karafka
  module Web
    module Management
      # Cleans the boot file from Karafka Web-UI details.
      class CleanBootFile < Base
        # Web-UI enabled code
        ENABLER_CODE = ExtendBootFile::ENABLER_CODE

        private_constant :ENABLER_CODE

        # Removes the Web-UI boot file data
        def call
          karafka_rb = File.readlines(Karafka.boot_file)

          if karafka_rb.any? { |line| line.include?(ENABLER_CODE) }
            puts 'Updating the Karafka boot file...'
            karafka_rb.delete_if { |line| line.include?(ENABLER_CODE) }

            File.write(Karafka.boot_file, karafka_rb.join)
            puts "Karafka boot file #{successfully} updated."
            puts 'Make sure to remove configuration and other customizations as well.'
          else
            puts 'Karafka Web UI components not found in the boot file.'
          end
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
karafka-web-0.7.10 lib/karafka/web/management/clean_boot_file.rb
karafka-web-0.7.9 lib/karafka/web/management/clean_boot_file.rb
karafka-web-0.7.8 lib/karafka/web/management/clean_boot_file.rb
karafka-web-0.7.7 lib/karafka/web/management/clean_boot_file.rb
karafka-web-0.7.6 lib/karafka/web/management/clean_boot_file.rb
karafka-web-0.7.5 lib/karafka/web/management/clean_boot_file.rb
karafka-web-0.7.4 lib/karafka/web/management/clean_boot_file.rb
karafka-web-0.7.3 lib/karafka/web/management/clean_boot_file.rb
karafka-web-0.7.2 lib/karafka/web/management/clean_boot_file.rb
karafka-web-0.7.1 lib/karafka/web/management/clean_boot_file.rb
karafka-web-0.7.0 lib/karafka/web/management/clean_boot_file.rb