File tree 5 files changed +32
-18
lines changed
5 files changed +32
-18
lines changed Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ gem 'redmine_plugin_kit'
Original file line number Diff line number Diff line change @@ -20,8 +20,9 @@ This is a fork of [redmine_wiki_lists](https://github.com/tkusukawa/redmine_wiki
20
20
1 . Clone this repository into ` redmine/plugins/redmine_ref_issues ` .
21
21
22
22
``` shell
23
- cd redmine/plugins
24
- git clone https://github.com/alphanodes/redmine_ref_issues.git
23
+ cd redmine
24
+ git clone https://github.com/alphanodes/redmine_ref_issues.git plugins/redmine_ref_issues
25
+ bundle install
25
26
```
26
27
27
28
2 . Restart your Redmine application server.
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
- raise " \n \033 [31maredmine_ref_issues requires ruby 2.6 or newer. Please update your ruby version. \033 [0m" if RUBY_VERSION < '2.6 '
3
+ loader = RedminePluginKit :: Loader . new plugin_id : 'redmine_ref_issues '
4
4
5
5
Redmine ::Plugin . register :redmine_ref_issues do
6
6
name 'Redmine ref_issues macro'
9
9
version RedmineRefIssues ::VERSION
10
10
url 'https://github.com/alphanodes/redmine_ref_issues'
11
11
author_url 'https://alphanodes.com/'
12
- directory __dir__
13
12
14
13
requires_redmine version_or_higher : '4.1'
15
14
end
16
15
17
- if Rails . version > '6.0'
18
- ActiveSupport . on_load ( :active_record ) { RedmineRefIssues . setup }
19
- else
20
- Rails . configuration . to_prepare { RedmineRefIssues . setup }
21
- end
16
+ RedminePluginKit ::Loader . persisting { loader . load_model_hooks! }
17
+ RedminePluginKit ::Loader . to_prepare { RedmineRefIssues . setup! } if Rails . version < '6.0'
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
3
module RedmineRefIssues
4
- VERSION = '1.0.1 '
4
+ VERSION = '1.0.2 '
5
5
6
- class << self
7
- def setup
8
- Dir [ File . join ( Redmine ::Plugin . find ( :redmine_ref_issues ) . directory ,
9
- 'lib' ,
10
- 'redmine_ref_issues' ,
11
- 'wiki_macros' ,
12
- '**/*_macro.rb' ) ] . sort . each { |f | require f }
13
- end
6
+ include RedminePluginKit ::PluginBase
14
7
8
+ class << self
15
9
def cast_table_field ( db_table , db_field )
16
10
if Redmine ::Database . postgresql?
17
11
"CAST(#{ db_table } .#{ db_field } AS TEXT)"
@@ -24,5 +18,12 @@ def additionals_help_items
24
18
[ { title : 'Redmine ref_issues macro' ,
25
19
url : 'https://github.com/AlphaNodes/redmine_ref_issues#usage' } ]
26
20
end
21
+
22
+ private
23
+
24
+ def setup
25
+ # Macros
26
+ loader . load_macros!
27
+ end
27
28
end
28
29
end
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ module RedmineRefIssues
4
+ module Hooks
5
+ class ModelHook < Redmine ::Hook ::Listener
6
+ def after_plugins_loaded ( _context = { } )
7
+ return if Rails . version < '6.0'
8
+
9
+ RedmineRefIssues . setup!
10
+ end
11
+ end
12
+ end
13
+ end
You can’t perform that action at this time.
0 commit comments