Class: Karafka::Web::Management::Actions::CleanBootFile

Inherits:
Base
  • Object
show all
Defined in:
lib/karafka/web/management/actions/clean_boot_file.rb

Overview

Cleans the boot file from Karafka Web-UI details.

Instance Method Summary collapse

Instance Method Details

#callObject

Removes the Web-UI boot file data



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/karafka/web/management/actions/clean_boot_file.rb', line 15

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