11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'app/jobs/scan/model/parse_metadata_job.rb', line 11
def perform(model_id)
model = Model.find(model_id)
return if model.remote?
options = {
creator: model.creator,
collections: model.collections,
preview_file: model.preview_file,
notes: model.notes,
tag_list: model.tag_list
}.compact_blank
options = combine_options options, attributes_from_readme(model.model_files.find_by(filename_lower: README_FILES))
options = combine_options options, attributes_from_datapackage(model)
options = combine_options options, attributes_from_path_template(model.library, model.path)
tag_list = tags_from_directory_name(model.path) + tags_from_path_template(model.library, model.path)
options[:tag_list] = (options[:tag_list] || []) + remove_stop_words(tag_list.uniq)
options = combine_options options, identify_preview_file(model)
model.update!(options.compact_blank!)
end
|