debian-mirror-gitlab/app/services/projects/repository_languages_service.rb

25 lines
590 B
Ruby
Raw Normal View History

2019-07-07 11:18:12 +05:30
# frozen_string_literal: true
module Projects
class RepositoryLanguagesService < BaseService
def execute
perform_language_detection unless project.detected_repository_languages?
persisted_repository_languages
end
private
def perform_language_detection
if persisted_repository_languages.blank?
2019-09-04 21:01:54 +05:30
::DetectRepositoryLanguagesWorker.perform_async(project.id)
2019-07-07 11:18:12 +05:30
else
project.update_column(:detected_repository_languages, true)
end
end
def persisted_repository_languages
project.repository_languages
end
end
end