blob: 51c496c77d3d80eb8292585100f752f5952c437b (
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
|
# frozen_string_literal: true
module Pages
class LookupPath
def initialize(project, trim_prefix: nil, domain: nil)
@project = project
@domain = domain
@trim_prefix = trim_prefix || project.full_path
end
def project_id
project.id
end
def access_control
project.private_pages?
end
def https_only
domain_https = domain ? domain.https? : true
project.pages_https_only? && domain_https
end
def source
{
type: 'file',
path: File.join(project.full_path, 'public/')
}
end
def prefix
if project.pages_group_root?
'/'
else
project.full_path.delete_prefix(trim_prefix) + '/'
end
end
private
attr_reader :project, :trim_prefix, :domain
end
end
|