[devdocsgjs/main: 3/12] fix: replace calls to `File.exists?` with `File.exist?`




commit 51cb8984ebc8e73e6c7e56a0d0973cbe987b43fe
Author: Andy Holmes <andrew g r holmes gmail com>
Date:   Mon Sep 19 13:35:47 2022 -0700

    fix: replace calls to `File.exists?` with `File.exist?`
    
    This prints warnings about being deprecated, so replace it with the
    call that the deprecated function wraps.
    
    See: https://github.com/ruby/ruby/blob/ruby_2_7/file.c#L1752-L1781

 lib/docs/storage/file_store.rb | 4 ++--
 lib/tasks/docs.thor            | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/lib/docs/storage/file_store.rb b/lib/docs/storage/file_store.rb
index 47c0e6b4..b0836b35 100644
--- a/lib/docs/storage/file_store.rb
+++ b/lib/docs/storage/file_store.rb
@@ -30,7 +30,7 @@ module Docs
     end
 
     def file_exist?(path)
-      File.exists?(path)
+      File.exist?(path)
     end
 
     def file_mtime(path)
@@ -46,7 +46,7 @@ module Docs
         next if file == path
         Find.prune if File.basename(file)[0] == '.'
         yield file
-        Find.prune unless File.exists?(file)
+        Find.prune unless File.exist?(file)
       end
     end
   end
diff --git a/lib/tasks/docs.thor b/lib/tasks/docs.thor
index 104c2da9..af6220b3 100644
--- a/lib/tasks/docs.thor
+++ b/lib/tasks/docs.thor
@@ -180,7 +180,7 @@ class DocsCLI < Thor
         return
       end
 
-      unless File.exists?(File.join(Docs.store_path, "#{doc.path}.tar.gz"))
+      unless File.exist?(File.join(Docs.store_path, "#{doc.path}.tar.gz"))
         puts "ERROR: package for '#{doc.slug}' documentation not found. Run 'thor docs:package #{doc.slug}' 
to create it."
         return
       end


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]