Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/metadata_dictionary/ruby.py
# Copyright (C) 2018-2022 The Software Heritage developers | # Copyright (C) 2018-2022 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
import ast | import ast | ||||
import itertools | import itertools | ||||
import re | import re | ||||
from typing import List | from typing import List | ||||
from swh.indexer.codemeta import CROSSWALK_TABLE, SCHEMA_URI | from swh.indexer.codemeta import CROSSWALK_TABLE | ||||
from swh.indexer.metadata_dictionary.base import DirectoryLsEntry | from swh.indexer.metadata_dictionary.base import DirectoryLsEntry | ||||
from swh.indexer.namespaces import SCHEMA | |||||
from swh.indexer.storage.interface import Sha1 | from swh.indexer.storage.interface import Sha1 | ||||
from .base import BaseIntrinsicMapping, DictMapping | from .base import BaseIntrinsicMapping, DictMapping | ||||
def name_to_person(name): | def name_to_person(name): | ||||
return { | return { | ||||
"@type": SCHEMA_URI + "Person", | "@type": SCHEMA.Person, | ||||
SCHEMA_URI + "name": name, | SCHEMA.name: name, | ||||
} | } | ||||
class GemspecMapping(BaseIntrinsicMapping, DictMapping): | class GemspecMapping(BaseIntrinsicMapping, DictMapping): | ||||
name = "gemspec" | name = "gemspec" | ||||
mapping = CROSSWALK_TABLE["Ruby Gem"] | mapping = CROSSWALK_TABLE["Ruby Gem"] | ||||
string_fields = ["name", "version", "description", "summary", "email"] | string_fields = ["name", "version", "description", "summary", "email"] | ||||
▲ Show 20 Lines • Show All 106 Lines • Show Last 20 Lines |