summaryrefslogtreecommitdiff
path: root/scripts/setup-test-env
blob: ebd3a48ae15f689fb73dbdb1531c23919a20ceba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env ruby

# frozen_string_literal: true

require 'bundler/setup'

require 'request_store'
require 'rake'
require 'active_support/dependencies'
require 'active_support/dependencies/autoload'
require 'active_support/core_ext/numeric'
require 'active_support/string_inquirer'

ENV['SKIP_RAILS_ENV_IN_RAKE'] = 'true'

module Rails
  extend self

  def root
    Pathname.new(File.expand_path('..', __dir__))
  end

  def env
    @_env ||= ActiveSupport::StringInquirer.new(ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "test")
  end
end

ActiveSupport::Dependencies.autoload_paths << 'lib'

load File.expand_path('../lib/tasks/gitlab/helpers.rake', __dir__)
load File.expand_path('../lib/tasks/gitlab/gitaly.rake', __dir__)

# Required for config/0_inject_enterprise_edition_module.rb, lib/gitlab/access.rb
require_dependency File.expand_path('../lib/gitlab', __dir__)

require_dependency File.expand_path('../config/initializers/0_inject_enterprise_edition_module', __dir__)

# Require for lib/gitlab/gitaly_client/storage_settings.rb and config/initializers/1_settings.rb
require 'active_support/hash_with_indifferent_access'

# Required for lib/gitlab/visibility_level.rb and lib/gitlab/safe_request_store.rb
require 'active_support/concern'
require 'active_support/core_ext/module/delegation'

# Required for lib/system_check/helpers.rb
require_dependency File.expand_path('../lib/gitlab/task_helpers', __dir__)

# Required for lib/tasks/gitlab/helpers.rake
require_dependency File.expand_path('../lib/system_check/helpers', __dir__)

# Required for config/initializers/1_settings.rb
require 'omniauth'
require 'omniauth-github'
require 'etc'
require_dependency File.expand_path('../lib/gitlab/access', __dir__)

require_dependency File.expand_path('../config/initializers/1_settings', __dir__)

Gitlab.ee do
  load File.expand_path('../ee/lib/tasks/gitlab/indexer.rake', __dir__)

  require_dependency File.expand_path('../ee/lib/gitlab/elastic/indexer', __dir__)
  require_dependency File.expand_path('../lib/gitlab/utils/override', __dir__)
end

require_dependency File.expand_path('../spec/support/helpers/test_env', __dir__)

TestEnv.init