lib/solr_wrapper/instance.rb
def extract
      return config.instance_dir if extracted?

      zip_path = download

      begin
        Zip::File.open(zip_path) do |zip_file|
          # Handle entries one by one
          zip_file.each do |entry|
            dest_file = File.join(config.tmp_save_dir, entry.name)
            FileUtils.remove_entry(dest_file, true)
            entry.extract(dest_file)
          end
        end

      rescue Exception => e
        abort "Unable to unzip #{zip_path} into #{config.tmp_save_dir}: #{e.message}"
      end

      begin
        FileUtils.remove_dir(config.instance_dir, true)
        FileUtils.cp_r File.join(config.tmp_save_dir, File.basename(config.download_url, ".zip")), config.instance_dir
        self.extracted_version = config.version
        FileUtils.chmod 0755, config.solr_binary
      rescue Exception => e
        abort "Unable to copy #{config.tmp_save_dir} to #{config.instance_dir}: #{e.message}"
      end

      config.instance_dir
    ensure
      FileUtils.remove_entry config.tmp_save_dir if File.exist? config.tmp_save_dir
    end
def extract
      return config.instance_dir if extracted?

      zip_path = download

      begin
        Zip::File.open(zip_path) do |zip_file|
          # Handle entries one by one
          zip_file.each do |entry|
            dest_file = File.join(config.tmp_save_dir, entry.name)
            FileUtils.remove_entry(dest_file, true)
            entry.extract(dest_file)
          end
        end

      rescue Exception => e
        abort "Unable to unzip #{zip_path} into #{config.tmp_save_dir}: #{e.message}"
      end

      begin
        FileUtils.remove_dir(config.instance_dir, true)
        FileUtils.cp_r File.join(config.tmp_save_dir, File.basename(config.download_url, ".zip")), config.instance_dir
        self.extracted_version = config.version
        FileUtils.chmod 0755, config.solr_binary
      rescue Exception => e
        abort "Unable to copy #{config.tmp_save_dir} to #{config.instance_dir}: #{e.message}"
      end

      config.instance_dir
    ensure
      FileUtils.remove_entry config.tmp_save_dir if File.exist? config.tmp_save_dir
    end
rubocop:disable Lint/RescueException
 extract a copy of solr to instance_dir
 Does noting if solr already exists at instance_dir
 @return [String] instance_dir Directory where solr has been installed