2019-03-20 13:23:23 -04:00
|
|
|
# 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-05-04 05:11:06 -04:00
|
|
|
::DetectRepositoryLanguagesWorker.perform_async(project.id)
|
2019-03-20 13:23:23 -04:00
|
|
|
else
|
|
|
|
project.update_column(:detected_repository_languages, true)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def persisted_repository_languages
|
|
|
|
project.repository_languages
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|