diff options
| author | Achilleas Pipinellis <axilleas@axilleas.me> | 2016-01-19 11:18:57 +0100 |
|---|---|---|
| committer | Achilleas Pipinellis <axilleas@axilleas.me> | 2016-01-19 11:18:57 +0100 |
| commit | b4d61ac46babc04f67bb191c477dddc88e10ad45 (patch) | |
| tree | 5c956996de67438678ba59d5e02e3627713b2e2f /config | |
| parent | 1ede975cde6d32a74b2d4d523e5c0e242c89d50d (diff) | |
| parent | 2becc6fae9b82479b644c0ca10b758cf8447bc19 (diff) | |
| download | gitlab-ce-doc_refactor_commits_api.tar.gz | |
Merge branch 'master' into doc_refactor_commits_apidoc_refactor_commits_api
Diffstat (limited to 'config')
| -rw-r--r-- | config/environments/development.rb | 3 | ||||
| -rw-r--r-- | config/initializers/1_settings.rb | 22 | ||||
| -rw-r--r-- | config/initializers/metrics.rb | 6 |
3 files changed, 23 insertions, 8 deletions
diff --git a/config/environments/development.rb b/config/environments/development.rb index 257c163720a..689694a3480 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -16,6 +16,9 @@ Rails.application.configure do # Print deprecation notices to the Rails logger config.active_support.deprecation = :log + # Raise an error on page load if there are pending migrations + config.active_record.migration_error = :page_load + # Only use best-standards-support built into browsers config.action_dispatch.best_standards_support = :builtin diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index d625a909bf1..04a7c16ebde 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -9,13 +9,8 @@ class Settings < Settingslogic gitlab.port.to_i == (gitlab.https ? 443 : 80) end - # get host without www, thanks to http://stackoverflow.com/a/6674363/1233435 - def get_host_without_www(url) - url = CGI.escape(url) - uri = URI.parse(url) - uri = URI.parse("http://#{url}") if uri.scheme.nil? - host = uri.host.downcase - host.start_with?('www.') ? host[4..-1] : host + def host_without_www(url) + host(url).sub('www.', '') end def build_gitlab_ci_url @@ -87,6 +82,17 @@ class Settings < Settingslogic custom_port ] end + + # Extract the host part of the given +url+. + def host(url) + url = url.downcase + url = "http://#{url}" unless url.start_with?('http') + + # Get rid of the path so that we don't even have to encode it + url_without_path = url.sub(%r{(https?://[^\/]+)/?.*}, '\1') + + URI.parse(url_without_path).host + end end end @@ -228,7 +234,7 @@ Settings['gravatar'] ||= Settingslogic.new({}) Settings.gravatar['enabled'] = true if Settings.gravatar['enabled'].nil? Settings.gravatar['plain_url'] ||= 'http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon' Settings.gravatar['ssl_url'] ||= 'https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon' -Settings.gravatar['host'] = Settings.get_host_without_www(Settings.gravatar['plain_url']) +Settings.gravatar['host'] = Settings.host_without_www(Settings.gravatar['plain_url']) # # Cron Jobs diff --git a/config/initializers/metrics.rb b/config/initializers/metrics.rb index 52ace27b7ae..b1fe36dc21c 100644 --- a/config/initializers/metrics.rb +++ b/config/initializers/metrics.rb @@ -55,6 +55,12 @@ if Gitlab::Metrics.enabled? config.instrument_methods(const) if const.is_a?(Module) end + + Dir[Rails.root.join('app', 'finders', '*.rb')].each do |path| + const = File.basename(path, '.rb').camelize.constantize + + config.instrument_instance_methods(const) + end end GC::Profiler.enable |
