Merge branch 'rs-revert-preload-lib' into 'master'

Revert "Preload lib/"

This reverts commit 5511a731bc.

The original commit added this because it also enabled threadsafety, a change which was itself later reverted in 66d6c80966, but this got left behind.

I don't fully understand the reasoning behind it so if I'm wrong, please tell me.

My reasoning for reverting it is that it messes with Rails' (and by extension Spring's) class reloading during development. When I was working in `lib/gitlab/markdown` and had to stop and restart the server every time I made a change, I didn't know it at the time, but this was why. That was a huge pain point.

If it's needed for production perhaps we could add a `if Rails.env.production?` clause around it so that it doesn't mess with development.

See merge request !1758
This commit is contained in:
Dmitriy Zaporozhets 2015-04-10 14:34:57 +00:00
commit 24d139ba97
10 changed files with 13 additions and 6 deletions

View File

@ -1,3 +1,5 @@
require 'gitlab' # Load lib/gitlab.rb as soon as possible
class Settings < Settingslogic
source ENV.fetch('GITLAB_CONFIG') { "#{Rails.root}/config/gitlab.yml" }
namespace Rails.env

View File

@ -6,8 +6,3 @@ module Gitlab
Settings
end
end
#
# Load all libs for threadsafety
#
Dir["#{Rails.root}/lib/**/*.rb"].each { |file| require file }

5
lib/gitlab.rb Normal file
View File

@ -0,0 +1,5 @@
require 'gitlab/git'
module Gitlab
autoload :Satellite, 'gitlab/satellite/satellite'
end

View File

@ -1,4 +1,4 @@
require 'gitlab/oauth/user'
require 'gitlab/o_auth/user'
# LDAP extension for User model
#

View File

@ -1,5 +1,10 @@
module Gitlab
module Satellite
autoload :DeleteFileAction, 'gitlab/satellite/files/delete_file_action'
autoload :EditFileAction, 'gitlab/satellite/files/edit_file_action'
autoload :FileAction, 'gitlab/satellite/files/file_action'
autoload :NewFileAction, 'gitlab/satellite/files/new_file_action'
class CheckoutFailed < StandardError; end
class CommitFailed < StandardError; end
class PushFailed < StandardError; end