|
15 | 15 | DATA_FILE = "#{SITE_ROOT}external/docs/data/docs.yml" |
16 | 16 |
|
17 | 17 | def read_data |
18 | | - if File.exists?(DATA_FILE) |
| 18 | + if File.exist?(DATA_FILE) |
19 | 19 | # `permitted_classes` required to allow running with Ruby v3.1 |
20 | 20 | data = YAML.load_file(DATA_FILE, permitted_classes: [Time]) |
21 | 21 | else |
@@ -133,7 +133,7 @@ def index_l10n_doc(filter_tags, doc_list, get_content) |
133 | 133 | end |
134 | 134 | asciidoc = make_asciidoc(content) |
135 | 135 | asciidoc_sha = Digest::SHA1.hexdigest(asciidoc.source) |
136 | | - if !File.exists?("#{SITE_ROOT}external/docs/asciidoc/#{asciidoc_sha}") |
| 136 | + if !File.exist?("#{SITE_ROOT}external/docs/asciidoc/#{asciidoc_sha}") |
137 | 137 | FileUtils.mkdir_p("#{SITE_ROOT}external/docs/asciidoc") |
138 | 138 | File.open("#{SITE_ROOT}external/docs/asciidoc/#{asciidoc_sha}", "w") do |out| |
139 | 139 | out.write(content) |
@@ -204,7 +204,7 @@ def index_l10n_doc(filter_tags, doc_list, get_content) |
204 | 204 | # not exist. In these cases, redirect to the English version. |
205 | 205 | check_paths.each do |path| |
206 | 206 | doc_path = "#{SITE_ROOT}external/docs/content/#{path}.html" |
207 | | - if !File.exists?(doc_path) |
| 207 | + if !File.exist?(doc_path) |
208 | 208 | front_matter = { "redirect_to" => "#{path.sub(/\/[^\/]*$/, '')}" } # rtrim `/<lang>` |
209 | 209 | FileUtils.mkdir_p(File.dirname(doc_path)) |
210 | 210 | File.open(doc_path, "w") do |out| |
@@ -416,7 +416,7 @@ def index_doc(filter_tags, doc_list, get_content) |
416 | 416 |
|
417 | 417 | asciidoc = make_asciidoc(content) |
418 | 418 | asciidoc_sha = Digest::SHA1.hexdigest(asciidoc.source) |
419 | | - if !File.exists?("#{SITE_ROOT}external/docs/asciidoc/#{asciidoc_sha}") |
| 419 | + if !File.exist?("#{SITE_ROOT}external/docs/asciidoc/#{asciidoc_sha}") |
420 | 420 | FileUtils.mkdir_p("#{SITE_ROOT}external/docs/asciidoc") |
421 | 421 | File.open("#{SITE_ROOT}external/docs/asciidoc/#{asciidoc_sha}", "w") do |out| |
422 | 422 | out.write(content) |
@@ -481,7 +481,7 @@ def index_doc(filter_tags, doc_list, get_content) |
481 | 481 | "version" => doc_versions[changed_in], |
482 | 482 | } |
483 | 483 |
|
484 | | - if changed_in != doc_version_index && File.exists?("#{doc_path}/#{version}.html") |
| 484 | + if changed_in != doc_version_index && File.exist?("#{doc_path}/#{version}.html") |
485 | 485 | # remove obsolete file |
486 | 486 | File.delete("#{doc_path}/#{version}.html") |
487 | 487 | end |
@@ -552,7 +552,7 @@ def index_doc(filter_tags, doc_list, get_content) |
552 | 552 | # git/git repository. |
553 | 553 | check_paths.each do |path| |
554 | 554 | doc_path = "#{SITE_ROOT}external/docs/content/#{path}.html" |
555 | | - if !File.exists?(doc_path) |
| 555 | + if !File.exist?(doc_path) |
556 | 556 | type = 'blob' |
557 | 557 | target = path.sub(/^docs\//, '') |
558 | 558 | if target == 'api-index' |
|
0 commit comments