diff options
author | Rémy Coutable <remy@rymai.me> | 2017-03-13 16:07:38 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-03-13 16:29:55 +0300 |
commit | c5e34da01d6ef4717f934754c9c2d1beadd8c55e (patch) | |
tree | 0a2aabf7b1156c8f36fe273f795ea3bf2d16a38e | |
parent | 32da7602686f2b8161175d82b121deb9e01b2db5 (diff) |
Remove explicit `require` calls, and use `require_dependency` when needed
See
http://guides.rubyonrails.org/autoloading_and_reloading_constants.html
for more info.
Signed-off-by: Rémy Coutable <remy@rymai.me>
-rw-r--r-- | app/controllers/projects/wikis_controller.rb | 2 | ||||
-rw-r--r-- | config/initializers/8_metrics.rb | 6 | ||||
-rw-r--r-- | config/initializers/omniauth.rb | 9 | ||||
-rw-r--r-- | lib/gitlab/ldap/user.rb | 2 | ||||
-rw-r--r-- | lib/omni_auth/strategies/bitbucket.rb (renamed from lib/omniauth/strategies/bitbucket.rb) | 0 |
5 files changed, 6 insertions, 13 deletions
diff --git a/app/controllers/projects/wikis_controller.rb b/app/controllers/projects/wikis_controller.rb index 2d8064c9878..8b6c83d4fed 100644 --- a/app/controllers/projects/wikis_controller.rb +++ b/app/controllers/projects/wikis_controller.rb @@ -1,5 +1,3 @@ -require 'project_wiki' - class Projects::WikisController < Projects::ApplicationController before_action :authorize_read_wiki! before_action :authorize_create_wiki!, only: [:edit, :create, :history] diff --git a/config/initializers/8_metrics.rb b/config/initializers/8_metrics.rb index a1517e6afc8..b05e17a7f5c 100644 --- a/config/initializers/8_metrics.rb +++ b/config/initializers/8_metrics.rb @@ -120,9 +120,9 @@ if Gitlab::Metrics.enabled? # These are manually require'd so the classes are registered properly with # ActiveSupport. - require 'gitlab/metrics/subscribers/action_view' - require 'gitlab/metrics/subscribers/active_record' - require 'gitlab/metrics/subscribers/rails_cache' + require_dependency 'gitlab/metrics/subscribers/action_view' + require_dependency 'gitlab/metrics/subscribers/active_record' + require_dependency 'gitlab/metrics/subscribers/rails_cache' Gitlab::Application.configure do |config| config.middleware.use(Gitlab::Metrics::RackMiddleware) diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index ab5a0561b8c..f7fa6d1c2de 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -20,15 +20,12 @@ OmniAuth.config.before_request_phase do |env| end if Gitlab.config.omniauth.enabled - Gitlab.config.omniauth.providers.each do |provider| - if provider['name'] == 'kerberos' - require 'omniauth-kerberos' - end - end + provider_names = Gitlab.config.omniauth.providers.map(&:name) + require 'omniauth-kerberos' if provider_names.include?('kerberos') end module OmniAuth module Strategies - autoload :Bitbucket, Rails.root.join('lib', 'omniauth', 'strategies', 'bitbucket') + autoload :Bitbucket, Rails.root.join('lib', 'omni_auth', 'strategies', 'bitbucket') end end diff --git a/lib/gitlab/ldap/user.rb b/lib/gitlab/ldap/user.rb index b84c81f1a6c..2d5e47a6f3b 100644 --- a/lib/gitlab/ldap/user.rb +++ b/lib/gitlab/ldap/user.rb @@ -1,5 +1,3 @@ -require 'gitlab/o_auth/user' - # LDAP extension for User model # # * Find or create user from omniauth.auth data diff --git a/lib/omniauth/strategies/bitbucket.rb b/lib/omni_auth/strategies/bitbucket.rb index 5a7d67c2390..5a7d67c2390 100644 --- a/lib/omniauth/strategies/bitbucket.rb +++ b/lib/omni_auth/strategies/bitbucket.rb |