summaryrefslogtreecommitdiff
path: root/lib/gitlab/patch/draw_route.rb
blob: 4396e811a8cb67736254971883dcab56ab4dfbf7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

# We're patching `ActionDispatch::Routing::Mapper` in
# config/initializers/routing_draw.rb
module Gitlab
  module Patch
    module DrawRoute
      def draw(routes_name)
        instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))

        draw_ee(routes_name)
      end

      def draw_ee(routes_name)
        path = Rails.root.join("ee/config/routes/#{routes_name}.rb")

        instance_eval(File.read(path)) if File.exist?(path)
      end
    end
  end
end