Class: Projects::UpdatePagesConfigurationService

Inherits:
BaseService
  • Object
show all
Includes:
Gitlab::Utils::StrongMemoize
Defined in:
app/services/projects/update_pages_configuration_service.rb

Instance Attribute Summary collapse

Attributes inherited from BaseService

#current_user, #params

Instance Method Summary collapse

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Constructor Details

#initialize(project) ⇒ UpdatePagesConfigurationService

Returns a new instance of UpdatePagesConfigurationService.


9
10
11
# File 'app/services/projects/update_pages_configuration_service.rb', line 9

def initialize(project)
  @project = project
end

Instance Attribute Details

#projectObject (readonly)

Returns the value of attribute project


7
8
9
# File 'app/services/projects/update_pages_configuration_service.rb', line 7

def project
  @project
end

Instance Method Details

#executeObject


13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/services/projects/update_pages_configuration_service.rb', line 13

def execute
  # If the pages were never deployed, we can't write out the config, as the
  # directory would not exist.
  # https://gitlab.com/gitlab-org/gitlab/-/issues/235139
  return success unless project.pages_deployed?

  unless file_equals?(pages_config_file, pages_config_json)
    update_file(pages_config_file, pages_config_json)
    reload_daemon
  end

  success
end