Module: Content::CustomRepositoryPaths

Included in:
Repository
Defined in:
app/models/content/custom_repository_paths.rb

Instance Method Summary collapse

Instance Method Details

#custom_content_path(product_label, repo_label) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'app/models/content/custom_repository_paths.rb', line 16

def custom_content_path(product_label, repo_label)
  parts = []
  # We generate repo path only for custom product content. We add this
  # constant string to avoid collisions with RH content. RH content url
  # begins usually with something like "/content/dist/rhel/...".
  # There we prefix custom content/repo url with "/custom/..."
  parts << "custom"
  parts += [product_label, repo_label]
  "/" + parts.map { |x| x.gsub(/[^-\w]/, "_") }.join("/")
end

#custom_repo_path(org_label, environment_label, product_label, repo_label) ⇒ Object

repo path for custom product repos (RH repo paths are derived from content url)



11
12
13
14
# File 'app/models/content/custom_repository_paths.rb', line 11

def custom_repo_path(org_label, environment_label, product_label, repo_label)
  prefix = [org_label, environment_label].map { |x| x.gsub(/[^-\w]/, "_") }.join("/")
  prefix + custom_content_path(product_label, repo_label)
end

#repo_path_from_content_path(environment, content_path) ⇒ Object



3
4
5
6
7
# File 'app/models/content/custom_repository_paths.rb', line 3

def repo_path_from_content_path(environment, content_path)
  content_path = content_path.sub(/^\//, "")
  path_prefix  = [environment.organization.label, environment.label].join("/")
  "#{path_prefix}/#{content_path}"
end