Class: Gitlab::Pages::DeploymentUpdate

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
lib/gitlab/pages/deployment_update.rb

Constant Summary collapse

PUBLIC_DIR =
'public'

Instance Method Summary collapse

Constructor Details

#initialize(project, build) ⇒ DeploymentUpdate

Returns a new instance of DeploymentUpdate.



16
17
18
19
# File 'lib/gitlab/pages/deployment_update.rb', line 16

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

Instance Method Details

#entries_countObject



27
28
29
30
31
32
# File 'lib/gitlab/pages/deployment_update.rb', line 27

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
  @entries_count = build.("", recursive: true).entries.count
end

#latest?Boolean

Returns:

  • (Boolean)


21
22
23
24
25
# File 'lib/gitlab/pages/deployment_update.rb', line 21

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