Project

General

Profile

Feature #32938 » alt-0004-Load-core-plugins-with-require.patch

Takashi Kato, 2021-10-27 11:57

View differences:

config/initializers/00-core_plugins.rb
1 1
# frozen_string_literal: true
2 2

  
3 3
# Loads the core plugins located in lib/plugins
4
Dir.glob(File.join(Rails.root, "lib/plugins/*")).sort.each do |directory|
5
  if File.directory?(directory)
6
    lib = File.join(directory, "lib")
7
    if File.directory?(lib)
8
      $:.unshift lib
9
      ActiveSupport::Dependencies.autoload_paths += [lib]
10
    end
11
    initializer = File.join(directory, "init.rb")
12
    if File.file?(initializer)
13
      config = RedmineApp::Application.config
14
      eval(File.read(initializer), binding, initializer)
15
    end
4
Dir.glob(Rails.root.join('lib/plugins/*')).sort.each do |directory|
5
  next unless File.directory?(directory)
6

  
7
  initializer = File.join(directory, 'init.rb')
8
  if File.file?(initializer)
9
    config = RedmineApp::Application.config
10
    eval(File.read(initializer), binding, initializer)
16 11
  end
17 12
end
lib/plugins/acts_as_tree/init.rb
1 1
# frozen_string_literal: true
2 2

  
3
require File.dirname(__FILE__) + '/lib/active_record/acts/tree'
3 4
ActiveRecord::Base.send :include, ActiveRecord::Acts::Tree
lib/plugins/gravatar/init.rb
1 1
# frozen_string_literal: true
2 2

  
3
require 'gravatar'
3
require File.dirname(__FILE__) + '/lib/gravatar'
4 4
ActionView::Base.send :include, GravatarHelper::PublicMethods
lib/plugins/open_id_authentication/init.rb
1 1
# frozen_string_literal: false
2 2

  
3
require 'open_id_authentication'
3
require File.dirname(__FILE__) + '/lib/open_id_authentication'
4 4

  
5 5
config.middleware.use OpenIdAuthentication
6 6

  
(15-15/16)