Class: Ci::Catalog::Resources::ValidateService

Inherits:
Object
  • Object
show all
Defined in:
app/services/ci/catalog/resources/validate_service.rb

Constant Summary collapse

MINIMUM_AMOUNT_OF_COMPONENTS =
1

Instance Method Summary collapse

Constructor Details

#initialize(project, ref) ⇒ ValidateService



9
10
11
12
13
# File 'app/services/ci/catalog/resources/validate_service.rb', line 9

def initialize(project, ref)
  @project = project
  @ref = ref
  @errors = []
end

Instance Method Details

#executeObject



15
16
17
18
19
20
21
22
23
24
25
# File 'app/services/ci/catalog/resources/validate_service.rb', line 15

def execute
  verify_presence_project_readme
  verify_presence_project_description
  scan_directory_for_components

  if errors.empty?
    ServiceResponse.success
  else
    ServiceResponse.error(message: errors.join(', '))
  end
end