From f69ab3c6229632ce2c96d33a51641deaf2a5c61f Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Wed, 12 Jun 2019 17:21:18 +0200 Subject: [PATCH] Backport EE changes to config/application.rb This backports the EE changes made to this config file to CE. EE specific bits do not need an `if Gitlab.ee?`, as everything will work transparently when using CE. --- config/application.rb | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/config/application.rb b/config/application.rb index cddd91f267a..2c4aa7bf758 100644 --- a/config/application.rb +++ b/config/application.rb @@ -47,6 +47,19 @@ module Gitlab config.generators.templates.push("#{config.root}/generator_templates") + ee_paths = config.eager_load_paths.each_with_object([]) do |path, memo| + ee_path = config.root.join('ee', Pathname.new(path).relative_path_from(config.root)) + memo << ee_path.to_s if ee_path.exist? + end + + # Eager load should load CE first + config.eager_load_paths.push(*ee_paths) + config.helpers_paths.push "#{config.root}/ee/app/helpers" + + # Other than Ruby modules we load EE first + config.paths['lib/tasks'].unshift "#{config.root}/ee/lib/tasks" + config.paths['app/views'].unshift "#{config.root}/ee/app/views" + # Rake tasks ignore the eager loading settings, so we need to set the # autoload paths explicitly config.autoload_paths = config.eager_load_paths.dup @@ -161,6 +174,23 @@ module Gitlab config.assets.paths << "#{config.root}/node_modules/xterm/src/" config.assets.precompile << "xterm.css" + %w[images javascripts stylesheets].each do |path| + config.assets.paths << "#{config.root}/ee/app/assets/#{path}" + config.assets.precompile << "jira_connect.js" + config.assets.precompile << "pages/jira_connect.css" + end + + config.assets.paths << "#{config.root}/vendor/assets/javascripts/" + config.assets.precompile << "snowplow/sp.js" + + # Compile non-JS/CSS assets in the ee/app/assets folder by default + # Mimic sprockets-rails default: https://github.com/rails/sprockets-rails/blob/v3.2.1/lib/sprockets/railtie.rb#L84-L87 + LOOSE_EE_APP_ASSETS = lambda do |logical_path, filename| + filename.start_with?(config.root.join("ee/app/assets").to_s) && + !['.js', '.css', ''].include?(File.extname(logical_path)) + end + config.assets.precompile << LOOSE_EE_APP_ASSETS + # Version of your assets, change this if you want to expire all your assets config.assets.version = '1.0'