Sha256: ab816d496b3ff352435c52c42ab334dc273451ca3128a811be81c7fd2245af8a

Contents?: true

Size: 1.14 KB

Versions: 8

Compression:

Stored size: 1.14 KB

Contents

# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
# frozen_string_literal: true

module Removers
  def remove_local_multiverse_databases
    list_databases_command = %(echo "show databases" | mysql -u root)
    databases = `#{list_databases_command}`.chomp!.split("\n").select { |s| s.include?('multiverse') }
    databases.each do |database|
      puts "Dropping #{database}"
      `echo "drop database #{database}" | mysql -u root`
    end
  rescue => error
    puts "ERROR: Cannot get MySQL databases..."
    puts error.message
  end

  def remove_generated_gemfiles
    file_path = File.expand_path("test/multiverse/suites")
    Dir.glob(File.join(file_path, "**", "Gemfile*")).each do |fn|
      puts "Removing #{fn.gsub(file_path, '.../suites')}"
      FileUtils.rm(fn)
    end
  end

  def remove_generated_gemfile_lockfiles
    file_path = File.expand_path("test/environments")
    Dir.glob(File.join(file_path, "**", "Gemfile.lock")).each do |fn|
      puts "Removing #{fn.gsub(file_path, '.../environments')}"
      FileUtils.rm(fn)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
newrelic_rpm-9.0.0 lib/tasks/helpers/removers.rb
newrelic_rpm-8.16.0 lib/tasks/helpers/removers.rb
newrelic_rpm-8.15.0 lib/tasks/helpers/removers.rb
newrelic_rpm-8.14.0 lib/tasks/helpers/removers.rb
newrelic_rpm-8.13.1 lib/tasks/helpers/removers.rb
newrelic_rpm-8.13.0 lib/tasks/helpers/removers.rb
newrelic_rpm-8.12.0 lib/tasks/helpers/removers.rb
newrelic_rpm-8.11.0 lib/tasks/helpers/removers.rb