module SvelteOnRails::Installer::Utils

def self.add_line_to_file(file_path, line)

def self.add_line_to_file(file_path, line)
  file_content = File.exist?(file_path) ? File.read(file_path) : ""
  if file_content.match?(/#{line}/)
    puts "#{line} already present in #{file_path}, nothing changed here."
    return
  end
  File.open(file_path, 'a') do |file|
    file.puts(line)
  end
  puts "added #{line} to #{file_path}."
rescue StandardError => e
  puts "Error: #{e.message}"
end