OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
replace deprecated File.exists?
ulfertscb63949c580e
diff --git a/app/workers/backup_job.rb b/app/workers/backup_job.rbindex 26755019491..d4f74ba0c16 100644--- a/app/workers/backup_job.rb+++ b/app/workers/backup_job.rb@@ -114,7 +114,7 @@ class BackupJob < ::ApplicationJobdef remove_files!(*files)Array(files).each do |file|- FileUtils.rm file if File.exists? file+ FileUtils.rm file if File.exist? fileendenddiff --git a/config/application.rb b/config/application.rbindex d9a8c73f0dd..e2839d4fe24 100644--- a/config/application.rb+++ b/config/application.rb@@ -176,7 +176,7 @@ module OpenProject# Load any local configuration that is kept out of source control# (e.g. patches).- if File.exists?(File.join(File.dirname(__FILE__), 'additional_environment.rb'))+ if File.exist?(File.join(File.dirname(__FILE__), 'additional_environment.rb'))instance_eval File.read(File.join(File.dirname(__FILE__), 'additional_environment.rb'))enddiff --git a/config/boot.rb b/config/boot.rbindex ad889d1a77b..cf39b6fb28a 100644--- a/config/boot.rb+++ b/config/boot.rb@@ -32,7 +32,7 @@ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)# Load any local boot extras that is kept out of source control# (e.g., silencing of deprecations)-if File.exists?(File.join(File.dirname(__FILE__), 'additional_boot.rb'))+if File.exist?(File.join(File.dirname(__FILE__), 'additional_boot.rb'))instance_eval File.read(File.join(File.dirname(__FILE__), 'additional_boot.rb'))enddiff --git a/lib/open_project/content_type_detector.rb b/lib/open_project/content_type_detector.rbindex f6ecc640c14..55af937b3cf 100644--- a/lib/open_project/content_type_detector.rb+++ b/lib/open_project/content_type_detector.rb@@ -105,7 +105,7 @@ module OpenProjectprivatedef empty_file?- File.exists?(@filename) && File.size(@filename) == 0+ File.exist?(@filename) && File.size(@filename) == 0endalias :empty? :empty_file?diff --git a/lib/open_project/version.rb b/lib/open_project/version.rbindex 7730989e11e..af5e84d3f35 100644--- a/lib/open_project/version.rb+++ b/lib/open_project/version.rb@@ -60,7 +60,7 @@ module OpenProjectdef product_versioncached_or_block(:@product_version) dopath = Rails.root.join('config', 'PRODUCT_VERSION')- if File.exists? path+ if File.exist? pathFile.read(path)endend@@ -69,7 +69,7 @@ module OpenProjectdef core_versioncached_or_block(:@core_version) dopath = Rails.root.join('config', 'CORE_VERSION')- if File.exists? path+ if File.exist? pathFile.read(path)endend@@ -96,7 +96,7 @@ module OpenProjectdef release_date_from_filecached_or_block(:@release_date_from_file) dopath = Rails.root.join('config', 'RELEASE_DATE')- if File.exists? path+ if File.exist? paths = File.read(path)Date.parse(s)enddiff --git a/lib/tasks/attachments.rake b/lib/tasks/attachments.rakeindex ad68151f468..794bffc260e 100644--- a/lib/tasks/attachments.rake+++ b/lib/tasks/attachments.rake@@ -83,7 +83,7 @@ namespace :attachments do# file in the target location.def self.store!(attachment)return nil unless attachment.attributes['file'].present? &&- File.exists?(attachment.file.path)+ File.exist?(attachment.file.path)new.tap do |target|target.id = attachment.iddiff --git a/lib/tasks/copyright.rake b/lib/tasks/copyright.rakeindex 374c7330b4f..ead2e8ef683 100644--- a/lib/tasks/copyright.rake+++ b/lib/tasks/copyright.rake@@ -53,9 +53,9 @@ namespace :copyright dodef copyright_file(options = {})path = 'COPYRIGHT_short'if options[:path]- path = File.join(options[:path], 'COPYRIGHT_short') if File.exists?(File.join(options[:path],+ path = File.join(options[:path], 'COPYRIGHT_short') if File.exist?(File.join(options[:path],'COPYRIGHT_short'))- path = File.join(options[:path], 'COPYRIGHT_short.md') if File.exists?(File.join(options[:path],+ path = File.join(options[:path], 'COPYRIGHT_short.md') if File.exist?(File.join(options[:path],'COPYRIGHT_short.md'))endpathdiff --git a/modules/bim/app/contracts/bim/ifc_models/base_contract.rb b/modules/bim/app/contracts/bim/ifc_models/base_contract.rbindex ef128502b0e..b6fcd8298c3 100644--- a/modules/bim/app/contracts/bim/ifc_models/base_contract.rb+++ b/modules/bim/app/contracts/bim/ifc_models/base_contract.rb@@ -80,7 +80,7 @@ module Bim# For local uploads the file must remain to be copied later to its final (local) destination from the cache.return unless OpenProject::Configuration.direct_uploads?- FileUtils.rm file_path if File.exists? file_path+ FileUtils.rm file_path if File.exist? file_pathenddef uploader_is_ifc_attachment_authordiff --git a/modules/bim/spec/services/ifc_models/view_conversion_service_spec.rb b/modules/bim/spec/services/ifc_models/view_conversion_service_spec.rbindex 26896672267..e51c3f1a78a 100644--- a/modules/bim/spec/services/ifc_models/view_conversion_service_spec.rb+++ b/modules/bim/spec/services/ifc_models/view_conversion_service_spec.rb@@ -94,7 +94,7 @@ describe Bim::IfcModels::ViewConverterService do# mocking all convert! calls so they do nothing but create an empty dummy result fileallow(subject).to receive(:convert!) do |source_file, ext|- expect(File.exists?(source_file)).to be_truthy, "Expected #{source_file} to exist."+ expect(File.exist?(source_file)).to be_truthy, "Expected #{source_file} to exist."target_file_path = source_file.sub ext_regex, "." + extdiff --git a/spec/lib/open_project/storage_spec.rb b/spec/lib/open_project/storage_spec.rbindex 5d357725e4f..d913bca8d9e 100644--- a/spec/lib/open_project/storage_spec.rb+++ b/spec/lib/open_project/storage_spec.rb@@ -59,7 +59,7 @@ describe OpenProject::Storage doendit 'should contain one fs entry' do- expect(File.exists?(tmpdir)).to be true+ expect(File.exist?(tmpdir)).to be trueexpect(subject.length).to be == 1entry = subject.values.firstdiff --git a/spec/models/attachment_spec.rb b/spec/models/attachment_spec.rbindex 30c678d06f7..07eb4e312bf 100644--- a/spec/models/attachment_spec.rb+++ b/spec/models/attachment_spec.rb@@ -150,7 +150,7 @@ describe Attachment, type: :model dodescribe 'create' doit('creates a jpg file called test') do- expect(File.exists?(attachment.diskfile.path)).to eq true+ expect(File.exist?(attachment.diskfile.path)).to eq trueendit('has the content type "image/jpeg"') do@@ -191,7 +191,7 @@ describe Attachment, type: :model dobefore doattachment.save!- expect(File.exists?(attachment.file.path)).to eq true+ expect(File.exist?(attachment.file.path)).to eq trueattachment.destroyattachment.run_callbacks(:commit)@@ -200,7 +200,7 @@ describe Attachment, type: :model doendit "deletes the attachment's file" do- expect(File.exists?(attachment.file.path)).to eq false+ expect(File.exist?(attachment.file.path)).to eq falseendenddiff --git a/spec/support/rspec_disabled_specs.rb b/spec/support/rspec_disabled_specs.rbindex 174ae88a737..06d8cc993e5 100644--- a/spec/support/rspec_disabled_specs.rb+++ b/spec/support/rspec_disabled_specs.rb@@ -9,7 +9,7 @@ Rails.application.config.plugins_to_test_paths.each do |dir|['disabled_specs.rb', 'disable_specs.rb', 'config_spec_helper.rb'].each do |file_name|file = File.join(dir, 'spec', file_name)- if File.exists?(file)+ if File.exist?(file)puts "Loading #{file}"require fileend