From c7c24cb6e2a722e20a6cd1044d2b23beb336904f Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Sun, 28 Aug 2022 07:32:24 +0000 Subject: [PATCH] Typo in method names: s/trailling/trailing/ (#37586). git-svn-id: https://svn.redmine.org/redmine/trunk@21785 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/scm/adapters/abstract_adapter.rb | 14 ++++++++++++-- lib/redmine/scm/adapters/filesystem_adapter.rb | 6 +++--- lib/redmine/scm/adapters/mercurial_adapter.rb | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/lib/redmine/scm/adapters/abstract_adapter.rb b/lib/redmine/scm/adapters/abstract_adapter.rb index 0ad3d7f45..6edc9c9de 100644 --- a/lib/redmine/scm/adapters/abstract_adapter.rb +++ b/lib/redmine/scm/adapters/abstract_adapter.rb @@ -161,21 +161,31 @@ module Redmine path.start_with?('/') ? path : "/#{path}" end - def with_trailling_slash(path) + def with_trailing_slash(path) path ||= '' path.end_with?('/') ? path : "#{path}/" end + def with_trailling_slash(path) + ActiveSupport::Deprecation.warn 'Redmine::Scm::Adapters::AbstractAdapter#with_trailling_slash is deprecated and will be removed in Redmine 6.0. Please use #with_trailing_slash instead.' + with_trailing_slash(path) + end + def without_leading_slash(path) path ||= '' path.gsub(%r{^/+}, '') end - def without_trailling_slash(path) + def without_trailing_slash(path) path ||= '' path.end_with?('/') ? path[0..-2] : path end + def without_trailling_slash(path) + ActiveSupport::Deprecation.warn 'Redmine::Scm::Adapters::AbstractAdapter#without_trailling_slash is deprecated and will be removed in Redmine 6.0. Please use #without_trailing_slash instead.' + without_trailing_slash(path) + end + def valid_name?(name) return true if name.nil? return true if name.is_a?(Integer) && name > 0 diff --git a/lib/redmine/scm/adapters/filesystem_adapter.rb b/lib/redmine/scm/adapters/filesystem_adapter.rb index f03a713ef..964dc17e6 100644 --- a/lib/redmine/scm/adapters/filesystem_adapter.rb +++ b/lib/redmine/scm/adapters/filesystem_adapter.rb @@ -35,7 +35,7 @@ module Redmine def initialize(url, root_url=nil, login=nil, password=nil, path_encoding=nil) - @url = with_trailling_slash(url) + @url = with_trailing_slash(url) @path_encoding = path_encoding.blank? ? 'UTF-8' : path_encoding end @@ -46,8 +46,8 @@ module Redmine def format_path_ends(path, leading=true, trailling=true) path = leading ? with_leading_slash(path) : without_leading_slash(path) - trailling ? with_trailling_slash(path) : - without_trailling_slash(path) + trailling ? with_trailing_slash(path) : + without_trailing_slash(path) end def info diff --git a/lib/redmine/scm/adapters/mercurial_adapter.rb b/lib/redmine/scm/adapters/mercurial_adapter.rb index da831323f..ad8a435dd 100644 --- a/lib/redmine/scm/adapters/mercurial_adapter.rb +++ b/lib/redmine/scm/adapters/mercurial_adapter.rb @@ -154,7 +154,7 @@ module Redmine # do nothing end end - path_prefix = path.blank? ? '' : with_trailling_slash(path) + path_prefix = path.blank? ? '' : with_trailing_slash(path) entries = Entries.new as_ary(manifest['dir']).each do |e| -- 2.39.5