Skip to content

Commit 772a2db

Browse files
authored
Drop Redmine 4 support (#148)
Since the next release will drop support for Redmine 4.
1 parent 43f368b commit 772a2db

File tree

4 files changed

+65
-105
lines changed

4 files changed

+65
-105
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
include:
17-
- redmine-version: "4.2"
18-
ruby-version: "2.7"
19-
rdbms: "MySQL"
20-
- redmine-version: "4.2"
21-
ruby-version: "2.7"
22-
rdbms: "PostgreSQL"
2317
- redmine-version: "5.0"
2418
ruby-version: "2.7"
2519
rdbms: "MySQL"

init.rb

Lines changed: 46 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -40,78 +40,60 @@
4040
html: {class: "icon icon-magnifier"}
4141
end
4242

43-
if Rails.version < "6"
44-
autoload_paths = [
45-
File.join(__dir__, "app", "jobs"),
46-
File.join(__dir__, "app", "types"),
47-
]
48-
Rails.application.config.autoload_paths += autoload_paths
49-
if Rails.application.config.eager_load
50-
Rails.application.config.eager_load_paths += autoload_paths
51-
end
52-
end
53-
5443
require_relative "config/initializers/chupa_text"
5544

56-
prepare = lambda do
57-
FullTextSearch::Settings
58-
FullTextSearch::Tracer
59-
FullTextSearch::Resolver
60-
FullTextSearch::TextExtractor
61-
FullTextSearch::MarkupParser
62-
FullTextSearch::BatchRunner
63-
FullTextSearch::RepositoryEntry
64-
65-
FullTextSearch::ScmAdapterCatIo
66-
FullTextSearch::ScmAdapterAllFileEntries
45+
FullTextSearch::Settings
46+
FullTextSearch::Tracer
47+
FullTextSearch::Resolver
48+
FullTextSearch::TextExtractor
49+
FullTextSearch::MarkupParser
50+
FullTextSearch::BatchRunner
51+
FullTextSearch::RepositoryEntry
6752

68-
# Order by priority on synchronize
69-
FullTextSearch::JournalMapper
70-
FullTextSearch::IssueMapper
71-
FullTextSearch::WikiPageMapper
72-
FullTextSearch::CustomValueMapper
73-
FullTextSearch::ProjectMapper
74-
FullTextSearch::NewsMapper
75-
FullTextSearch::DocumentMapper
76-
FullTextSearch::MessageMapper
77-
FullTextSearch::AttachmentMapper
78-
FullTextSearch::ChangesetMapper
79-
FullTextSearch::ChangeMapper
53+
FullTextSearch::ScmAdapterCatIo
54+
FullTextSearch::ScmAdapterAllFileEntries
8055

81-
FullTextSearch::Hooks::SearchIndexOptionsContentBottomHook
82-
FullTextSearch::Hooks::IssuesShowDescriptionBottomHook
83-
FullTextSearch::Hooks::SimilarIssuesHelper
56+
# Order by priority on synchronize
57+
FullTextSearch::JournalMapper
58+
FullTextSearch::IssueMapper
59+
FullTextSearch::WikiPageMapper
60+
FullTextSearch::CustomValueMapper
61+
FullTextSearch::ProjectMapper
62+
FullTextSearch::NewsMapper
63+
FullTextSearch::DocumentMapper
64+
FullTextSearch::MessageMapper
65+
FullTextSearch::AttachmentMapper
66+
FullTextSearch::ChangesetMapper
67+
FullTextSearch::ChangeMapper
8468

85-
FullTextSearch::Searcher
86-
FullTextSearch::SimilarSearcher
69+
FullTextSearch::Hooks::SearchIndexOptionsContentBottomHook
70+
FullTextSearch::Hooks::IssuesShowDescriptionBottomHook
71+
FullTextSearch::Hooks::SimilarIssuesHelper
8772

88-
class << Setting
89-
prepend FullTextSearch::SettingsObjectize
90-
end
73+
FullTextSearch::Searcher
74+
FullTextSearch::SimilarSearcher
9175

92-
FullTextSearch.resolver.each do |redmine_class, mapper_class|
93-
mapper_class.attach(redmine_class)
94-
end
95-
FullTextSearch::CustomFieldCallbacks.attach
96-
Issue.include(FullTextSearch::SimilarSearcher::Model)
97-
Journal.include(FullTextSearch::SimilarSearcher::Model)
98-
SearchController.helper(FullTextSearch::Hooks::SearchHelper)
99-
SearchController.prepend(FullTextSearch::Hooks::ControllerSearchIndex)
100-
IssuesController.helper(FullTextSearch::Hooks::SimilarIssuesHelper)
101-
102-
FullTextSearch::Tag
103-
FullTextSearch::TagType
104-
FullTextSearch::Type
76+
class << Setting
77+
prepend FullTextSearch::SettingsObjectize
78+
end
10579

106-
# Support plugins
107-
if defined?(WikiExtensionsTagRelation)
108-
# Wiki Extensions tags
109-
# https://github.com/haru/redmine_wiki_extensions
110-
WikiExtensionsTagRelation.include(FullTextSearch::PluginWikiExtensionsTagSearchable)
111-
end
80+
FullTextSearch.resolver.each do |redmine_class, mapper_class|
81+
mapper_class.attach(redmine_class)
11282
end
83+
FullTextSearch::CustomFieldCallbacks.attach
84+
Issue.include(FullTextSearch::SimilarSearcher::Model)
85+
Journal.include(FullTextSearch::SimilarSearcher::Model)
86+
SearchController.helper(FullTextSearch::Hooks::SearchHelper)
87+
SearchController.prepend(FullTextSearch::Hooks::ControllerSearchIndex)
88+
IssuesController.helper(FullTextSearch::Hooks::SimilarIssuesHelper)
11389

114-
# We need to initialize explicitly with Redmine 5.0 or later.
115-
prepare.call if Redmine.const_defined?(:PluginLoader)
90+
FullTextSearch::Tag
91+
FullTextSearch::TagType
92+
FullTextSearch::Type
11693

117-
Rails.application.config.to_prepare(&prepare)
94+
# Support plugins
95+
if defined?(WikiExtensionsTagRelation)
96+
# Wiki Extensions tags
97+
# https://github.com/haru/redmine_wiki_extensions
98+
WikiExtensionsTagRelation.include(FullTextSearch::PluginWikiExtensionsTagSearchable)
99+
end

lib/full_text_search/migration.rb

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,30 @@ module Migration
33
if Redmine::Database.postgresql?
44
# TODO: Send a patch for WITH support to Active Record.
55

6-
# For Redmine 4.2 or earlier
7-
if ::ActiveRecord::VERSION::MAJOR <= 5
8-
module PostgreSQLAdapterWithSupport
9-
def add_index_options(table_name, column_name, with: nil, **options)
10-
result = super(table_name, column_name, **options)
11-
result[3] += " WITH (#{with})" if with
12-
result
13-
end
14-
end
15-
::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend(PostgreSQLAdapterWithSupport)
16-
else
17-
module IndexDefinitionWithSupport
18-
attr_accessor :with
19-
end
20-
::ActiveRecord::ConnectionAdapters::IndexDefinition.prepend(IndexDefinitionWithSupport)
6+
module IndexDefinitionWithSupport
7+
attr_accessor :with
8+
end
9+
::ActiveRecord::ConnectionAdapters::IndexDefinition.prepend(IndexDefinitionWithSupport)
2110

22-
module SchemaCreationWithSupport
23-
private
24-
def visit_CreateIndexDefinition(o)
25-
sql = super
26-
with = o.index.with
27-
sql << " WITH (#{with})" if with
28-
sql
29-
end
11+
module SchemaCreationWithSupport
12+
private
13+
def visit_CreateIndexDefinition(o)
14+
sql = super
15+
with = o.index.with
16+
sql << " WITH (#{with})" if with
17+
sql
3018
end
31-
::ActiveRecord::ConnectionAdapters::SchemaCreation.prepend(SchemaCreationWithSupport)
19+
end
20+
::ActiveRecord::ConnectionAdapters::SchemaCreation.prepend(SchemaCreationWithSupport)
3221

33-
module PostgreSQLAdapterWithSupport
34-
def add_index_options(table_name, column_name, with: nil, **options)
35-
result = super(table_name, column_name, **options)
36-
result[0].with = with
37-
result
38-
end
22+
module PostgreSQLAdapterWithSupport
23+
def add_index_options(table_name, column_name, with: nil, **options)
24+
result = super(table_name, column_name, **options)
25+
result[0].with = with
26+
result
3927
end
40-
::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend(PostgreSQLAdapterWithSupport)
4128
end
29+
::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend(PostgreSQLAdapterWithSupport)
4230
end
4331
end
4432
end

test/system/full_text_search/search_test.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ class SearchTest < ApplicationSystemTestCase
4242
fixtures :wikis
4343

4444
setup do
45-
if ([Redmine::VERSION::MAJOR, Redmine::VERSION::MINOR] <=> [4, 1]) <= 0
46-
skip("Redmine 4.1 or earlier can't work with recent Selenium")
47-
end
48-
4945
if Object.const_defined?(:Webdrivers)
5046
if Gem::Version.new(Webdrivers::VERSION) < Gem::Version.new("5.3.0")
5147
skip("Webdrivers < 5.3.0 doesn't work. " +

0 commit comments

Comments
 (0)