Commit 0a280158 authored by Timothy Andrew's avatar Timothy Andrew Committed by Kamil Trzcinski

Eager load `lib/api`

- So that the server doesn't have to be restarted for every change in dev.
parent 5fc310b4
...@@ -79,6 +79,8 @@ module Gitlab ...@@ -79,6 +79,8 @@ module Gitlab
# This is needed for gitlab-shell # This is needed for gitlab-shell
ENV['GITLAB_PATH_OUTSIDE_HOOK'] = ENV['PATH'] ENV['GITLAB_PATH_OUTSIDE_HOOK'] = ENV['PATH']
config.eager_load_paths += ["#{Rails.root}/lib"]
config.generators do |g| config.generators do |g|
g.factory_girl false g.factory_girl false
end end
......
require 'sidekiq/web' require 'sidekiq/web'
require 'sidekiq/cron/web' require 'sidekiq/cron/web'
require 'api/api'
Rails.application.routes.draw do Rails.application.routes.draw do
if Gitlab::Sherlock.enabled? if Gitlab::Sherlock.enabled?
......
Dir["#{Rails.root}/lib/api/*.rb"].each {|file| require file}
module API module API
class API < Grape::API class API < Grape::API
include APIGuard include ::API::APIGuard
version 'v3', using: :path version 'v3', using: :path
rescue_from ActiveRecord::RecordNotFound do rescue_from ActiveRecord::RecordNotFound do
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
require 'rack/oauth2' require 'rack/oauth2'
module APIGuard module API
module APIGuard
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do |base| included do |base|
...@@ -169,4 +170,5 @@ module APIGuard ...@@ -169,4 +170,5 @@ module APIGuard
@scopes = scopes @scopes = scopes
end end
end end
end
end end
\ No newline at end of file
...@@ -3,7 +3,7 @@ Dir["#{Rails.root}/lib/ci/api/*.rb"].each {|file| require file} ...@@ -3,7 +3,7 @@ Dir["#{Rails.root}/lib/ci/api/*.rb"].each {|file| require file}
module Ci module Ci
module API module API
class API < Grape::API class API < Grape::API
include APIGuard include ::API::APIGuard
version 'v1', using: :path version 'v1', using: :path
rescue_from ActiveRecord::RecordNotFound do rescue_from ActiveRecord::RecordNotFound do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment