From 93a763e42b3dc2051539f1929b85ae93817f6ba8 Mon Sep 17 00:00:00 2001 From: MAEDA Go Date: Mon, 12 Oct 2026 15:22:44 +0900 Subject: [PATCH] Remove leftover JRuby-specific code and comments --- config/configuration.yml.example | 7 +------ extra/svn/reposman.rb | 2 +- lib/redmine/platform.rb | 3 +-- lib/redmine/scm/adapters/abstract_adapter.rb | 3 --- lib/redmine/utils/shell.rb | 6 +----- lib/tasks/ci.rake | 3 +-- test/test_helper.rb | 4 +--- test/unit/lib/redmine/export/pdf_test.rb | 2 +- .../redmine/scm/adapters/git_adapter_test.rb | 20 ------------------- test/unit/repository_bazaar_test.rb | 3 +-- 10 files changed, 8 insertions(+), 45 deletions(-) diff --git a/config/configuration.yml.example b/config/configuration.yml.example index 2896fd3ec..db415641a 100644 --- a/config/configuration.yml.example +++ b/config/configuration.yml.example @@ -86,12 +86,7 @@ default: # Configuration of SCM executable command. # # Absolute path (e.g. /usr/local/bin/hg) or command name (e.g. hg.exe, bzr.exe) - # On Windows + CRuby, *.cmd, *.bat (e.g. hg.cmd, bzr.bat) does not work. - # - # On Windows + JRuby 1.6.2, path which contains spaces does not work. - # For example, "C:\Program Files\TortoiseHg\hg.exe". - # If you want to this feature, you need to install to the path which does not contains spaces. - # For example, "C:\TortoiseHg\hg.exe". + # On Windows, *.cmd, *.bat (e.g. hg.cmd, bzr.bat) does not work. # # Examples: # scm_subversion_command: svn # (default: svn) diff --git a/extra/svn/reposman.rb b/extra/svn/reposman.rb index 28c7d257a..15d053ba7 100755 --- a/extra/svn/reposman.rb +++ b/extra/svn/reposman.rb @@ -211,7 +211,7 @@ def owner_name(file) end def mswin? - (RUBY_PLATFORM =~ /(:?mswin|mingw)/) || (RUBY_PLATFORM == 'java' && (ENV['OS'] || ENV['os']) =~ /windows/i) + RUBY_PLATFORM =~ /(:?mswin|mingw)/ end projects.each do |project| diff --git a/lib/redmine/platform.rb b/lib/redmine/platform.rb index 82324a539..55317a713 100644 --- a/lib/redmine/platform.rb +++ b/lib/redmine/platform.rb @@ -21,8 +21,7 @@ module Redmine module Platform class << self def mswin? - (/(:?mswin|mingw)/.match?(RUBY_PLATFORM)) || - (RUBY_PLATFORM == 'java' && /windows/i.match?(ENV['OS'] || ENV['os'])) + (/(:?mswin|mingw)/.match?(RUBY_PLATFORM)) end def osx? diff --git a/lib/redmine/scm/adapters/abstract_adapter.rb b/lib/redmine/scm/adapters/abstract_adapter.rb index 15e719414..5850c4800 100644 --- a/lib/redmine/scm/adapters/abstract_adapter.rb +++ b/lib/redmine/scm/adapters/abstract_adapter.rb @@ -299,9 +299,6 @@ module Redmine end def parse_xml(xml) - if RUBY_PLATFORM == 'java' - xml = xml.sub(%r{<\?xml[^>]*\?>}, '') - end ActiveSupport::XmlMini.parse(xml) end end diff --git a/lib/redmine/utils/shell.rb b/lib/redmine/utils/shell.rb index bd6fe5aba..8d9008a70 100644 --- a/lib/redmine/utils/shell.rb +++ b/lib/redmine/utils/shell.rb @@ -31,11 +31,7 @@ module Redmine end def shell_quote_command(command) - if Redmine::Platform.mswin? && RUBY_PLATFORM == 'java' - command - else - shell_quote(command) - end + shell_quote(command) end end end diff --git a/lib/tasks/ci.rake b/lib/tasks/ci.rake index 58bd77ee9..e8fbea662 100644 --- a/lib/tasks/ci.rake +++ b/lib/tasks/ci.rake @@ -96,8 +96,7 @@ file 'config/database.yml' do end test_conf = dev_conf.merge('database' => test_db_name) when /sqlite3/ - dev_conf = {'adapter' => (Object.const_defined?(:JRUBY_VERSION) ? - 'jdbcsqlite3' : 'sqlite3'), + dev_conf = {'adapter' => 'sqlite3', 'database' => "db/#{dev_db_name}.sqlite3"} test_conf = dev_conf.merge('database' => "db/#{test_db_name}.sqlite3") when 'sqlserver' diff --git a/test/test_helper.rb b/test/test_helper.rb index f05fe3c86..e775ce0e2 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -197,9 +197,7 @@ class ActiveSupport::TestCase # Returns the path to the test +vendor+ repository def self.repository_path(vendor) - path = Rails.root.join("tmp/test/#{vendor.downcase}_repository").to_s - # Unlike ruby, JRuby returns Rails.root with backslashes under Windows - path.tr("\\", "/") + Rails.root.join("tmp/test/#{vendor.downcase}_repository").to_s end # Returns the url of the subversion test repository diff --git a/test/unit/lib/redmine/export/pdf_test.rb b/test/unit/lib/redmine/export/pdf_test.rb index 0db3f470c..0a95be4bc 100644 --- a/test/unit/lib/redmine/export/pdf_test.rb +++ b/test/unit/lib/redmine/export/pdf_test.rb @@ -56,7 +56,7 @@ class PdfTest < ActiveSupport::TestCase def test_rdm_pdf_iconv_invalid_utf8_should_be_replaced_ja str1 = "Texte encod\xE9 en ISO-8859-1" str2 = "\xe9a\xe9b\xe9c\xe9d\xe9e test".b - encoding = (RUBY_PLATFORM == 'java' ? "SJIS" : "CP932") + encoding = "CP932" txt_1 = Redmine::Export::PDF::RDMPdfEncoding::rdm_from_utf8(str1, encoding) txt_2 = Redmine::Export::PDF::RDMPdfEncoding::rdm_from_utf8(str2, encoding) assert_equal "ASCII-8BIT", txt_1.encoding.to_s diff --git a/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb index 95ba205c0..43cf90b3f 100644 --- a/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb +++ b/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb @@ -22,14 +22,6 @@ require_relative '../../../../../test_helper' class GitAdapterTest < ActiveSupport::TestCase REPOSITORY_PATH = Rails.root.join('tmp/test/git_repository').to_s - ## Git, Mercurial and CVS path encodings are binary. - ## Subversion supports URL encoding for path. - ## Redmine Mercurial adapter and extension use URL encoding. - ## Git accepts only binary path in command line parameter. - ## So, there is no way to use binary command line parameter in JRuby. - JRUBY_SKIP = (RUBY_PLATFORM == 'java') - JRUBY_SKIP_STR = "TODO: This test fails in JRuby" - if File.directory?(REPOSITORY_PATH) ## Ruby uses ANSI api to fork a process on Windows. ## Japanese Shift_JIS and Traditional Chinese Big5 have 0x5c(backslash) problem @@ -260,8 +252,6 @@ class GitAdapterTest < ActiveSupport::TestCase def test_revisions_latin_1_identifier if WINDOWS_PASS puts WINDOWS_SKIP_STR - elsif JRUBY_SKIP - puts JRUBY_SKIP_STR else revs1 = [] @adapter.revisions( @@ -452,8 +442,6 @@ class GitAdapterTest < ActiveSupport::TestCase def test_annotate_latin_1_identifier if WINDOWS_PASS puts WINDOWS_SKIP_STR - elsif JRUBY_SKIP - puts JRUBY_SKIP_STR else annotate = @adapter.annotate('sources/watchers_controller.rb', "latin-1-branch-#{@char_1}-02") @@ -494,8 +482,6 @@ class GitAdapterTest < ActiveSupport::TestCase def test_latin_1_path if WINDOWS_PASS puts WINDOWS_SKIP_STR - elsif JRUBY_SKIP - puts JRUBY_SKIP_STR else p2 = "latin-1-dir/test-#{@char_1}-2.txt" ['4fc55c43bf3d3dc2efb66145365ddc17639ce81e', '4fc55c43bf3'].each do |r1| @@ -588,8 +574,6 @@ class GitAdapterTest < ActiveSupport::TestCase def test_entries_latin_1_dir if WINDOWS_PASS puts WINDOWS_SKIP_STR - elsif JRUBY_SKIP - puts JRUBY_SKIP_STR else entries1 = @adapter.entries("latin-1-dir/test-#{@char_1}-subdir", '1ca7f5ed') @@ -605,8 +589,6 @@ class GitAdapterTest < ActiveSupport::TestCase def test_entries_latin_1_identifier if WINDOWS_PASS puts WINDOWS_SKIP_STR - elsif JRUBY_SKIP - puts JRUBY_SKIP_STR else entries1 = @adapter.entries(nil, "latin-1-branch-#{@char_1}-02") @@ -670,8 +652,6 @@ class GitAdapterTest < ActiveSupport::TestCase def test_cat_latin_1_identifier if WINDOWS_PASS puts WINDOWS_SKIP_STR - elsif JRUBY_SKIP - puts JRUBY_SKIP_STR else assert @adapter.cat('sources/watchers_controller.rb', "latin-1-branch-#{@char_1}-02") diff --git a/test/unit/repository_bazaar_test.rb b/test/unit/repository_bazaar_test.rb index ac167145f..979af26f7 100644 --- a/test/unit/repository_bazaar_test.rb +++ b/test/unit/repository_bazaar_test.rb @@ -35,8 +35,7 @@ class RepositoryBazaarTest < ActiveSupport::TestCase # On Windows, because it is too hard to change system locale, # you cannot run Bazaar non ASCII path tests. # - RUN_LATIN1_OUTPUT_TEST = (RUBY_PLATFORM != 'java' && - Encoding.locale_charmap == "ISO-8859-1") + RUN_LATIN1_OUTPUT_TEST = (Encoding.locale_charmap == "ISO-8859-1") CHAR_1_UTF8_HEX = 'Ü' CHAR_1_LATIN1_HEX = "\xdc".b -- 2.55.0