diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-02-28 21:14:25 +0100 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-02-28 21:14:25 +0100 |
commit | 79a5e7fb539dc6df7de590efb69fb9ab9d4614eb (patch) | |
tree | 951e2f3194c4b4d5488864791a9a94afe7122280 /config | |
parent | 729391fbfce4dea58478b65c684a24a1bfd125a2 (diff) | |
parent | 7e424eb852716495073881710e8a8851b4a4cd5a (diff) | |
download | gitlab-ce-79a5e7fb539dc6df7de590efb69fb9ab9d4614eb.tar.gz |
Merge commit '7e424eb852716495073881710e8a8851b4a4cd5a' into object-storage-ee-to-ce-backport
Diffstat (limited to 'config')
-rw-r--r-- | config/gitlab.yml.example | 3 | ||||
-rw-r--r-- | config/initializers/1_settings.rb | 1 | ||||
-rw-r--r-- | config/initializers/gollum.rb | 82 | ||||
-rw-r--r-- | config/initializers/mime_types.rb | 2 | ||||
-rw-r--r-- | config/initializers/query_limiting.rb | 9 | ||||
-rw-r--r-- | config/routes.rb | 3 | ||||
-rw-r--r-- | config/routes/git_http.rb | 7 | ||||
-rw-r--r-- | config/routes/group.rb | 3 | ||||
-rw-r--r-- | config/routes/project.rb | 3 | ||||
-rw-r--r-- | config/webpack.config.js | 23 |
10 files changed, 133 insertions, 3 deletions
diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index 65b4d63df2f..744804d982b 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -405,6 +405,9 @@ production: &base first_name: 'givenName' last_name: 'sn' + # If lowercase_usernames is enabled, GitLab will lower case the username. + lowercase_usernames: false + # GitLab EE only: add more LDAP servers # Choose an ID made of a-z and 0-9 . This ID will be stored in the database # so that GitLab can remember which LDAP server a user belongs to. diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index c1d4669b3c5..acfa300882c 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -151,6 +151,7 @@ if Settings.ldap['enabled'] || Rails.env.test? server['allow_username_or_email_login'] = false if server['allow_username_or_email_login'].nil? server['active_directory'] = true if server['active_directory'].nil? server['attributes'] = {} if server['attributes'].nil? + server['lowercase_usernames'] = false if server['lowercase_usernames'].nil? server['provider_name'] ||= "ldap#{key}".downcase server['provider_class'] = OmniAuth::Utils.camelize(server['provider_name']) diff --git a/config/initializers/gollum.rb b/config/initializers/gollum.rb index 0b86cac51a7..6dfaceb8427 100644 --- a/config/initializers/gollum.rb +++ b/config/initializers/gollum.rb @@ -35,6 +35,88 @@ module Gollum [] end end + + # Remove if https://github.com/gollum/gollum-lib/pull/292 has been merged + def update_page(page, name, format, data, commit = {}) + name = name ? ::File.basename(name) : page.name + format ||= page.format + dir = ::File.dirname(page.path) + dir = '' if dir == '.' + filename = (rename = page.name != name) ? Gollum::Page.cname(name) : page.filename_stripped + + multi_commit = !!commit[:committer] + committer = multi_commit ? commit[:committer] : Committer.new(self, commit) + + if !rename && page.format == format + committer.add(page.path, normalize(data)) + else + committer.delete(page.path) + committer.add_to_index(dir, filename, format, data) + end + + committer.after_commit do |index, _sha| + @access.refresh + index.update_working_dir(dir, page.filename_stripped, page.format) + index.update_working_dir(dir, filename, format) + end + + multi_commit ? committer : committer.commit + end + + # Remove if https://github.com/gollum/gollum-lib/pull/292 has been merged + def rename_page(page, rename, commit = {}) + return false if page.nil? + return false if rename.nil? || rename.empty? + + (target_dir, target_name) = ::File.split(rename) + (source_dir, source_name) = ::File.split(page.path) + source_name = page.filename_stripped + + # File.split gives us relative paths with ".", commiter.add_to_index doesn't like that. + target_dir = '' if target_dir == '.' + source_dir = '' if source_dir == '.' + target_dir = target_dir.gsub(/^\//, '') # rubocop:disable Style/RegexpLiteral + + # if the rename is a NOOP, abort + if source_dir == target_dir && source_name == target_name + return false + end + + multi_commit = !!commit[:committer] + committer = multi_commit ? commit[:committer] : Committer.new(self, commit) + + # This piece only works for multi_commit + # If we are in a commit batch and one of the previous operations + # has updated the page, any information we ask to the page can be outdated. + # Therefore, we should ask first to the current committer tree to see if + # there is any updated change. + raw_data = raw_data_in_committer(committer, source_dir, page.filename) || + raw_data_in_committer(committer, source_dir, "#{target_name}.#{Page.format_to_ext(page.format)}") || + page.raw_data + + committer.delete(page.path) + committer.add_to_index(target_dir, target_name, page.format, raw_data) + + committer.after_commit do |index, _sha| + @access.refresh + index.update_working_dir(source_dir, source_name, page.format) + index.update_working_dir(target_dir, target_name, page.format) + end + + multi_commit ? committer : committer.commit + end + + # Remove if https://github.com/gollum/gollum-lib/pull/292 has been merged + def raw_data_in_committer(committer, dir, filename) + data = nil + + [*dir.split(::File::SEPARATOR), filename].each do |key| + data = data ? data[key] : committer.tree[key] + break unless data + end + + data + end end module Git diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index 5e3e4c966cb..e9326653cbe 100644 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -14,4 +14,4 @@ Mime::Type.register "video/webm", :webm Mime::Type.register "video/ogg", :ogv Mime::Type.unregister :json -Mime::Type.register 'application/json', :json, %w(application/vnd.git-lfs+json application/json) +Mime::Type.register 'application/json', :json, [LfsRequest::CONTENT_TYPE, 'application/json'] diff --git a/config/initializers/query_limiting.rb b/config/initializers/query_limiting.rb new file mode 100644 index 00000000000..66864d1898e --- /dev/null +++ b/config/initializers/query_limiting.rb @@ -0,0 +1,9 @@ +if Gitlab::QueryLimiting.enable? + require_dependency 'gitlab/query_limiting/active_support_subscriber' + require_dependency 'gitlab/query_limiting/transaction' + require_dependency 'gitlab/query_limiting/middleware' + + Gitlab::Application.configure do |config| + config.middleware.use(Gitlab::QueryLimiting::Middleware) + end +end diff --git a/config/routes.rb b/config/routes.rb index f162043dd5e..e72ea1881cd 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -60,6 +60,9 @@ Rails.application.routes.draw do resources :issues, module: :boards, only: [:index, :update] end + + # UserCallouts + resources :user_callouts, only: [:create] end # Koding route diff --git a/config/routes/git_http.rb b/config/routes/git_http.rb index a53c94326d4..ff51823897d 100644 --- a/config/routes/git_http.rb +++ b/config/routes/git_http.rb @@ -16,6 +16,13 @@ scope(path: '*namespace_id/:project_id', get '/*oid', action: :deprecated end + scope(path: 'info/lfs') do + resources :lfs_locks, controller: :lfs_locks_api, path: 'locks' do + post :unlock, on: :member + post :verify, on: :collection + end + end + # GitLab LFS object storage scope(path: 'gitlab-lfs/objects/*oid', controller: :lfs_storage, constraints: { oid: /[a-f0-9]{64}/ }) do get '/', action: :download diff --git a/config/routes/group.rb b/config/routes/group.rb index 24c76bc55ab..7a4740a4df7 100644 --- a/config/routes/group.rb +++ b/config/routes/group.rb @@ -14,6 +14,7 @@ constraints(GroupUrlConstrainer.new) do get :merge_requests, as: :merge_requests_group get :projects, as: :projects_group get :activity, as: :activity_group + put :transfer, as: :transfer_group end get '/', action: :show, as: :group_canonical @@ -27,7 +28,7 @@ constraints(GroupUrlConstrainer.new) do resource :ci_cd, only: [:show], controller: 'ci_cd' end - resources :variables, only: [:index, :show, :update, :create, :destroy] + resource :variables, only: [:show, :update] resources :children, only: [:index] diff --git a/config/routes/project.rb b/config/routes/project.rb index bcaa68c8ce5..1912808f9c0 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -156,7 +156,8 @@ constraints(ProjectUrlConstrainer.new) do end end - resources :variables, only: [:index, :show, :update, :create, :destroy] + resource :variables, only: [:show, :update] + resources :triggers, only: [:index, :create, :edit, :update, :destroy] do member do post :take_ownership diff --git a/config/webpack.config.js b/config/webpack.config.js index 783677b5b8d..7f3fe551a03 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -3,6 +3,7 @@ var crypto = require('crypto'); var fs = require('fs'); var path = require('path'); +var glob = require('glob'); var webpack = require('webpack'); var StatsWriterPlugin = require('webpack-stats-plugin').StatsWriterPlugin; var CopyWebpackPlugin = require('copy-webpack-plugin'); @@ -20,6 +21,26 @@ var DEV_SERVER_LIVERELOAD = process.env.DEV_SERVER_LIVERELOAD !== 'false'; var WEBPACK_REPORT = process.env.WEBPACK_REPORT; var NO_COMPRESSION = process.env.NO_COMPRESSION; +// generate automatic entry points +var autoEntries = {}; +var pageEntries = glob.sync('pages/**/index.js', { cwd: path.join(ROOT_PATH, 'app/assets/javascripts') }); + +// filter out entries currently imported dynamically in dispatcher.js +var dispatcher = fs.readFileSync(path.join(ROOT_PATH, 'app/assets/javascripts/dispatcher.js')).toString(); +var dispatcherChunks = dispatcher.match(/(?!import\('.\/)pages\/[^']+/g); + +pageEntries.forEach(( path ) => { + let chunkPath = path.replace(/\/index\.js$/, ''); + if (!dispatcherChunks.includes(chunkPath)) { + let chunkName = chunkPath.replace(/\//g, '.'); + autoEntries[chunkName] = './' + path; + } +}); + +// report our auto-generated bundle count +var autoEntriesCount = Object.keys(autoEntries).length; +console.log(`${autoEntriesCount} entries from '/pages' automatically added to webpack output.`); + var config = { // because sqljs requires fs. node: { @@ -301,6 +322,8 @@ var config = { } } +config.entry = Object.assign({}, autoEntries, config.entry); + if (IS_PRODUCTION) { config.devtool = 'source-map'; config.plugins.push( |