Class: Gitlab::Pages::DeploymentValidations

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations, Utils::StrongMemoize
Defined in:
lib/gitlab/pages/deployment_validations.rb

Constant Summary collapse

PUBLIC_DIR =
'public'

Instance Method Summary collapse

Constructor Details

#initialize(project, build) ⇒ DeploymentValidations

Returns a new instance of DeploymentValidations.



20
21
22
23
# File 'lib/gitlab/pages/deployment_validations.rb', line 20

def initialize(project, build)
  @project = project
  @build = build
end

Instance Method Details

#entries_countObject



31
32
33
34
35
36
# File 'lib/gitlab/pages/deployment_validations.rb', line 31

def entries_count
  # we're using the full archive and pages daemon needs to read it
  # so we want the total count from entries, not only "public/" directory
  # because it better approximates work we need to do before we can serve the site
  build.("", recursive: true).entries.count
end

#latest_build?Boolean

Returns:

  • (Boolean)


25
26
27
28
29
# File 'lib/gitlab/pages/deployment_validations.rb', line 25

def latest_build?
  # check if sha for the ref is still the most recent one
  # this helps in case when multiple deployments happens
  sha == latest_sha
end