Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
931099d6
Commit
931099d6
authored
Apr 09, 2021
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generalize some operations and check jh/ directory
parent
7c79dba3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
35 deletions
+25
-35
config/application.rb
config/application.rb
+15
-24
config/initializers/0_license.rb
config/initializers/0_license.rb
+8
-9
lib/gitlab.rb
lib/gitlab.rb
+1
-1
spec/lib/gitlab_spec.rb
spec/lib/gitlab_spec.rb
+1
-1
No files found.
config/application.rb
View file @
931099d6
...
...
@@ -56,38 +56,29 @@ module Gitlab
config
.
generators
.
templates
.
push
(
"
#{
config
.
root
}
/generator_templates"
)
if
Gitlab
.
ee?
e
e
_paths
=
config
.
eager_load_paths
.
each_with_object
([])
do
|
path
,
memo
|
e
e_path
=
config
.
root
.
join
(
'ee'
,
Pathname
.
new
(
path
).
relative_path_from
(
config
.
root
))
memo
<<
e
e
_path
.
to_s
load_paths
=
lambda
do
|
dir
:|
e
xt
_paths
=
config
.
eager_load_paths
.
each_with_object
([])
do
|
path
,
memo
|
e
xt_path
=
config
.
root
.
join
(
dir
,
Pathname
.
new
(
path
).
relative_path_from
(
config
.
root
))
memo
<<
e
xt
_path
.
to_s
end
e
e_paths
<<
"
#{
config
.
root
}
/ee
/app/replicators"
e
xt_paths
<<
"
#{
config
.
root
}
/
#{
dir
}
/app/replicators"
# Eager load should load CE first
config
.
eager_load_paths
.
push
(
*
e
e
_paths
)
config
.
helpers_paths
.
push
"
#{
config
.
root
}
/
ee
/app/helpers"
config
.
eager_load_paths
.
push
(
*
e
xt
_paths
)
config
.
helpers_paths
.
push
"
#{
config
.
root
}
/
#{
dir
}
/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"
# Other than Ruby modules we load
extensions
first
config
.
paths
[
'lib/tasks'
].
unshift
"
#{
config
.
root
}
/
#{
dir
}
/lib/tasks"
config
.
paths
[
'app/views'
].
unshift
"
#{
config
.
root
}
/
#{
dir
}
/app/views"
end
if
Gitlab
.
jh?
jh_paths
=
config
.
eager_load_paths
.
each_with_object
([])
do
|
path
,
memo
|
jh_path
=
config
.
root
.
join
(
'jh'
,
Pathname
.
new
(
path
).
relative_path_from
(
config
.
root
))
memo
<<
jh_path
.
to_s
end
jh_paths
<<
"
#{
config
.
root
}
/jh/app/replicators"
# Eager load should load CE/EE first
config
.
eager_load_paths
.
push
(
*
jh_paths
)
config
.
helpers_paths
.
push
"
#{
config
.
root
}
/jh/app/helpers"
Gitlab
.
ee
do
load_paths
.
call
(
dir:
'ee'
)
end
# Other than Ruby modules we load JH first
config
.
paths
[
'lib/tasks'
].
unshift
"
#{
config
.
root
}
/jh/lib/tasks"
config
.
paths
[
'app/views'
].
unshift
"
#{
config
.
root
}
/jh/app/views"
Gitlab
.
jh
do
load_paths
.
call
(
dir:
'jh'
)
end
# Rake tasks ignore the eager loading settings, so we need to set the
...
...
config/initializers/0_license.rb
View file @
931099d6
# frozen_string_literal: true
Gitlab
.
ee
do
load_license
=
lambda
do
|
dir
:,
license_name
:|
prefix
=
ENV
[
'GITLAB_LICENSE_MODE'
]
==
'test'
?
'test_'
:
''
public_key_file
=
File
.
read
(
Rails
.
root
.
join
(
".
#{
prefix
}
license_encryption_key.pub"
))
public_key_file
=
File
.
read
(
Rails
.
root
.
join
(
dir
,
".
#{
prefix
}
license_encryption_key.pub"
))
public_key
=
OpenSSL
::
PKey
::
RSA
.
new
(
public_key_file
)
Gitlab
::
License
.
encryption_key
=
public_key
rescue
warn
"WARNING: No valid license encryption key provided."
warn
"WARNING: No valid
#{
license_name
}
encryption key provided."
end
Gitlab
.
ee
do
load_license
.
call
(
dir:
'.'
,
license_name:
'license'
)
end
Gitlab
.
jh
do
prefix
=
ENV
[
'GITLAB_LICENSE_MODE'
]
==
'test'
?
'test_'
:
''
public_key_file
=
File
.
read
(
Rails
.
root
.
join
(
"jh"
,
".
#{
prefix
}
license_encryption_key.pub"
))
public_key
=
OpenSSL
::
PKey
::
RSA
.
new
(
public_key_file
)
Gitlab
::
License
.
encryption_key
=
public_key
rescue
warn
"WARNING: No valid JH license encryption key provided."
load_license
.
call
(
dir:
'jh'
,
license_name:
'JH license'
)
end
lib/gitlab.rb
View file @
931099d6
...
...
@@ -111,7 +111,7 @@ module Gitlab
def
self
.
jh?
@is_jh
||=
ee?
&&
root
.
join
(
'jh
/app/helpers/jh/appearances_helper.rb
'
).
exist?
&&
root
.
join
(
'jh'
).
exist?
&&
!
%w[true 1]
.
include?
(
ENV
[
'EE_ONLY'
].
to_s
)
end
...
...
spec/lib/gitlab_spec.rb
View file @
931099d6
...
...
@@ -329,7 +329,7 @@ RSpec.describe Gitlab do
before
do
stub_path
(
'ee/app/models/license.rb'
,
'jh
/app/helpers/jh/appearances_helper.rb
'
,
'jh'
,
exist?:
true
)
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment