Class: Pages::LookupPath
- Inherits:
-
Object
- Object
- Pages::LookupPath
- Includes:
- Gitlab::Utils::StrongMemoize
- Defined in:
- app/models/pages/lookup_path.rb
Constant Summary collapse
- LegacyStorageDisabledError =
Class.new(::StandardError)
Instance Method Summary collapse
- #access_control ⇒ Object
- #https_only ⇒ Object
-
#initialize(project, trim_prefix: nil, domain: nil) ⇒ LookupPath
constructor
A new instance of LookupPath.
- #prefix ⇒ Object
- #project_id ⇒ Object
- #root_directory ⇒ Object
- #source ⇒ Object
- #unique_host ⇒ Object
Constructor Details
#initialize(project, trim_prefix: nil, domain: nil) ⇒ LookupPath
Returns a new instance of LookupPath.
9 10 11 12 13 |
# File 'app/models/pages/lookup_path.rb', line 9 def initialize(project, trim_prefix: nil, domain: nil) @project = project @domain = domain @trim_prefix = trim_prefix || project.full_path end |
Instance Method Details
#access_control ⇒ Object
19 20 21 |
# File 'app/models/pages/lookup_path.rb', line 19 def access_control project.private_pages? end |
#https_only ⇒ Object
24 25 26 27 |
# File 'app/models/pages/lookup_path.rb', line 24 def https_only domain_https = domain ? domain.https? : true project.pages_https_only? && domain_https end |
#prefix ⇒ Object
48 49 50 51 52 53 54 |
# File 'app/models/pages/lookup_path.rb', line 48 def prefix if url_builder.namespace_pages? '/' else "#{project.full_path.delete_prefix(trim_prefix)}/" end end |
#project_id ⇒ Object
15 16 17 |
# File 'app/models/pages/lookup_path.rb', line 15 def project_id project.id end |
#root_directory ⇒ Object
62 63 64 65 66 |
# File 'app/models/pages/lookup_path.rb', line 62 def root_directory return unless deployment deployment.root_directory end |
#source ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/models/pages/lookup_path.rb', line 30 def source return unless deployment&.file global_id = ::Gitlab::GlobalId.build(deployment, id: deployment.id).to_s { type: 'zip', path: deployment.file.url_or_file_path( expire_at: ::Gitlab::Pages::DEPLOYMENT_EXPIRATION.from_now ), global_id: global_id, sha256: deployment.file_sha256, file_size: deployment.size, file_count: deployment.file_count } end |
#unique_host ⇒ Object
57 58 59 |
# File 'app/models/pages/lookup_path.rb', line 57 def unique_host url_builder.unique_host end |