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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|
From 0ef7ac29b0afe2dab01b0a3698ddca10f9983631 Mon Sep 17 00:00:00 2001
From: Bastian Germann <bage@debian.org>
Date: Fri, 7 Feb 2025 21:42:23 +0100
Subject: [PATCH] Replace obsolete File.exists with File.exist
---
lib/fontcustom/manifest.rb | 2 +-
lib/fontcustom/options.rb | 16 ++++++++--------
spec/fontcustom/cli_spec.rb | 2 +-
spec/fontcustom/watcher_spec.rb | 4 ++--
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/lib/fontcustom/manifest.rb b/lib/fontcustom/manifest.rb
index e817e2c..9d83d13 100644
--- a/lib/fontcustom/manifest.rb
+++ b/lib/fontcustom/manifest.rb
@@ -7,7 +7,7 @@ module Fontcustom
def initialize(manifest, cli_options = {})
@manifest = manifest
@cli_options = symbolize_hash cli_options
- if File.exists? @manifest
+ if File.exist? @manifest
reload
if ! @cli_options.empty? && get(:options) != @cli_options
set :options, @cli_options
diff --git a/lib/fontcustom/options.rb b/lib/fontcustom/options.rb
index 6a2b29d..6a7f911 100644
--- a/lib/fontcustom/options.rb
+++ b/lib/fontcustom/options.rb
@@ -39,17 +39,17 @@ module Fontcustom
def set_config_path
@cli_options[:config] = if @cli_options[:config]
path = @cli_options[:config]
- if File.exists?(path) && ! File.directory?(path)
+ if File.exist?(path) && ! File.directory?(path)
path
- elsif File.exists? File.join(path, "fontcustom.yml")
+ elsif File.exist? File.join(path, "fontcustom.yml")
File.join path, "fontcustom.yml"
else
raise Fontcustom::Error, "No configuration file found at `#{path}`."
end
else
- if File.exists? "fontcustom.yml"
+ if File.exist? "fontcustom.yml"
"fontcustom.yml"
- elsif File.exists? File.join("config", "fontcustom.yml")
+ elsif File.exist? File.join("config", "fontcustom.yml")
File.join "config", "fontcustom.yml"
else
false
@@ -134,7 +134,7 @@ module Fontcustom
@options[:output].each do |key, val|
@options[:output][key] = val
- if File.exists?(val) && ! File.directory?(val)
+ if File.exist?(val) && ! File.directory?(val)
raise Fontcustom::Error,
"Output `#{@options[:output][key]}` exists but isn't a directory. Check your options."
end
@@ -145,7 +145,7 @@ module Fontcustom
else
if @options[:output].is_a? String
output = @options[:output]
- if File.exists?(output) && ! File.directory?(output)
+ if File.exist?(output) && ! File.directory?(output)
raise Fontcustom::Error,
"Output `#{output}` exists but isn't a directory. Check your options."
end
@@ -170,7 +170,7 @@ module Fontcustom
else
path = File.expand_path File.join(@options[:input][:templates], template)
end
- unless File.exists? path
+ unless File.exist? path
raise Fontcustom::Error,
"Custom template `#{template}` wasn't found in `#{@options[:input][:templates]}/`. Check your options."
end
@@ -178,7 +178,7 @@ module Fontcustom
end
def check_input(dir)
- if ! File.exists? dir
+ if ! File.exist? dir
raise Fontcustom::Error,
"Input `#{dir}` doesn't exist. Check your options."
elsif ! File.directory? dir
diff --git a/spec/fontcustom/cli_spec.rb b/spec/fontcustom/cli_spec.rb
index a76ce3f..c34cfd4 100644
--- a/spec/fontcustom/cli_spec.rb
+++ b/spec/fontcustom/cli_spec.rb
@@ -11,7 +11,7 @@ describe Fontcustom::CLI do
expect(Dir.glob(File.join(testdir, "fontcustom", "fontcustom_*\.{ttf,svg,woff,eot}")).length).to eq(4)
expect(File.read(manifest)).to match(/"fonts":.+fontcustom\/fontcustom_.+\.ttf"/m)
- expect(File.exists?(preview)).to be_truthy
+ expect(File.exist?(preview)).to be_truthy
end
end
diff --git a/spec/fontcustom/watcher_spec.rb b/spec/fontcustom/watcher_spec.rb
index 14799ef..47f5fc4 100644
--- a/spec/fontcustom/watcher_spec.rb
+++ b/spec/fontcustom/watcher_spec.rb
@@ -64,7 +64,7 @@ describe Fontcustom::Watcher do
ensure
w.send :stop
new = fixture("shared/vectors/test.svg")
- FileUtils.rm(new) if File.exists?(new)
+ FileUtils.rm(new) if File.exist?(new)
end
end
end
@@ -113,7 +113,7 @@ describe Fontcustom::Watcher do
ensure
w.send :stop
new = fixture("shared/vectors/non-vector-file")
- FileUtils.rm(new) if File.exists?(new)
+ FileUtils.rm(new) if File.exist?(new)
end
end
end
|