From 25a4be7269daba9cf03f943a91c502e716235aca Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Mon, 16 Jan 2023 21:55:30 +0000 Subject: [PATCH] Use `require_relative` instead of `File.dirname(__FILE__) + ...` (#38093). Patch by Go MAEDA. git-svn-id: https://svn.redmine.org/redmine/trunk@22052 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/plugins/acts_as_activity_provider/init.rb | 2 +- lib/plugins/acts_as_attachable/init.rb | 2 +- lib/plugins/acts_as_customizable/init.rb | 2 +- lib/plugins/acts_as_event/init.rb | 2 +- lib/plugins/acts_as_searchable/init.rb | 2 +- lib/plugins/acts_as_tree/init.rb | 2 +- lib/plugins/acts_as_watchable/init.rb | 2 +- lib/plugins/gravatar/init.rb | 2 +- lib/redmine/core_ext/string.rb | 4 ++-- lib/redmine/utils.rb | 4 ++-- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/plugins/acts_as_activity_provider/init.rb b/lib/plugins/acts_as_activity_provider/init.rb index 465ab3b9b..cfd1a5141 100644 --- a/lib/plugins/acts_as_activity_provider/init.rb +++ b/lib/plugins/acts_as_activity_provider/init.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true -require File.dirname(__FILE__) + '/lib/acts_as_activity_provider' +require_relative 'lib/acts_as_activity_provider' ActiveRecord::Base.send(:include, Redmine::Acts::ActivityProvider) diff --git a/lib/plugins/acts_as_attachable/init.rb b/lib/plugins/acts_as_attachable/init.rb index fad72214c..16ca1a207 100644 --- a/lib/plugins/acts_as_attachable/init.rb +++ b/lib/plugins/acts_as_attachable/init.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true -require File.dirname(__FILE__) + '/lib/acts_as_attachable' +require_relative 'lib/acts_as_attachable' ActiveRecord::Base.send(:include, Redmine::Acts::Attachable) diff --git a/lib/plugins/acts_as_customizable/init.rb b/lib/plugins/acts_as_customizable/init.rb index c44db3df0..8b04bf4ca 100644 --- a/lib/plugins/acts_as_customizable/init.rb +++ b/lib/plugins/acts_as_customizable/init.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true -require File.dirname(__FILE__) + '/lib/acts_as_customizable' +require_relative 'lib/acts_as_customizable' ActiveRecord::Base.send(:include, Redmine::Acts::Customizable) diff --git a/lib/plugins/acts_as_event/init.rb b/lib/plugins/acts_as_event/init.rb index 2c025f2c0..2ac430796 100644 --- a/lib/plugins/acts_as_event/init.rb +++ b/lib/plugins/acts_as_event/init.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true -require File.dirname(__FILE__) + '/lib/acts_as_event' +require_relative 'lib/acts_as_event' ActiveRecord::Base.send(:include, Redmine::Acts::Event) diff --git a/lib/plugins/acts_as_searchable/init.rb b/lib/plugins/acts_as_searchable/init.rb index 661b0203d..54f8616a5 100644 --- a/lib/plugins/acts_as_searchable/init.rb +++ b/lib/plugins/acts_as_searchable/init.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true -require File.dirname(__FILE__) + '/lib/acts_as_searchable' +require_relative 'lib/acts_as_searchable' ActiveRecord::Base.send(:include, Redmine::Acts::Searchable) diff --git a/lib/plugins/acts_as_tree/init.rb b/lib/plugins/acts_as_tree/init.rb index cb8394e97..36d1193d0 100644 --- a/lib/plugins/acts_as_tree/init.rb +++ b/lib/plugins/acts_as_tree/init.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true -require File.dirname(__FILE__) + '/lib/active_record/acts/tree' +require_relative 'lib/active_record/acts/tree' ActiveRecord::Base.send :include, ActiveRecord::Acts::Tree diff --git a/lib/plugins/acts_as_watchable/init.rb b/lib/plugins/acts_as_watchable/init.rb index d91feec41..49f50a022 100644 --- a/lib/plugins/acts_as_watchable/init.rb +++ b/lib/plugins/acts_as_watchable/init.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true # Include hook code here -require File.dirname(__FILE__) + '/lib/acts_as_watchable' +require_relative 'lib/acts_as_watchable' ActiveRecord::Base.send(:include, Redmine::Acts::Watchable) diff --git a/lib/plugins/gravatar/init.rb b/lib/plugins/gravatar/init.rb index aafad7613..a312000f5 100644 --- a/lib/plugins/gravatar/init.rb +++ b/lib/plugins/gravatar/init.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true -require File.dirname(__FILE__) + '/lib/gravatar' +require_relative 'lib/gravatar' ActionView::Base.send :include, GravatarHelper::PublicMethods diff --git a/lib/redmine/core_ext/string.rb b/lib/redmine/core_ext/string.rb index 443b8fc39..61a1b702d 100644 --- a/lib/redmine/core_ext/string.rb +++ b/lib/redmine/core_ext/string.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true -require File.dirname(__FILE__) + '/string/conversions' -require File.dirname(__FILE__) + '/string/inflections' +require_relative 'string/conversions' +require_relative 'string/inflections' # @private class String diff --git a/lib/redmine/utils.rb b/lib/redmine/utils.rb index 976a96937..a42cee94d 100644 --- a/lib/redmine/utils.rb +++ b/lib/redmine/utils.rb @@ -17,8 +17,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -require File.dirname(__FILE__) + '/utils/date_calculation' -require File.dirname(__FILE__) + '/utils/shell' +require_relative 'utils/date_calculation' +require_relative 'utils/shell' require 'fileutils' module Redmine -- 2.39.5