[DRE-maint] Bug#1052398: Use of deprecated File.exists? and Dir.exists? in gem2deb

Nicos Gollan nicos.gollan at centralnic.com
Thu Sep 21 12:56:18 BST 2023


Package: gem2deb
Version: 2.1

The packaged Ruby code uses calls to the deprecated `File.exists?` and 
`Dir.exists?` methods which need to be replaced with their `.exist?` 
equivalents for compatibility with newer Ruby versions. The calls to 
`File.exists?` are also using the rather weird `::` syntax. A patch 
against current master building and speccing cleanly against Ruby 3.2 is 
attached.

Best regards,
Nicos Gollan
-------------- next part --------------
From ee3c77847b4586c56a301bfda0a582b26ae7919d Mon Sep 17 00:00:00 2001
From: Nicos Gollan <nicos.gollan at centralnic.com>
Date: Thu, 21 Sep 2023 13:54:48 +0200
Subject: [PATCH] Fix calls to deprecated `.exists?`methods

---
 lib/gem2deb/gem_installer.rb | 2 +-
 lib/gem2deb/installer.rb     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/gem2deb/gem_installer.rb b/lib/gem2deb/gem_installer.rb
index ecca3f1..a9924de 100644
--- a/lib/gem2deb/gem_installer.rb
+++ b/lib/gem2deb/gem_installer.rb
@@ -158,7 +158,7 @@ module Gem2Deb
           end
 
           # remove empty plugins/ directory
-          if Dir.exists?('plugins') && Dir.empty?('plugins')
+          if Dir.exist?('plugins') && Dir.empty?('plugins')
               FileUtils::Verbose.rmdir('plugins')
           end
 
diff --git a/lib/gem2deb/installer.rb b/lib/gem2deb/installer.rb
index 3da81d7..48b8931 100644
--- a/lib/gem2deb/installer.rb
+++ b/lib/gem2deb/installer.rb
@@ -60,7 +60,7 @@ module Gem2Deb
           # This is a hack to workaround a problem in rubygems
           vendor_dir = destdir(:libdir)
           vendor_arch_dir = destdir(:archdir, rubyver)
-          if File::exists?(vendor_dir) and File::exists?(vendor_arch_dir)
+          if File.exist?(vendor_dir) and File.exist?(vendor_arch_dir)
             remove_duplicate_files(vendor_dir, vendor_arch_dir)
           end
         end
-- 
2.34.1



More information about the Pkg-ruby-extras-maintainers mailing list