File: 0002-adjust-for-Ruby3-replace-exists-method-with-exist.patch

package info (click to toggle)
nom 0.1.5-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 260 kB
  • sloc: ruby: 650; makefile: 10
file content (50 lines) | stat: -rw-r--r-- 1,799 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
From d0d1c2d166198564aa71504bb6124ff18e7ab053 Mon Sep 17 00:00:00 2001
From: Holger Levsen <holger@layer-acht.org>
Date: Sat, 21 Jun 2025 12:58:40 +0200
Subject: [PATCH] adjust for Ruby3: replace exists method with exist

as described in https://github.com/blinry/nom/issues/19
and fixed in https://github.com/blinry/nom/commit/79ba1df8d8f15e97ca57e7fd7d360f3427bc8761
(though that commit has other changes too which we don't want right now)

Signed-off-by: Holger Levsen <holger@layer-acht.org>
---
 lib/nom/config.rb | 2 +-
 lib/nom/nom.rb    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/nom/config.rb b/lib/nom/config.rb
index 3703af0..b4f078a 100644
--- a/lib/nom/config.rb
+++ b/lib/nom/config.rb
@@ -6,7 +6,7 @@ module Nom
             @file = file
 
             @config = {}
-            if File.exists? file
+            if File.exist? file
                 @config = YAML.load_file(file, permitted_classes: [Date])
             end
 
diff --git a/lib/nom/nom.rb b/lib/nom/nom.rb
index 86f4dfc..ff98bbc 100644
--- a/lib/nom/nom.rb
+++ b/lib/nom/nom.rb
@@ -16,12 +16,12 @@ module Nom
             xdg_data = (ENV["XDG_DATA_HOME"] or File.join(Dir.home, ".local", "share"))
             preferred_config_location = File.join(xdg_data, "nom")
             [ preferred_config_location, File.join(Dir.home,".nom") ].each do |dir|
-                if Dir.exists? dir
+                if Dir.exist? dir
                     @nom_dir = dir
                     break
                 end
             end
-            if not @nom_dir or not Dir.exists? @nom_dir
+            if not @nom_dir or not Dir.exist? @nom_dir
                 @nom_dir = preferred_config_location
                 puts "Creating #{@nom_dir}"
                 Dir.mkdir(@nom_dir)
-- 
2.47.2