relaton 2.1.0 → 3.0.0.pre.alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/{docs/README.adoc → README.adoc} +109 -38
- data/lib/relaton/3gpp/bibdata.rb +9 -0
- data/lib/relaton/3gpp/bibitem.rb +9 -0
- data/lib/relaton/3gpp/bibliography.rb +48 -0
- data/lib/relaton/3gpp/data_fetcher.rb +255 -0
- data/lib/relaton/3gpp/doctype.rb +9 -0
- data/lib/relaton/3gpp/ext.rb +31 -0
- data/lib/relaton/3gpp/item.rb +12 -0
- data/lib/relaton/3gpp/item_data.rb +15 -0
- data/lib/relaton/3gpp/parser.rb +400 -0
- data/lib/relaton/3gpp/processor.rb +68 -0
- data/lib/relaton/3gpp/release.rb +34 -0
- data/lib/relaton/3gpp/util.rb +8 -0
- data/lib/relaton/3gpp.rb +25 -0
- data/lib/relaton/bib/converter/asciibib/to_asciibib.rb +663 -0
- data/lib/relaton/bib/converter/asciibib.rb +13 -0
- data/lib/relaton/bib/converter/bibtex/from_bibtex.rb +245 -0
- data/lib/relaton/bib/converter/bibtex/to_bibtex.rb +341 -0
- data/lib/relaton/bib/converter/bibtex.rb +23 -0
- data/lib/relaton/bib/converter/bibxml/from_rfcxml.rb +386 -0
- data/lib/relaton/bib/converter/bibxml/from_rfcxml_referencegroup.rb +71 -0
- data/lib/relaton/bib/converter/bibxml/to_rfcxml.rb +308 -0
- data/lib/relaton/bib/converter/bibxml/to_rfcxml_referencegroup.rb +52 -0
- data/lib/relaton/bib/converter/bibxml.rb +51 -0
- data/lib/relaton/bib/hash_parser_v1.rb +767 -0
- data/lib/relaton/bib/item_data.rb +229 -0
- data/lib/relaton/bib/model/abstract.rb +16 -0
- data/lib/relaton/bib/model/address.rb +22 -0
- data/lib/relaton/bib/model/affiliation.rb +16 -0
- data/lib/relaton/bib/model/bibdata.rb +11 -0
- data/lib/relaton/bib/model/bibdata_shared.rb +12 -0
- data/lib/relaton/bib/model/bibitem.rb +11 -0
- data/lib/relaton/bib/model/bibitem_shared.rb +12 -0
- data/lib/relaton/bib/model/contact.rb +18 -0
- data/lib/relaton/bib/model/contribution_info.rb +15 -0
- data/lib/relaton/bib/model/contributor.rb +29 -0
- data/lib/relaton/bib/model/copyright.rb +27 -0
- data/lib/relaton/bib/model/date.rb +31 -0
- data/lib/relaton/bib/model/depiction.rb +16 -0
- data/lib/relaton/bib/model/docidentifier.rb +34 -0
- data/lib/relaton/bib/model/doctype.rb +14 -0
- data/lib/relaton/bib/model/edition.rb +14 -0
- data/lib/relaton/bib/model/ext.rb +39 -0
- data/lib/relaton/bib/model/extent.rb +16 -0
- data/lib/relaton/bib/model/formattedref.rb +43 -0
- data/lib/relaton/bib/model/full_name_type.rb +64 -0
- data/lib/relaton/bib/model/fullname.rb +11 -0
- data/lib/relaton/bib/model/ics.rb +49 -0
- data/lib/relaton/bib/model/image.rb +28 -0
- data/lib/relaton/bib/model/item.rb +96 -0
- data/lib/relaton/bib/model/item_base.rb +20 -0
- data/lib/relaton/bib/model/item_shared.rb +88 -0
- data/lib/relaton/bib/model/keyword.rb +30 -0
- data/lib/relaton/bib/model/locality.rb +18 -0
- data/lib/relaton/bib/model/locality_stack.rb +14 -0
- data/lib/relaton/bib/model/localized_string.rb +48 -0
- data/lib/relaton/bib/model/localized_string_attrs.rb +24 -0
- data/lib/relaton/bib/model/logo.rb +14 -0
- data/lib/relaton/bib/model/medium.rb +22 -0
- data/lib/relaton/bib/model/note.rb +16 -0
- data/lib/relaton/bib/model/organization.rb +13 -0
- data/lib/relaton/bib/model/organization_type.rb +42 -0
- data/lib/relaton/bib/model/person.rb +36 -0
- data/lib/relaton/bib/model/phone.rb +14 -0
- data/lib/relaton/bib/model/place.rb +33 -0
- data/lib/relaton/bib/model/price.rb +14 -0
- data/lib/relaton/bib/model/relation.rb +43 -0
- data/lib/relaton/bib/model/series.rb +34 -0
- data/lib/relaton/bib/model/size.rb +23 -0
- data/lib/relaton/bib/model/source_locality_stack.rb +14 -0
- data/lib/relaton/bib/model/status.rb +27 -0
- data/lib/relaton/bib/model/structured_identifier.rb +48 -0
- data/lib/relaton/bib/model/subdivision.rb +16 -0
- data/lib/relaton/bib/model/title.rb +56 -0
- data/lib/relaton/bib/model/type/plain_date.rb +16 -0
- data/lib/relaton/bib/model/type/string_date.rb +48 -0
- data/lib/relaton/bib/model/uri.rb +18 -0
- data/lib/relaton/bib/model/validity.rb +16 -0
- data/lib/relaton/bib/model/version.rb +43 -0
- data/lib/relaton/bib/namespace_helper.rb +21 -0
- data/lib/relaton/bib/sanitizer.rb +68 -0
- data/lib/relaton/bib/util.rb +18 -0
- data/lib/relaton/bib/versions.json +35 -0
- data/lib/relaton/bib.rb +48 -0
- data/lib/relaton/bipm/bibliography.rb +82 -0
- data/lib/relaton/bipm/converter/asciibib.rb +64 -0
- data/lib/relaton/bipm/data_fetcher.rb +57 -0
- data/lib/relaton/bipm/data_outcomes_parser.rb +657 -0
- data/lib/relaton/bipm/id_parser.rb +277 -0
- data/lib/relaton/bipm/item_data.rb +47 -0
- data/lib/relaton/bipm/model/bibdata.rb +9 -0
- data/lib/relaton/bipm/model/bibitem.rb +9 -0
- data/lib/relaton/bipm/model/comment_period.rb +13 -0
- data/lib/relaton/bipm/model/doctype.rb +12 -0
- data/lib/relaton/bipm/model/ext.rb +38 -0
- data/lib/relaton/bipm/model/item.rb +11 -0
- data/lib/relaton/bipm/model/structured_identifier.rb +15 -0
- data/lib/relaton/bipm/processor.rb +69 -0
- data/lib/relaton/bipm/rawdata_bipm_metrologia/affiliations.rb +111 -0
- data/lib/relaton/bipm/rawdata_bipm_metrologia/fetcher.rb +174 -0
- data/lib/relaton/bipm/rawdata_bipm_metrologia/niso_jats_parser.rb +353 -0
- data/lib/relaton/bipm/si_brochure_parser.rb +186 -0
- data/lib/relaton/bipm/util.rb +8 -0
- data/lib/relaton/bipm.rb +32 -0
- data/lib/relaton/bsi/bibliography.rb +124 -0
- data/lib/relaton/bsi/hit.rb +14 -0
- data/lib/relaton/bsi/hit_collection.rb +114 -0
- data/lib/relaton/bsi/item_data.rb +13 -0
- data/lib/relaton/bsi/model/bibdata.rb +8 -0
- data/lib/relaton/bsi/model/bibitem.rb +8 -0
- data/lib/relaton/bsi/model/docidentifier.rb +9 -0
- data/lib/relaton/bsi/model/doctype.rb +14 -0
- data/lib/relaton/bsi/model/ext.rb +17 -0
- data/lib/relaton/bsi/model/item.rb +17 -0
- data/lib/relaton/bsi/model/item_base.rb +22 -0
- data/lib/relaton/bsi/model/relation.rb +9 -0
- data/lib/relaton/bsi/processor.rb +42 -0
- data/lib/relaton/bsi/schema.json +24882 -0
- data/lib/relaton/bsi/scraper.rb +288 -0
- data/lib/relaton/bsi/util.rb +8 -0
- data/lib/relaton/bsi.rb +25 -0
- data/lib/relaton/calconnect/bibliography.rb +95 -0
- data/lib/relaton/calconnect/data_fetcher.rb +106 -0
- data/lib/relaton/calconnect/hit.rb +14 -0
- data/lib/relaton/calconnect/hit_collection.rb +84 -0
- data/lib/relaton/calconnect/item_data.rb +12 -0
- data/lib/relaton/calconnect/model/bibdata.rb +8 -0
- data/lib/relaton/calconnect/model/bibitem.rb +8 -0
- data/lib/relaton/calconnect/model/doctype.rb +11 -0
- data/lib/relaton/calconnect/model/ext.rb +11 -0
- data/lib/relaton/calconnect/model/item.rb +13 -0
- data/lib/relaton/calconnect/processor.rb +66 -0
- data/lib/relaton/calconnect/scraper.rb +87 -0
- data/lib/relaton/calconnect/util.rb +8 -0
- data/lib/relaton/calconnect.rb +26 -0
- data/lib/relaton/ccsds/bibliography.rb +63 -0
- data/lib/relaton/ccsds/data/fetcher.rb +247 -0
- data/lib/relaton/ccsds/data/iso_references.rb +30 -0
- data/lib/relaton/ccsds/data/parser.rb +194 -0
- data/lib/relaton/ccsds/hit.rb +24 -0
- data/lib/relaton/ccsds/hit_collection.rb +42 -0
- data/lib/relaton/ccsds/item_data.rb +9 -0
- data/lib/relaton/ccsds/model/bibdata.rb +8 -0
- data/lib/relaton/ccsds/model/bibitem.rb +8 -0
- data/lib/relaton/ccsds/model/doctype.rb +9 -0
- data/lib/relaton/ccsds/model/ext.rb +19 -0
- data/lib/relaton/ccsds/model/item.rb +13 -0
- data/lib/relaton/ccsds/processor.rb +68 -0
- data/lib/relaton/ccsds/util.rb +10 -0
- data/lib/relaton/ccsds.rb +33 -0
- data/lib/relaton/cen/bibliography.rb +121 -0
- data/lib/relaton/cen/committees.yaml +66 -0
- data/lib/relaton/cen/hit.rb +16 -0
- data/lib/relaton/cen/hit_collection.rb +68 -0
- data/lib/relaton/cen/item_data.rb +7 -0
- data/lib/relaton/cen/model/bibdata.rb +8 -0
- data/lib/relaton/cen/model/bibitem.rb +8 -0
- data/lib/relaton/cen/model/docidentifier.rb +9 -0
- data/lib/relaton/cen/model/ext.rb +11 -0
- data/lib/relaton/cen/model/item.rb +14 -0
- data/lib/relaton/cen/model/structured_identifier.rb +9 -0
- data/lib/relaton/cen/processor.rb +40 -0
- data/lib/relaton/cen/scraper.rb +210 -0
- data/lib/relaton/cen/util.rb +8 -0
- data/lib/relaton/cen.rb +29 -0
- data/lib/relaton/cie/bibdata.rb +8 -0
- data/lib/relaton/cie/bibitem.rb +8 -0
- data/lib/relaton/cie/bibliography.rb +31 -0
- data/lib/relaton/cie/data_fetcher.rb +355 -0
- data/lib/relaton/cie/ext.rb +7 -0
- data/lib/relaton/cie/item.rb +11 -0
- data/lib/relaton/cie/item_data.rb +6 -0
- data/lib/relaton/cie/processor.rb +66 -0
- data/lib/relaton/cie/scrapper.rb +39 -0
- data/lib/relaton/cie/util.rb +8 -0
- data/lib/relaton/cie.rb +28 -0
- data/lib/relaton/core/array_wrapper.rb +20 -0
- data/lib/relaton/core/data_fetcher.rb +97 -0
- data/lib/relaton/core/date_parser.rb +42 -0
- data/lib/relaton/core/hash_keys_sybolizer.rb +19 -0
- data/lib/relaton/core/hit.rb +49 -0
- data/lib/relaton/core/hit_collection.rb +118 -0
- data/lib/relaton/core/processor.rb +48 -0
- data/lib/relaton/core/workers_pool.rb +45 -0
- data/lib/relaton/core.rb +9 -0
- data/lib/relaton/db/cache.rb +232 -0
- data/lib/relaton/db/config.rb +24 -0
- data/lib/relaton/db/registry.rb +119 -0
- data/lib/relaton/db/util.rb +9 -0
- data/lib/relaton/db/workers_pool.rb +22 -0
- data/lib/relaton/db.rb +20 -206
- data/lib/relaton/doi/crossref.rb +72 -0
- data/lib/relaton/doi/parser.rb +827 -0
- data/lib/relaton/doi/processor.rb +65 -0
- data/lib/relaton/doi/util.rb +8 -0
- data/lib/relaton/doi.rb +20 -0
- data/lib/relaton/ecma/bibdata.rb +8 -0
- data/lib/relaton/ecma/bibitem.rb +8 -0
- data/lib/relaton/ecma/bibliography.rb +81 -0
- data/lib/relaton/ecma/data_fetcher.rb +103 -0
- data/lib/relaton/ecma/data_parser.rb +49 -0
- data/lib/relaton/ecma/edition_parser.rb +80 -0
- data/lib/relaton/ecma/ext.rb +7 -0
- data/lib/relaton/ecma/item.rb +11 -0
- data/lib/relaton/ecma/item_data.rb +6 -0
- data/lib/relaton/ecma/memento_parser.rb +60 -0
- data/lib/relaton/ecma/page_fetcher.rb +27 -0
- data/lib/relaton/ecma/parser_common.rb +33 -0
- data/lib/relaton/ecma/processor.rb +66 -0
- data/lib/relaton/ecma/standard_parser.rb +134 -0
- data/lib/relaton/ecma/util.rb +8 -0
- data/lib/relaton/ecma.rb +24 -0
- data/lib/relaton/etsi/bibdata.rb +10 -0
- data/lib/relaton/etsi/bibitem.rb +10 -0
- data/lib/relaton/etsi/bibliography.rb +46 -0
- data/lib/relaton/etsi/data_fetcher.rb +128 -0
- data/lib/relaton/etsi/data_parser.rb +208 -0
- data/lib/relaton/etsi/doctype.rb +30 -0
- data/lib/relaton/etsi/ext.rb +31 -0
- data/lib/relaton/etsi/item.rb +15 -0
- data/lib/relaton/etsi/item_data.rb +6 -0
- data/lib/relaton/etsi/processor.rb +69 -0
- data/lib/relaton/etsi/pubid.rb +37 -0
- data/lib/relaton/etsi/status.rb +13 -0
- data/lib/relaton/etsi/util.rb +8 -0
- data/lib/relaton/etsi.rb +25 -0
- data/lib/relaton/gb/bibdata.rb +8 -0
- data/lib/relaton/gb/bibitem.rb +8 -0
- data/lib/relaton/gb/bibliography.rb +145 -0
- data/lib/relaton/gb/ccs.rb +14 -0
- data/lib/relaton/gb/committee.rb +13 -0
- data/lib/relaton/gb/docidentifier.rb +23 -0
- data/lib/relaton/gb/doctype.rb +9 -0
- data/lib/relaton/gb/ext.rb +36 -0
- data/lib/relaton/gb/gb_scraper.rb +61 -0
- data/lib/relaton/gb/gb_type.rb +20 -0
- data/lib/relaton/gb/hit.rb +48 -0
- data/lib/relaton/gb/hit_collection.rb +19 -0
- data/lib/relaton/gb/item.rb +13 -0
- data/lib/relaton/gb/item_data.rb +6 -0
- data/lib/relaton/gb/processor.rb +46 -0
- data/lib/relaton/gb/project_number.rb +38 -0
- data/lib/relaton/gb/scraper.rb +204 -0
- data/lib/relaton/gb/sec_scraper.rb +92 -0
- data/lib/relaton/gb/stage_name.rb +13 -0
- data/lib/relaton/gb/structured_identifier.rb +26 -0
- data/lib/relaton/gb/t_scraper.rb +126 -0
- data/lib/relaton/gb/util.rb +8 -0
- data/lib/relaton/gb/yaml/prefixes.yaml +200 -0
- data/lib/relaton/gb.rb +33 -0
- data/lib/relaton/iana/bibdata.rb +8 -0
- data/lib/relaton/iana/bibitem.rb +8 -0
- data/lib/relaton/iana/bibliography.rb +47 -0
- data/lib/relaton/iana/data_fetcher.rb +71 -0
- data/lib/relaton/iana/item.rb +7 -0
- data/lib/relaton/iana/item_data.rb +6 -0
- data/lib/relaton/iana/parser.rb +146 -0
- data/lib/relaton/iana/processor.rb +68 -0
- data/lib/relaton/iana/util.rb +8 -0
- data/lib/relaton/iana.rb +29 -0
- data/lib/relaton/iec/bibliography.rb +283 -0
- data/lib/relaton/iec/data_fetcher.rb +216 -0
- data/lib/relaton/iec/data_parser.rb +391 -0
- data/lib/relaton/iec/hit.rb +26 -0
- data/lib/relaton/iec/hit_collection.rb +138 -0
- data/lib/relaton/iec/item_data.rb +7 -0
- data/lib/relaton/iec/model/bibdata.rb +8 -0
- data/lib/relaton/iec/model/bibitem.rb +8 -0
- data/lib/relaton/iec/model/docidentifier.rb +131 -0
- data/lib/relaton/iec/model/doctype.rb +12 -0
- data/lib/relaton/iec/model/ext.rb +53 -0
- data/lib/relaton/iec/model/item.rb +20 -0
- data/lib/relaton/iec/model/item_base.rb +12 -0
- data/lib/relaton/iec/model/relation.rb +7 -0
- data/lib/relaton/iec/model/stage_name.rb +13 -0
- data/lib/relaton/iec/processor.rb +73 -0
- data/lib/relaton/iec/statuses.yml +199 -0
- data/lib/relaton/iec/util.rb +8 -0
- data/lib/relaton/iec.rb +98 -0
- data/lib/relaton/ieee/balloting_group.rb +13 -0
- data/lib/relaton/ieee/bibdata.rb +8 -0
- data/lib/relaton/ieee/bibitem.rb +8 -0
- data/lib/relaton/ieee/bibliography.rb +51 -0
- data/lib/relaton/ieee/converter/bibxml/from_rfcxml.rb +10 -0
- data/lib/relaton/ieee/converter/bibxml/from_rfcxml_referencegroup.rb +10 -0
- data/lib/relaton/ieee/converter/bibxml.rb +20 -0
- data/lib/relaton/ieee/data_fetcher.rb +630 -0
- data/lib/relaton/ieee/doctype.rb +9 -0
- data/lib/relaton/ieee/editorial_group.rb +19 -0
- data/lib/relaton/ieee/ext.rb +36 -0
- data/lib/relaton/ieee/idams_parser.rb +323 -0
- data/lib/relaton/ieee/item.rb +11 -0
- data/lib/relaton/ieee/item_data.rb +7 -0
- data/lib/relaton/ieee/processor.rb +68 -0
- data/lib/relaton/ieee/pub_id.rb +161 -0
- data/lib/relaton/ieee/rawbib_id_parser.rb +548 -0
- data/lib/relaton/ieee/util.rb +8 -0
- data/lib/relaton/ieee.rb +29 -0
- data/lib/relaton/ietf/bibdata.rb +8 -0
- data/lib/relaton/ietf/bibitem.rb +8 -0
- data/lib/relaton/ietf/bibliography.rb +35 -0
- data/lib/relaton/ietf/bibxml_parser.rb +232 -0
- data/lib/relaton/ietf/data_fetcher.rb +278 -0
- data/lib/relaton/ietf/doctype.rb +9 -0
- data/lib/relaton/ietf/ext.rb +63 -0
- data/lib/relaton/ietf/item.rb +16 -0
- data/lib/relaton/ietf/item_base.rb +18 -0
- data/lib/relaton/ietf/item_data.rb +6 -0
- data/lib/relaton/ietf/processing_instructions.rb +79 -0
- data/lib/relaton/ietf/processor.rb +68 -0
- data/lib/relaton/ietf/relation.rb +9 -0
- data/lib/relaton/ietf/rfc/abstract.rb +19 -0
- data/lib/relaton/ietf/rfc/author.rb +21 -0
- data/lib/relaton/ietf/rfc/entry.rb +410 -0
- data/lib/relaton/ietf/rfc/entry_date.rb +21 -0
- data/lib/relaton/ietf/rfc/format.rb +19 -0
- data/lib/relaton/ietf/rfc/index.rb +46 -0
- data/lib/relaton/ietf/rfc/is_also.rb +21 -0
- data/lib/relaton/ietf/rfc/keywords.rb +19 -0
- data/lib/relaton/ietf/rfc/rfc_index_namespace.rb +11 -0
- data/lib/relaton/ietf/scraper.rb +68 -0
- data/lib/relaton/ietf/util.rb +8 -0
- data/lib/relaton/ietf/wg_name_resolver.rb +42 -0
- data/lib/relaton/ietf.rb +27 -0
- data/lib/relaton/iho/bibdata.rb +8 -0
- data/lib/relaton/iho/bibitem.rb +8 -0
- data/lib/relaton/iho/bibliography.rb +114 -0
- data/lib/relaton/iho/comment_period.rb +13 -0
- data/lib/relaton/iho/docidentifier.rb +31 -0
- data/lib/relaton/iho/doctype.rb +10 -0
- data/lib/relaton/iho/ext.rb +20 -0
- data/lib/relaton/iho/hash_parser_v1.rb +144 -0
- data/lib/relaton/iho/item.rb +20 -0
- data/lib/relaton/iho/item_base.rb +18 -0
- data/lib/relaton/iho/item_data.rb +6 -0
- data/lib/relaton/iho/processor.rb +54 -0
- data/lib/relaton/iho/relation.rb +9 -0
- data/lib/relaton/iho/structured_identifier.rb +20 -0
- data/lib/relaton/iho/util.rb +8 -0
- data/lib/relaton/iho.rb +27 -0
- data/lib/relaton/index/config.rb +52 -0
- data/lib/relaton/index/file_io.rb +305 -0
- data/lib/relaton/index/file_storage.rb +61 -0
- data/lib/relaton/index/id_number.rb +30 -0
- data/lib/relaton/index/pool.rb +41 -0
- data/lib/relaton/index/type.rb +159 -0
- data/lib/relaton/index/util.rb +18 -0
- data/lib/relaton/index.rb +60 -0
- data/lib/relaton/isbn/isbn.rb +61 -0
- data/lib/relaton/isbn/open_library.rb +43 -0
- data/lib/relaton/isbn/parser.rb +88 -0
- data/lib/relaton/isbn/processor.rb +48 -0
- data/lib/relaton/isbn/util.rb +8 -0
- data/lib/relaton/isbn.rb +19 -0
- data/lib/relaton/iso/bibliography.rb +407 -0
- data/lib/relaton/iso/data_fetcher.rb +338 -0
- data/lib/relaton/iso/data_parser.rb +444 -0
- data/lib/relaton/iso/hash_parser_v1.rb +177 -0
- data/lib/relaton/iso/hit.rb +57 -0
- data/lib/relaton/iso/hit_collection.rb +184 -0
- data/lib/relaton/iso/item_data.rb +28 -0
- data/lib/relaton/iso/model/bibdata.rb +10 -0
- data/lib/relaton/iso/model/bibitem.rb +8 -0
- data/lib/relaton/iso/model/contributor.rb +6 -0
- data/lib/relaton/iso/model/contributor_info.rb +9 -0
- data/lib/relaton/iso/model/docidentifier.rb +134 -0
- data/lib/relaton/iso/model/doctype.rb +13 -0
- data/lib/relaton/iso/model/ext.rb +35 -0
- data/lib/relaton/iso/model/item.rb +17 -0
- data/lib/relaton/iso/model/item_base.rb +22 -0
- data/lib/relaton/iso/model/organization.rb +9 -0
- data/lib/relaton/iso/model/project_number.rb +22 -0
- data/lib/relaton/iso/model/relation.rb +9 -0
- data/lib/relaton/iso/model/stagename.rb +14 -0
- data/lib/relaton/iso/model/structured_identifier.rb +31 -0
- data/lib/relaton/iso/processor.rb +84 -0
- data/lib/relaton/iso/scraper.rb +619 -0
- data/lib/relaton/iso/type/pubid.rb +50 -0
- data/lib/relaton/iso/util.rb +8 -0
- data/lib/relaton/iso.rb +30 -0
- data/lib/relaton/itu/bibliography.rb +90 -0
- data/lib/relaton/itu/data_fetcher.rb +104 -0
- data/lib/relaton/itu/data_parser_r.rb +140 -0
- data/lib/relaton/itu/hit.rb +22 -0
- data/lib/relaton/itu/hit_collection.rb +127 -0
- data/lib/relaton/itu/item_data.rb +6 -0
- data/lib/relaton/itu/model/approval_stage.rb +13 -0
- data/lib/relaton/itu/model/bibdata.rb +8 -0
- data/lib/relaton/itu/model/bibitem.rb +8 -0
- data/lib/relaton/itu/model/docidentifier.rb +9 -0
- data/lib/relaton/itu/model/doctype.rb +13 -0
- data/lib/relaton/itu/model/ext.rb +47 -0
- data/lib/relaton/itu/model/item.rb +13 -0
- data/lib/relaton/itu/model/meeting.rb +13 -0
- data/lib/relaton/itu/model/meeting_date.rb +15 -0
- data/lib/relaton/itu/model/question.rb +13 -0
- data/lib/relaton/itu/model/recommendation_status.rb +11 -0
- data/lib/relaton/itu/model/structured_identifier.rb +19 -0
- data/lib/relaton/itu/processor.rb +66 -0
- data/lib/relaton/itu/pubid.rb +177 -0
- data/lib/relaton/itu/radio_regulations_parser.rb +70 -0
- data/lib/relaton/itu/recommendation_parser.rb +161 -0
- data/lib/relaton/itu/scraper.rb +193 -0
- data/lib/relaton/itu/util.rb +8 -0
- data/lib/relaton/itu.rb +33 -0
- data/lib/relaton/jis/bibdata.rb +8 -0
- data/lib/relaton/jis/bibitem.rb +8 -0
- data/lib/relaton/jis/bibliography.rb +75 -0
- data/lib/relaton/jis/data_fetcher.rb +181 -0
- data/lib/relaton/jis/docidentifier.rb +21 -0
- data/lib/relaton/jis/doctype.rb +9 -0
- data/lib/relaton/jis/ext.rb +13 -0
- data/lib/relaton/jis/hit.rb +93 -0
- data/lib/relaton/jis/hit_collection.rb +127 -0
- data/lib/relaton/jis/item.rb +22 -0
- data/lib/relaton/jis/item_base.rb +26 -0
- data/lib/relaton/jis/item_data.rb +8 -0
- data/lib/relaton/jis/processor.rb +55 -0
- data/lib/relaton/jis/relation.rb +11 -0
- data/lib/relaton/jis/scraper.rb +232 -0
- data/lib/relaton/jis/structured_identifier.rb +13 -0
- data/lib/relaton/jis/util.rb +8 -0
- data/lib/relaton/jis.rb +33 -0
- data/lib/relaton/logger/channels/gh_issue.rb +78 -0
- data/lib/relaton/logger/config.rb +34 -0
- data/lib/relaton/logger/formatter_json.rb +8 -0
- data/lib/relaton/logger/formatter_string.rb +12 -0
- data/lib/relaton/logger/log.rb +64 -0
- data/lib/relaton/logger/log_device.rb +27 -0
- data/lib/relaton/logger/pool.rb +24 -0
- data/lib/relaton/logger.rb +18 -0
- data/lib/relaton/nist/bibdata.rb +8 -0
- data/lib/relaton/nist/bibitem.rb +8 -0
- data/lib/relaton/nist/bibliography.rb +191 -0
- data/lib/relaton/nist/comment_period.rb +15 -0
- data/lib/relaton/nist/data_fetcher.rb +84 -0
- data/lib/relaton/nist/date.rb +7 -0
- data/lib/relaton/nist/doctype.rb +7 -0
- data/lib/relaton/nist/ext.rb +16 -0
- data/lib/relaton/nist/hit.rb +18 -0
- data/lib/relaton/nist/hit_collection.rb +362 -0
- data/lib/relaton/nist/item.rb +17 -0
- data/lib/relaton/nist/item_data.rb +6 -0
- data/lib/relaton/nist/mods_parser.rb +276 -0
- data/lib/relaton/nist/processor.rb +68 -0
- data/lib/relaton/nist/pubs_export.rb +69 -0
- data/lib/relaton/nist/relation.rb +7 -0
- data/lib/relaton/nist/scraper.rb +290 -0
- data/lib/relaton/nist/series.yaml +49 -0
- data/lib/relaton/nist/util.rb +8 -0
- data/lib/relaton/nist.rb +34 -0
- data/lib/relaton/oasis/bibdata.rb +8 -0
- data/lib/relaton/oasis/bibitem.rb +8 -0
- data/lib/relaton/oasis/bibliography.rb +60 -0
- data/lib/relaton/oasis/browser_agent.rb +71 -0
- data/lib/relaton/oasis/data_fetcher.rb +94 -0
- data/lib/relaton/oasis/data_parser.rb +305 -0
- data/lib/relaton/oasis/data_parser_utils.rb +296 -0
- data/lib/relaton/oasis/data_part_parser.rb +239 -0
- data/lib/relaton/oasis/doctype.rb +7 -0
- data/lib/relaton/oasis/ext.rb +19 -0
- data/lib/relaton/oasis/item.rb +11 -0
- data/lib/relaton/oasis/item_data.rb +6 -0
- data/lib/relaton/oasis/processor.rb +68 -0
- data/lib/relaton/oasis/util.rb +8 -0
- data/lib/relaton/oasis.rb +28 -0
- data/lib/relaton/ogc/bibdata.rb +8 -0
- data/lib/relaton/ogc/bibitem.rb +8 -0
- data/lib/relaton/ogc/bibliography.rb +64 -0
- data/lib/relaton/ogc/data_fetcher.rb +110 -0
- data/lib/relaton/ogc/docidentifier.rb +6 -0
- data/lib/relaton/ogc/doctype.rb +12 -0
- data/lib/relaton/ogc/ext.rb +15 -0
- data/lib/relaton/ogc/hit.rb +18 -0
- data/lib/relaton/ogc/hit_collection.rb +36 -0
- data/lib/relaton/ogc/item.rb +13 -0
- data/lib/relaton/ogc/item_data.rb +6 -0
- data/lib/relaton/ogc/processor.rb +58 -0
- data/lib/relaton/ogc/scraper.rb +225 -0
- data/lib/relaton/ogc/util.rb +8 -0
- data/lib/relaton/ogc.rb +26 -0
- data/lib/relaton/oiml/bibdata.rb +8 -0
- data/lib/relaton/oiml/bibitem.rb +8 -0
- data/lib/relaton/oiml/bibliography.rb +94 -0
- data/lib/relaton/oiml/docidentifier.rb +33 -0
- data/lib/relaton/oiml/doctype.rb +13 -0
- data/lib/relaton/oiml/ext.rb +42 -0
- data/lib/relaton/oiml/item.rb +20 -0
- data/lib/relaton/oiml/item_base.rb +18 -0
- data/lib/relaton/oiml/item_data.rb +6 -0
- data/lib/relaton/oiml/processor.rb +54 -0
- data/lib/relaton/oiml/relation.rb +9 -0
- data/lib/relaton/oiml/util.rb +8 -0
- data/lib/relaton/oiml.rb +24 -0
- data/lib/relaton/omg/bibdata.rb +8 -0
- data/lib/relaton/omg/bibitem.rb +8 -0
- data/lib/relaton/omg/bibliography.rb +31 -0
- data/lib/relaton/omg/ext.rb +7 -0
- data/lib/relaton/omg/item.rb +8 -0
- data/lib/relaton/omg/item_data.rb +6 -0
- data/lib/relaton/omg/processor.rb +34 -0
- data/lib/relaton/omg/scraper.rb +141 -0
- data/lib/relaton/omg/util.rb +8 -0
- data/lib/relaton/omg.rb +24 -0
- data/lib/relaton/plateau/bibdata.rb +8 -0
- data/lib/relaton/plateau/bibitem.rb +8 -0
- data/lib/relaton/plateau/bibliography.rb +24 -0
- data/lib/relaton/plateau/data_fetcher.rb +153 -0
- data/lib/relaton/plateau/doctype.rb +7 -0
- data/lib/relaton/plateau/ext.rb +23 -0
- data/lib/relaton/plateau/handbook_parser.rb +95 -0
- data/lib/relaton/plateau/hit.rb +13 -0
- data/lib/relaton/plateau/hit_collection.rb +59 -0
- data/lib/relaton/plateau/item.rb +12 -0
- data/lib/relaton/plateau/item_data.rb +6 -0
- data/lib/relaton/plateau/parser.rb +101 -0
- data/lib/relaton/plateau/processor.rb +49 -0
- data/lib/relaton/plateau/technical_report_parser.rb +91 -0
- data/lib/relaton/plateau/util.rb +8 -0
- data/lib/relaton/plateau.rb +28 -0
- data/lib/relaton/un/bibdata.rb +8 -0
- data/lib/relaton/un/bibitem.rb +8 -0
- data/lib/relaton/un/bibliography.rb +48 -0
- data/lib/relaton/un/doctype.rb +10 -0
- data/lib/relaton/un/ext.rb +30 -0
- data/lib/relaton/un/hit.rb +56 -0
- data/lib/relaton/un/hit_collection.rb +61 -0
- data/lib/relaton/un/item.rb +11 -0
- data/lib/relaton/un/item_data.rb +6 -0
- data/lib/relaton/un/parser.rb +108 -0
- data/lib/relaton/un/processor.rb +38 -0
- data/lib/relaton/un/session.rb +25 -0
- data/lib/relaton/un/token_generator.rb +105 -0
- data/lib/relaton/un/util.rb +8 -0
- data/lib/relaton/un/wasm/decoder.rb +434 -0
- data/lib/relaton/un/wasm/instance.rb +101 -0
- data/lib/relaton/un/wasm/interpreter.rb +613 -0
- data/lib/relaton/un/wasm/memory.rb +112 -0
- data/lib/relaton/un/wasm/module.rb +47 -0
- data/lib/relaton/un/wasm.rb +17 -0
- data/lib/relaton/un/wasm_v_bg.wasm +0 -0
- data/lib/relaton/un.rb +28 -0
- data/lib/relaton/version.rb +1 -1
- data/lib/relaton/w3c/bibdata.rb +8 -0
- data/lib/relaton/w3c/bibitem.rb +8 -0
- data/lib/relaton/w3c/bibliography.rb +54 -0
- data/lib/relaton/w3c/data_fetcher.rb +309 -0
- data/lib/relaton/w3c/data_parser.rb +379 -0
- data/lib/relaton/w3c/doctype.rb +7 -0
- data/lib/relaton/w3c/ext.rb +11 -0
- data/lib/relaton/w3c/item.rb +12 -0
- data/lib/relaton/w3c/item_data.rb +6 -0
- data/lib/relaton/w3c/processor.rb +49 -0
- data/lib/relaton/w3c/pubid.rb +73 -0
- data/lib/relaton/w3c/safe_realize.rb +59 -0
- data/lib/relaton/w3c/util.rb +8 -0
- data/lib/relaton/w3c.rb +25 -0
- data/lib/relaton/xsf/bibdata.rb +8 -0
- data/lib/relaton/xsf/bibitem.rb +8 -0
- data/lib/relaton/xsf/bibliography.rb +24 -0
- data/lib/relaton/xsf/data_fetcher.rb +56 -0
- data/lib/relaton/xsf/hit.rb +17 -0
- data/lib/relaton/xsf/hit_collection.rb +24 -0
- data/lib/relaton/xsf/item.rb +7 -0
- data/lib/relaton/xsf/item_data.rb +6 -0
- data/lib/relaton/xsf/processor.rb +50 -0
- data/lib/relaton/xsf/util.rb +9 -0
- data/lib/relaton/xsf.rb +30 -0
- data/lib/relaton-core.rb +1 -0
- data/lib/relaton.rb +44 -9
- metadata +708 -150
- data/.github/workflows/rake.yml +0 -14
- data/.github/workflows/release.yml +0 -24
- data/.github/workflows/rubocop.yml +0 -48
- data/.gitignore +0 -12
- data/.rspec +0 -3
- data/.rubocop.yml +0 -12
- data/CLAUDE.md +0 -70
- data/Gemfile +0 -21
- data/Rakefile +0 -6
- data/docs/CHANGELOG.adoc +0 -16
- data/docs/VERSIONING_POLICY.adoc +0 -38
- data/docs/navigation.adoc +0 -6
- data/lib/relaton/config.rb +0 -24
- data/lib/relaton/db_cache.rb +0 -230
- data/lib/relaton/registry.rb +0 -118
- data/lib/relaton/util.rb +0 -7
- data/lib/relaton/workers_pool.rb +0 -21
- data/relaton.gemspec +0 -61
- data/spec/relaton/config_spec.rb +0 -10
- data/spec/relaton/db_cache_spec.rb +0 -51
- data/spec/relaton/db_spec.rb +0 -556
- data/spec/relaton/registry_spec.rb +0 -178
- data/spec/relaton/util_spec.rb +0 -3
- data/spec/relaton_spec.rb +0 -725
- data/spec/spec_helper.rb +0 -45
- data/spec/support/gb_t_20223_2006.xml +0 -33
- data/spec/support/iso_111111119115_1.xml +0 -0
- data/spec/support/iso_19115_1.xml +0 -115
- data/spec/support/iso_19115_2.xml +0 -95
- data/spec/support/rfc_8341.xml +0 -46
- data/spec/vcr_cassetes/3gpp_tr_00_01u_umts_3_0_0.yml +0 -12720
- data/spec/vcr_cassetes/api_relaton_org.yml +0 -121
- data/spec/vcr_cassetes/api_relaton_org_unavailable.yml +0 -143
- data/spec/vcr_cassetes/cc_dir_10005_2019.yml +0 -199
- data/spec/vcr_cassetes/cie_001_1980.yml +0 -401
- data/spec/vcr_cassetes/cipm_meeting_43.yml +0 -1513
- data/spec/vcr_cassetes/doi_10_6028_nist_ir_8245.yml +0 -86
- data/spec/vcr_cassetes/ecma_6.yml +0 -112
- data/spec/vcr_cassetes/en_10160_1999.yml +0 -13624
- data/spec/vcr_cassetes/gb_t_20223_2006.yml +0 -733
- data/spec/vcr_cassetes/ieee_528_2019.yml +0 -2786
- data/spec/vcr_cassetes/iso_111111119115_1.yml +0 -12951
- data/spec/vcr_cassetes/iso_19115_1.yml +0 -13177
- data/spec/vcr_cassetes/iso_19115_1_2.yml +0 -369
- data/spec/vcr_cassetes/iso_19115_1_std.yml +0 -13177
- data/spec/vcr_cassetes/iso_19115_all_parts.yml +0 -229
- data/spec/vcr_cassetes/iso_19133_2005.yml +0 -148
- data/spec/vcr_cassetes/iso_combined_applied.yml +0 -364
- data/spec/vcr_cassetes/iso_combined_included.yml +0 -364
- data/spec/vcr_cassetes/iso_dis.yml +0 -157
- data/spec/vcr_cassetes/ogc_19_025r1.yml +0 -371
- data/spec/vcr_cassetes/omg_ami4ccm_1_0.yml +0 -317
- data/spec/vcr_cassetes/rfc_8341.yml +0 -1272
data/relaton.gemspec
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
|
|
3
|
-
lib = File.expand_path("lib", __dir__)
|
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
|
-
require "relaton/version"
|
|
6
|
-
|
|
7
|
-
Gem::Specification.new do |spec|
|
|
8
|
-
spec.name = "relaton"
|
|
9
|
-
spec.version = Relaton::VERSION
|
|
10
|
-
spec.authors = ["Ribose Inc."]
|
|
11
|
-
spec.email = ["open.source@ribose.com"]
|
|
12
|
-
|
|
13
|
-
spec.summary = "The Relaton core for importing, managing and caching " \
|
|
14
|
-
"bibliographic references to technical standards."
|
|
15
|
-
spec.description = <<~DESCRIPTION
|
|
16
|
-
The Relaton core for importing, managing and caching bibliographic
|
|
17
|
-
references to technical standards in the Relaton/XML bibliographic
|
|
18
|
-
model.
|
|
19
|
-
|
|
20
|
-
This gem is in active development.
|
|
21
|
-
DESCRIPTION
|
|
22
|
-
|
|
23
|
-
spec.homepage = "https://github.com/relaton/relaton"
|
|
24
|
-
spec.license = "BSD-2-Clause"
|
|
25
|
-
|
|
26
|
-
spec.bindir = "bin"
|
|
27
|
-
spec.require_paths = ["lib"]
|
|
28
|
-
spec.files = `git ls-files`.split("\n")
|
|
29
|
-
# spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
|
30
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 3.2.0")
|
|
31
|
-
|
|
32
|
-
spec.add_dependency "relaton-3gpp", "~> 2.1.0"
|
|
33
|
-
spec.add_dependency "relaton-bipm", "~> 2.1.0"
|
|
34
|
-
spec.add_dependency "relaton-bsi", "~> 2.1.0"
|
|
35
|
-
spec.add_dependency "relaton-calconnect", "~> 2.1.0"
|
|
36
|
-
spec.add_dependency "relaton-ccsds", "~> 2.1.0"
|
|
37
|
-
spec.add_dependency "relaton-cen", "~> 2.1.0"
|
|
38
|
-
spec.add_dependency "relaton-cie", "~> 2.1.0"
|
|
39
|
-
spec.add_dependency "relaton-doi", "~> 2.1.0"
|
|
40
|
-
spec.add_dependency "relaton-ecma", "~> 2.1.0"
|
|
41
|
-
spec.add_dependency "relaton-etsi", "~> 2.1.0"
|
|
42
|
-
spec.add_dependency "relaton-gb", "~> 2.1.0"
|
|
43
|
-
spec.add_dependency "relaton-iana", "~> 2.1.0"
|
|
44
|
-
spec.add_dependency "relaton-iec", "~> 2.1.0"
|
|
45
|
-
spec.add_dependency "relaton-ieee", "~> 2.1.0"
|
|
46
|
-
spec.add_dependency "relaton-ietf", "~> 2.1.0"
|
|
47
|
-
spec.add_dependency "relaton-iho", "~> 2.1.0"
|
|
48
|
-
spec.add_dependency "relaton-isbn", "~> 2.1.0"
|
|
49
|
-
spec.add_dependency "relaton-iso", "~> 2.1.0"
|
|
50
|
-
spec.add_dependency "relaton-itu", "~> 2.1.0"
|
|
51
|
-
spec.add_dependency "relaton-jis", "~> 2.1.0"
|
|
52
|
-
spec.add_dependency "relaton-nist", "~> 2.1.0"
|
|
53
|
-
spec.add_dependency "relaton-oasis", "~> 2.1.0"
|
|
54
|
-
spec.add_dependency "relaton-ogc", "~> 2.1.0"
|
|
55
|
-
spec.add_dependency "relaton-omg", "~> 2.1.0"
|
|
56
|
-
spec.add_dependency "relaton-plateau", "~> 2.1.0"
|
|
57
|
-
spec.add_dependency "relaton-un", "~> 2.1.0"
|
|
58
|
-
spec.add_dependency "relaton-w3c", "~> 2.1.0"
|
|
59
|
-
spec.add_dependency "relaton-xsf", "~> 2.1.0"
|
|
60
|
-
spec.metadata["rubygems_mfa_required"] = "true"
|
|
61
|
-
end
|
data/spec/relaton/config_spec.rb
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
require "fileutils"
|
|
2
|
-
require "timeout"
|
|
3
|
-
|
|
4
|
-
RSpec.describe Relaton::DbCache do
|
|
5
|
-
it "creates default caches" do
|
|
6
|
-
cache_path = File.expand_path("~/.relaton/cache")
|
|
7
|
-
FileUtils.mv cache_path, "relaton1/cache", force: true
|
|
8
|
-
FileUtils.rm_rf %w(relaton)
|
|
9
|
-
Relaton::Db.init_bib_caches(
|
|
10
|
-
global_cache: true, local_cache: "", flush_caches: true,
|
|
11
|
-
)
|
|
12
|
-
expect(File.exist?(cache_path)).to be true
|
|
13
|
-
expect(File.exist?("relaton")).to be true
|
|
14
|
-
FileUtils.mv "relaton1/cache", cache_path if File.exist? "relaton1"
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
it "write same file by concurent processes" do
|
|
18
|
-
dir = "testcache/iso"
|
|
19
|
-
FileUtils.mkdir_p dir
|
|
20
|
-
file_name = File.join dir, "iso_123.xml"
|
|
21
|
-
file = File.open(file_name, File::RDWR | File::CREAT, encoding: "UTF-8") # rubocop:disable Style/FileOpen
|
|
22
|
-
file.flock File::LOCK_EX
|
|
23
|
-
command = <<~RBY
|
|
24
|
-
require "relaton"
|
|
25
|
-
cache = Relaton::DbCache.new "testcache"
|
|
26
|
-
cache["ISO(ISO 123)"] = "test 1"
|
|
27
|
-
RBY
|
|
28
|
-
pid = spawn RbConfig.ruby, "-e #{command}"
|
|
29
|
-
sleep 0.1
|
|
30
|
-
file.write "test 2"
|
|
31
|
-
file.flock File::LOCK_UN
|
|
32
|
-
file.close
|
|
33
|
-
Process.waitpid pid, 0
|
|
34
|
-
expect($?.exitstatus).to eq 0
|
|
35
|
-
expect(File.read(file_name)).to eq "test 1"
|
|
36
|
-
FileUtils.rm_rf "testcache"
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
context "delete file from cache" do
|
|
40
|
-
it "delete redirect file and its original" do
|
|
41
|
-
cache = Relaton::DbCache.new "testcache"
|
|
42
|
-
cache["ISO(ISO 123)"] = "test 1"
|
|
43
|
-
cache["ISO(123)"] = "redirection ISO(ISO 123)"
|
|
44
|
-
expect(File.exist?("testcache/iso/iso_123.xml")).to be true
|
|
45
|
-
expect(File.exist?("testcache/iso/123.redirect")).to be true
|
|
46
|
-
cache["ISO(123)"] = nil
|
|
47
|
-
expect(File.exist?("testcache/iso/iso_123.xml")).to be false
|
|
48
|
-
expect(File.exist?("testcache/iso/123.redirect")).to be false
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
data/spec/relaton/db_spec.rb
DELETED
|
@@ -1,556 +0,0 @@
|
|
|
1
|
-
RSpec.describe Relaton::Db do
|
|
2
|
-
before(:each) do |example|
|
|
3
|
-
# Relaton.instance_variable_set :@configuration, nil
|
|
4
|
-
FileUtils.rm_rf %w[testcache testcache2]
|
|
5
|
-
|
|
6
|
-
if example.metadata[:vcr]
|
|
7
|
-
# Force to download index file
|
|
8
|
-
require "relaton/index"
|
|
9
|
-
allow_any_instance_of(Relaton::Index::Type)
|
|
10
|
-
.to receive(:actual?).and_return(false)
|
|
11
|
-
allow_any_instance_of(Relaton::Index::FileIO)
|
|
12
|
-
.to receive(:check_file).and_return(nil)
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
subject { Relaton::Db.new nil, nil }
|
|
17
|
-
|
|
18
|
-
context "instance methods" do
|
|
19
|
-
context "#search_edition_year" do
|
|
20
|
-
it "create bibitem from YAML content" do
|
|
21
|
-
h = { "docid" => [{ "id" => "ISO 123", type: "ISO",
|
|
22
|
-
"primary" => true }] }
|
|
23
|
-
item = subject.send :search_edition_year, "iso/item.yaml", h.to_yaml,
|
|
24
|
-
nil, nil
|
|
25
|
-
expect(item).to be_instance_of Relaton::Iso::ItemData
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
context "#new_bib_entry" do
|
|
30
|
-
let(:db) { double "db" }
|
|
31
|
-
before do
|
|
32
|
-
expect(db).to receive(:[]).with("ISO(ISO 123)").and_return "not_found"
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
it "warn if cached entry is not_found" do
|
|
36
|
-
expect do
|
|
37
|
-
expect(subject).to_not receive(:fetch_entry)
|
|
38
|
-
entry = subject.send :new_bib_entry, "ISO 123", nil, {},
|
|
39
|
-
:relaton_iso, db: db, id: "ISO(ISO 123)"
|
|
40
|
-
expect(entry).to be_nil
|
|
41
|
-
end.to output(
|
|
42
|
-
"[relaton] INFO: (ISO 123) not found in cache, " \
|
|
43
|
-
"if you wish to ignore cache please use " \
|
|
44
|
-
"`no-cache` option.\n",
|
|
45
|
-
).to_stderr_from_any_process
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
it "ignore cache" do
|
|
49
|
-
expect(subject).to receive(:fetch_entry).with(
|
|
50
|
-
"ISO 123", nil, { no_cache: true }, :relaton_iso,
|
|
51
|
-
db: db, id: "ISO(ISO 123)"
|
|
52
|
-
).and_return :entry
|
|
53
|
-
entry = subject.send(
|
|
54
|
-
:new_bib_entry, "ISO 123", nil, { no_cache: true },
|
|
55
|
-
:relaton_iso, db: db, id: "ISO(ISO 123)"
|
|
56
|
-
)
|
|
57
|
-
expect(entry).to be :entry
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
context "#combine_doc" do
|
|
62
|
-
it "retrun nil for BIPM documents" do
|
|
63
|
-
code = double "code"
|
|
64
|
-
expect(code).not_to receive(:split)
|
|
65
|
-
expect(subject.send(:combine_doc, code, nil, {},
|
|
66
|
-
:relaton_bipm)).to be_nil
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
context "#fetch_entry" do
|
|
71
|
-
let(:db_cache) { double "db_cache" }
|
|
72
|
-
|
|
73
|
-
before do
|
|
74
|
-
expect(subject).to receive(:net_retry).with(
|
|
75
|
-
"ISO 123", nil, {},
|
|
76
|
-
kind_of(Relaton::Iso::Processor), 1
|
|
77
|
-
).and_return :bib
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
it "using cache" do
|
|
81
|
-
expect(db_cache).to receive(:[]).with("ISO(ISO 123)")
|
|
82
|
-
.and_return nil
|
|
83
|
-
expect(db_cache).to receive(:[]=)
|
|
84
|
-
.with("ISO(ISO 123)", :entry)
|
|
85
|
-
expect(subject).to receive(:check_entry).with(
|
|
86
|
-
:bib, :relaton_iso,
|
|
87
|
-
db: db_cache, id: "ISO(ISO 123)"
|
|
88
|
-
).and_return :entry
|
|
89
|
-
entry = subject.send :fetch_entry, "ISO 123", nil, {}, :relaton_iso,
|
|
90
|
-
db: db_cache, id: "ISO(ISO 123)"
|
|
91
|
-
expect(entry).to be :entry
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
it "DbCache is undefined" do
|
|
95
|
-
expect(subject).to receive(:check_entry).with(:bib, :relaton_iso,
|
|
96
|
-
**{}).and_return :entry
|
|
97
|
-
entry = subject.send :fetch_entry, "ISO 123", nil, {}, :relaton_iso
|
|
98
|
-
expect(entry).to be :entry
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
it "not using cache" do
|
|
102
|
-
expect(subject).to receive(:bib_entry).with(:bib).and_return :entry
|
|
103
|
-
expect(subject).to receive(:check_entry).with(
|
|
104
|
-
:bib, :relaton_iso, db: db_cache, id: "ISO(ISO 123)", no_cache: true
|
|
105
|
-
).and_return :entry
|
|
106
|
-
expect(db_cache).to receive(:[]).with("ISO(ISO 123)").and_return :entry
|
|
107
|
-
entry = subject.send :fetch_entry, "ISO 123", nil, {}, :relaton_iso,
|
|
108
|
-
db: db_cache, id: "ISO(ISO 123)", no_cache: true
|
|
109
|
-
expect(entry).to be :entry
|
|
110
|
-
end
|
|
111
|
-
end
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
context "#pub_date_in_range?" do
|
|
115
|
-
let(:xml_with_date) do
|
|
116
|
-
<<~XML
|
|
117
|
-
<bibitem id="ISO123">
|
|
118
|
-
<title>Test</title>
|
|
119
|
-
<date type="published"><on>2019-06-15</on></date>
|
|
120
|
-
</bibitem>
|
|
121
|
-
XML
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
let(:xml_year_only) do
|
|
125
|
-
<<~XML
|
|
126
|
-
<bibitem id="ISO123">
|
|
127
|
-
<title>Test</title>
|
|
128
|
-
<date type="published"><on>2019</on></date>
|
|
129
|
-
</bibitem>
|
|
130
|
-
XML
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
let(:xml_year_month) do
|
|
134
|
-
<<~XML
|
|
135
|
-
<bibitem id="ISO123">
|
|
136
|
-
<title>Test</title>
|
|
137
|
-
<date type="published"><on>2019-06</on></date>
|
|
138
|
-
</bibitem>
|
|
139
|
-
XML
|
|
140
|
-
end
|
|
141
|
-
|
|
142
|
-
let(:xml_no_date) do
|
|
143
|
-
<<~XML
|
|
144
|
-
<bibitem id="ISO123">
|
|
145
|
-
<title>Test</title>
|
|
146
|
-
</bibitem>
|
|
147
|
-
XML
|
|
148
|
-
end
|
|
149
|
-
|
|
150
|
-
it "returns true when date is within range" do
|
|
151
|
-
result = subject.send(
|
|
152
|
-
:pub_date_in_range?, xml_with_date,
|
|
153
|
-
publication_date_after: "2019-01-01",
|
|
154
|
-
publication_date_before: "2020-01-01"
|
|
155
|
-
)
|
|
156
|
-
expect(result).to be true
|
|
157
|
-
end
|
|
158
|
-
|
|
159
|
-
it "returns false when date is before :publication_date_after" do
|
|
160
|
-
result = subject.send(
|
|
161
|
-
:pub_date_in_range?, xml_with_date,
|
|
162
|
-
publication_date_after: "2020-01-01"
|
|
163
|
-
)
|
|
164
|
-
expect(result).to be false
|
|
165
|
-
end
|
|
166
|
-
|
|
167
|
-
it "returns false when date is on or after " \
|
|
168
|
-
":publication_date_before (exclusive)" do
|
|
169
|
-
result = subject.send(
|
|
170
|
-
:pub_date_in_range?, xml_with_date,
|
|
171
|
-
publication_date_before: "2019-06-15"
|
|
172
|
-
)
|
|
173
|
-
expect(result).to be false
|
|
174
|
-
end
|
|
175
|
-
|
|
176
|
-
it "returns true when date equals :publication_date_after (inclusive)" do
|
|
177
|
-
result = subject.send(
|
|
178
|
-
:pub_date_in_range?, xml_with_date,
|
|
179
|
-
publication_date_after: "2019-06-15"
|
|
180
|
-
)
|
|
181
|
-
expect(result).to be true
|
|
182
|
-
end
|
|
183
|
-
|
|
184
|
-
it "handles year-only dates" do
|
|
185
|
-
result = subject.send(
|
|
186
|
-
:pub_date_in_range?, xml_year_only,
|
|
187
|
-
publication_date_after: "2018-01-01",
|
|
188
|
-
publication_date_before: "2020-01-01"
|
|
189
|
-
)
|
|
190
|
-
expect(result).to be true
|
|
191
|
-
end
|
|
192
|
-
|
|
193
|
-
it "handles year-month dates" do
|
|
194
|
-
result = subject.send(
|
|
195
|
-
:pub_date_in_range?, xml_year_month,
|
|
196
|
-
publication_date_after: "2019-05-01",
|
|
197
|
-
publication_date_before: "2019-07-01"
|
|
198
|
-
)
|
|
199
|
-
expect(result).to be true
|
|
200
|
-
end
|
|
201
|
-
|
|
202
|
-
it "returns false when no published date exists" do
|
|
203
|
-
result = subject.send(:pub_date_in_range?, xml_no_date,
|
|
204
|
-
publication_date_after: "2019-01-01")
|
|
205
|
-
expect(result).to be false
|
|
206
|
-
end
|
|
207
|
-
|
|
208
|
-
it "returns true with only :publication_date_after when date matches" do
|
|
209
|
-
result = subject.send(:pub_date_in_range?, xml_with_date,
|
|
210
|
-
publication_date_after: "2019-01-01")
|
|
211
|
-
expect(result).to be true
|
|
212
|
-
end
|
|
213
|
-
|
|
214
|
-
it "returns true with only :publication_date_before when date matches" do
|
|
215
|
-
result = subject.send(:pub_date_in_range?, xml_with_date,
|
|
216
|
-
publication_date_before: "2020-01-01")
|
|
217
|
-
expect(result).to be true
|
|
218
|
-
end
|
|
219
|
-
end
|
|
220
|
-
|
|
221
|
-
context "#std_id with date options" do
|
|
222
|
-
it "includes after suffix" do
|
|
223
|
-
id, code = subject.send(
|
|
224
|
-
:std_id, "ISO 19115-1", nil,
|
|
225
|
-
{ publication_date_after: "2018-01-01" }, :relaton_iso
|
|
226
|
-
)
|
|
227
|
-
expect(id).to eq "ISO(ISO 19115-1 after-2018-01-01)"
|
|
228
|
-
expect(code).to eq "ISO 19115-1"
|
|
229
|
-
end
|
|
230
|
-
|
|
231
|
-
it "includes before suffix" do
|
|
232
|
-
id, code = subject.send(
|
|
233
|
-
:std_id, "ISO 19115-1", nil,
|
|
234
|
-
{ publication_date_before: "2020-12-31" }, :relaton_iso
|
|
235
|
-
)
|
|
236
|
-
expect(id).to eq "ISO(ISO 19115-1 before-2020-12-31)"
|
|
237
|
-
expect(code).to eq "ISO 19115-1"
|
|
238
|
-
end
|
|
239
|
-
|
|
240
|
-
it "includes both after and before suffixes" do
|
|
241
|
-
id, code = subject.send(
|
|
242
|
-
:std_id, "ISO 19115-1", nil,
|
|
243
|
-
{ publication_date_after: "2018-01-01",
|
|
244
|
-
publication_date_before: "2020-12-31" },
|
|
245
|
-
:relaton_iso
|
|
246
|
-
)
|
|
247
|
-
expect(id).to eq(
|
|
248
|
-
"ISO(ISO 19115-1 after-2018-01-01 before-2020-12-31)",
|
|
249
|
-
)
|
|
250
|
-
expect(code).to eq "ISO 19115-1"
|
|
251
|
-
end
|
|
252
|
-
|
|
253
|
-
it "does not change key without date options" do
|
|
254
|
-
id, code = subject.send(:std_id, "ISO 19115-1", nil, {}, :relaton_iso)
|
|
255
|
-
expect(id).to eq "ISO(ISO 19115-1)"
|
|
256
|
-
expect(code).to eq "ISO 19115-1"
|
|
257
|
-
end
|
|
258
|
-
|
|
259
|
-
it "combines with year and all_parts" do
|
|
260
|
-
id, = subject.send(
|
|
261
|
-
:std_id, "ISO 19115-1", "2014",
|
|
262
|
-
{ all_parts: true,
|
|
263
|
-
publication_date_after: "2014-01-01" },
|
|
264
|
-
:relaton_iso
|
|
265
|
-
)
|
|
266
|
-
expect(id).to eq(
|
|
267
|
-
"ISO(ISO 19115-1:2014 (all parts) after-2014-01-01)",
|
|
268
|
-
)
|
|
269
|
-
end
|
|
270
|
-
end
|
|
271
|
-
|
|
272
|
-
context "#check_bibliocache with date options" do
|
|
273
|
-
let(:db) { Relaton::Db.new "testcache", nil }
|
|
274
|
-
|
|
275
|
-
before(:each) do
|
|
276
|
-
db.save_entry "ISO(ISO 123)", <<~XML
|
|
277
|
-
<bibitem id="ISO123">
|
|
278
|
-
<fetched>#{Date.today}</fetched>
|
|
279
|
-
<title>Test</title>
|
|
280
|
-
<date type="published"><on>2019-06-15</on></date>
|
|
281
|
-
</bibitem>
|
|
282
|
-
XML
|
|
283
|
-
end
|
|
284
|
-
|
|
285
|
-
after(:each) { db.clear }
|
|
286
|
-
|
|
287
|
-
it "returns base cached entry when date matches" do
|
|
288
|
-
item = db.send(
|
|
289
|
-
:check_bibliocache, "ISO 123", nil,
|
|
290
|
-
{ publication_date_after: "2019-01-01",
|
|
291
|
-
fetch_db: true }, :relaton_iso
|
|
292
|
-
)
|
|
293
|
-
expect(item).to be_instance_of(Relaton::Iso::ItemData)
|
|
294
|
-
end
|
|
295
|
-
|
|
296
|
-
it "does not return base cached entry when date does not match" do
|
|
297
|
-
item = db.send(
|
|
298
|
-
:check_bibliocache, "ISO 123", nil,
|
|
299
|
-
{ publication_date_after: "2020-01-01",
|
|
300
|
-
fetch_db: true }, :relaton_iso
|
|
301
|
-
)
|
|
302
|
-
expect(item).to be_nil
|
|
303
|
-
end
|
|
304
|
-
end
|
|
305
|
-
|
|
306
|
-
context "class methods" do
|
|
307
|
-
it "::init_bib_caches" do
|
|
308
|
-
expect(FileUtils).to receive(:rm_rf).with(/\/\.relaton\/cache$/)
|
|
309
|
-
expect(FileUtils).to receive(:rm_rf).with(/testcache\/cache$/)
|
|
310
|
-
expect(Relaton::Db).to receive(:new).with(/\/\.relaton\/cache$/,
|
|
311
|
-
/testcache\/cache$/)
|
|
312
|
-
Relaton::Db.init_bib_caches(global_cache: true, local_cache: "testcache",
|
|
313
|
-
flush_caches: true)
|
|
314
|
-
end
|
|
315
|
-
end
|
|
316
|
-
|
|
317
|
-
context "modifing database" do
|
|
318
|
-
let(:db) { Relaton::Db.new "testcache", "testcache2" }
|
|
319
|
-
|
|
320
|
-
before(:each) do
|
|
321
|
-
db.save_entry "ISO(ISO 123)", "<bibitem id='ISO123></bibitem>"
|
|
322
|
-
end
|
|
323
|
-
|
|
324
|
-
context "move to new dir" do
|
|
325
|
-
let(:db) { Relaton::Db.new "global_cache", "local_cache" }
|
|
326
|
-
|
|
327
|
-
after(:each) do
|
|
328
|
-
FileUtils.rm_rf "global_cache"
|
|
329
|
-
FileUtils.rm_rf "local_cache"
|
|
330
|
-
end
|
|
331
|
-
|
|
332
|
-
it "global cache" do
|
|
333
|
-
expect(File.exist?("global_cache")).to be true
|
|
334
|
-
expect(db.mv("testcache")).to eq "testcache"
|
|
335
|
-
expect(File.exist?("testcache")).to be true
|
|
336
|
-
expect(File.exist?("global_cache")).to be false
|
|
337
|
-
end
|
|
338
|
-
|
|
339
|
-
it "local cache" do
|
|
340
|
-
expect(File.exist?("local_cache")).to be true
|
|
341
|
-
expect(db.mv("testcache2", type: :local)).to eq "testcache2"
|
|
342
|
-
expect(File.exist?("testcache2")).to be true
|
|
343
|
-
expect(File.exist?("local_cache")).to be false
|
|
344
|
-
end
|
|
345
|
-
end
|
|
346
|
-
|
|
347
|
-
it "warn if moving in existed dir" do
|
|
348
|
-
expect(File).to receive(:exist?).with("new_cache_dir").and_return true
|
|
349
|
-
allow(File).to receive(:exist?).and_call_original
|
|
350
|
-
expect do
|
|
351
|
-
expect(db.mv("new_cache_dir")).to be_nil
|
|
352
|
-
end.to output(
|
|
353
|
-
/\[relaton\] INFO: target directory exists/,
|
|
354
|
-
).to_stderr_from_any_process
|
|
355
|
-
end
|
|
356
|
-
|
|
357
|
-
it "clear" do
|
|
358
|
-
expect(File.exist?("testcache/iso")).to be true
|
|
359
|
-
expect(File.exist?("testcache2/iso")).to be true
|
|
360
|
-
db.clear
|
|
361
|
-
expect(File.exist?("testcache/iso")).to be false
|
|
362
|
-
expect(File.exist?("testcache2/iso")).to be false
|
|
363
|
-
end
|
|
364
|
-
end
|
|
365
|
-
|
|
366
|
-
context "query in local DB" do
|
|
367
|
-
let(:db) { Relaton::Db.new "testcache", "testcache2" }
|
|
368
|
-
|
|
369
|
-
before(:each) do
|
|
370
|
-
db.save_entry "ISO(ISO 123)", <<~DOC
|
|
371
|
-
<bibitem id='ISO123'>
|
|
372
|
-
<title>The first test</title><edition>2</edition><date type="published"><on>2011-10-12</on></date>
|
|
373
|
-
</bibitem>
|
|
374
|
-
DOC
|
|
375
|
-
db.save_entry "IEC(IEC 123)", <<~DOC
|
|
376
|
-
<bibitem id="IEC123">
|
|
377
|
-
<title>The second test</title><edition>1</edition><date type="published"><on>2015-12</on></date>
|
|
378
|
-
</bibitem>
|
|
379
|
-
DOC
|
|
380
|
-
end
|
|
381
|
-
|
|
382
|
-
after(:each) { db.clear }
|
|
383
|
-
|
|
384
|
-
it "one document" do
|
|
385
|
-
item = db.fetch_db "ISO((ISO 124)"
|
|
386
|
-
expect(item).to be_nil
|
|
387
|
-
item = db.fetch_db "ISO(ISO 123)"
|
|
388
|
-
expect(item).to be_instance_of Relaton::Iso::ItemData
|
|
389
|
-
end
|
|
390
|
-
|
|
391
|
-
it "all documents" do
|
|
392
|
-
items = db.fetch_all
|
|
393
|
-
expect(items.size).to be 2
|
|
394
|
-
expect(items[0]).to be_instance_of Relaton::Iec::ItemData
|
|
395
|
-
expect(items[1]).to be_instance_of Relaton::Iso::ItemData
|
|
396
|
-
end
|
|
397
|
-
|
|
398
|
-
context "search for text" do
|
|
399
|
-
it do
|
|
400
|
-
items = db.fetch_all "test"
|
|
401
|
-
expect(items.size).to eq 2
|
|
402
|
-
items = db.fetch_all "first"
|
|
403
|
-
expect(items.size).to eq 1
|
|
404
|
-
expect(items[0].id).to eq "ISO123"
|
|
405
|
-
end
|
|
406
|
-
|
|
407
|
-
it "with spaces in text" do
|
|
408
|
-
items = db.fetch_all "first test"
|
|
409
|
-
expect(items.size).to eq 1
|
|
410
|
-
expect(items[0].id).to eq "ISO123"
|
|
411
|
-
end
|
|
412
|
-
|
|
413
|
-
it "in attributes" do
|
|
414
|
-
items = db.fetch_all "123"
|
|
415
|
-
expect(items.size).to eq 2
|
|
416
|
-
items = db.fetch_all "ISO"
|
|
417
|
-
expect(items.size).to eq 1
|
|
418
|
-
expect(items[0].id).to eq "ISO123"
|
|
419
|
-
end
|
|
420
|
-
|
|
421
|
-
it "and fail" do
|
|
422
|
-
items = db.fetch_all "bibitem"
|
|
423
|
-
expect(items.size).to eq 0
|
|
424
|
-
end
|
|
425
|
-
|
|
426
|
-
it "and edition" do
|
|
427
|
-
items = db.fetch_all "123", edition: "2"
|
|
428
|
-
expect(items.size).to eq 1
|
|
429
|
-
expect(items[0].id).to eq "ISO123"
|
|
430
|
-
end
|
|
431
|
-
|
|
432
|
-
it "and year" do
|
|
433
|
-
items = db.fetch_all "123", year: 2015
|
|
434
|
-
expect(items.size).to eq 1
|
|
435
|
-
expect(items[0].id).to eq "IEC123"
|
|
436
|
-
end
|
|
437
|
-
end
|
|
438
|
-
end
|
|
439
|
-
|
|
440
|
-
it "returns docid type" do
|
|
441
|
-
db = Relaton::Db.new "testcache", "testcache2"
|
|
442
|
-
expect(db.docid_type("CN(GB/T 1.1)")).to eq ["Chinese Standard", "GB/T 1.1"]
|
|
443
|
-
end
|
|
444
|
-
|
|
445
|
-
context "#fetch" do
|
|
446
|
-
it "doesn't use cache" do
|
|
447
|
-
docid = Relaton::Bib::Docidentifier.new content: "ISO 19115-1",
|
|
448
|
-
type: "ISO"
|
|
449
|
-
item = Relaton::Iso::ItemData.new docid: [docid]
|
|
450
|
-
expect(Relaton::Iso::Bibliography).to receive(:get)
|
|
451
|
-
.with("ISO 19115-1", nil, {}).and_return item
|
|
452
|
-
bib = subject.fetch("ISO 19115-1", nil, {})
|
|
453
|
-
expect(bib).to be_instance_of Relaton::Iso::ItemData
|
|
454
|
-
end
|
|
455
|
-
|
|
456
|
-
it "when no local db", vcr: "iso_19115_1" do
|
|
457
|
-
db = Relaton::Db.new "testcache", nil
|
|
458
|
-
bib = db.fetch("ISO 19115-1", nil, {})
|
|
459
|
-
expect(bib).to be_instance_of Relaton::Iso::ItemData
|
|
460
|
-
end
|
|
461
|
-
|
|
462
|
-
it "document with net retries" do
|
|
463
|
-
registry = subject.instance_variable_get(:@registry)
|
|
464
|
-
expect(registry.processors[:relaton_ietf]).to receive(:get)
|
|
465
|
-
.and_raise(Relaton::RequestError).exactly(3).times
|
|
466
|
-
expect do
|
|
467
|
-
subject.fetch "RFC 8341", nil, retries: 3
|
|
468
|
-
end.to raise_error Relaton::RequestError
|
|
469
|
-
end
|
|
470
|
-
|
|
471
|
-
it "strip reference" do
|
|
472
|
-
expect(subject).to receive(:combine_doc)
|
|
473
|
-
.with("ISO 19115-1", nil, {}, :relaton_iso)
|
|
474
|
-
.and_return :doc
|
|
475
|
-
expect(subject.fetch(" ISO 19115-1 ", nil, {})).to be :doc
|
|
476
|
-
end
|
|
477
|
-
|
|
478
|
-
it "BIPM Meeting", vcr: "cipm_meeting_43" do
|
|
479
|
-
bib = subject.fetch("CIPM Meeting 43")
|
|
480
|
-
expect(bib).to be_instance_of Relaton::Bipm::ItemData
|
|
481
|
-
end
|
|
482
|
-
end
|
|
483
|
-
|
|
484
|
-
it "fetch std", vcr: "iso_19115_1_std" do
|
|
485
|
-
db = Relaton::Db.new "testcache", nil
|
|
486
|
-
bib = db.fetch_std("ISO 19115-1", nil, :relaton_iso, {})
|
|
487
|
-
expect(bib).to be_instance_of Relaton::Iso::ItemData
|
|
488
|
-
end
|
|
489
|
-
|
|
490
|
-
context "async fetch" do
|
|
491
|
-
let(:queue) { Queue.new }
|
|
492
|
-
|
|
493
|
-
it "success" do
|
|
494
|
-
refs = ["ITU-T G.993.5", "ITU-T G.994.1", "ITU-T H.264.1", "ITU-T H.740",
|
|
495
|
-
"ITU-T Y.1911", "ITU-T Y.2012", "ITU-T Y.2206", "ITU-T O.172",
|
|
496
|
-
"ITU-T G.780/Y.1351", "ITU-T G.711", "ITU-T G.1011"]
|
|
497
|
-
results = []
|
|
498
|
-
refs.each do |ref|
|
|
499
|
-
expect(subject).to receive(:fetch).with(ref, nil, {}).and_return :result
|
|
500
|
-
subject.fetch_async(ref) { |r| queue << [r, ref] }
|
|
501
|
-
end
|
|
502
|
-
Timeout.timeout(60) { refs.size.times { results << queue.pop } }
|
|
503
|
-
results.each do |result|
|
|
504
|
-
expect(result[0]).to be :result
|
|
505
|
-
end
|
|
506
|
-
end
|
|
507
|
-
|
|
508
|
-
it "BIPM i18n" do
|
|
509
|
-
refs = ["CGPM -- Resolution (1889)", "CGPM -- Résolution (1889)",
|
|
510
|
-
"CGPM -- Réunion 9 (1948)", "CGPM -- Meeting 9 (1948)"]
|
|
511
|
-
results = []
|
|
512
|
-
refs.each do |ref|
|
|
513
|
-
expect(subject).to receive(:fetch).with(ref, nil, {}).and_return :result
|
|
514
|
-
subject.fetch_async(ref) { |r| queue << [r, ref] }
|
|
515
|
-
end
|
|
516
|
-
Timeout.timeout(60) { refs.size.times { results << queue.pop } }
|
|
517
|
-
results.each do |result|
|
|
518
|
-
expect(result[0]).to be :result
|
|
519
|
-
end
|
|
520
|
-
end
|
|
521
|
-
|
|
522
|
-
it "prefix not found", vcr: "rfc_unsuccess" do
|
|
523
|
-
result = ""
|
|
524
|
-
subject.fetch_async("ABC 123456") { |r| queue << r }
|
|
525
|
-
Timeout.timeout(5) { result = queue.pop }
|
|
526
|
-
expect(result).to be_nil
|
|
527
|
-
end
|
|
528
|
-
|
|
529
|
-
it "handle HTTP request error" do
|
|
530
|
-
expect(subject).to receive(:fetch).and_raise Relaton::RequestError
|
|
531
|
-
subject.fetch_async("ISO REF") { |r| queue << r }
|
|
532
|
-
result = Timeout.timeout(5) { queue.pop }
|
|
533
|
-
expect(result).to be_instance_of Relaton::RequestError
|
|
534
|
-
end
|
|
535
|
-
|
|
536
|
-
it "handle other errors" do
|
|
537
|
-
expect(subject).to receive(:fetch).and_raise Errno::EACCES
|
|
538
|
-
log_io = Relaton.logger_pool[:default].instance_variable_get(:@logdev)
|
|
539
|
-
expect(log_io).to receive(:write).with(
|
|
540
|
-
"[relaton] ERROR: `ISO REF` -- Permission denied\n",
|
|
541
|
-
)
|
|
542
|
-
subject.fetch_async("ISO REF") { |r| queue << r }
|
|
543
|
-
result = Timeout.timeout(5) { queue.pop }
|
|
544
|
-
expect(result).to be_nil
|
|
545
|
-
end
|
|
546
|
-
|
|
547
|
-
it "use threads number from RELATON_FETCH_PARALLEL" do
|
|
548
|
-
expect(ENV).to receive(:[]).with("RELATON_FETCH_PARALLEL").and_return(1)
|
|
549
|
-
allow(ENV).to receive(:[]).and_call_original
|
|
550
|
-
expect(Relaton::WorkersPool).to receive(:new).with(1).and_call_original
|
|
551
|
-
expect(subject).to receive(:fetch).with("ITU-T G.993.5", nil, {})
|
|
552
|
-
subject.fetch_async("ITU-T G.993.5") { |r| queue << r }
|
|
553
|
-
Timeout.timeout(50) { queue.pop }
|
|
554
|
-
end
|
|
555
|
-
end
|
|
556
|
-
end
|