krikri 0.10.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/krikri/_qa_report_list.html.erb~ +10 -0
- data/app/controllers/krikri/concerns/provider_context.rb~ +7 -0
- data/app/controllers/krikri/qa_reports_controller.rb~ +18 -0
- data/app/models/krikri/original_record_desc.rb~ +6 -0
- data/app/models/krikri/original_record_metadata.rb~ +9 -0
- data/app/models/krikri/parser.rb~ +5 -0
- data/app/models/krikri/parsers/xml_parser.rb~ +5 -0
- data/app/models/krikri/qa_report.rb~ +7 -0
- data/app/views/krikri/qa_reports/index.html.erb~ +3 -0
- data/app/views/krikri/qa_reports/show.html.erb~ +1 -0
- data/config/initializers/config.rb~ +19 -0
- data/config/settings/test.yml~ +3 -0
- data/db/migrate/20150328035550_add_qa_report.rb~ +11 -0
- data/lib/krikri/ldp/container.rb~ +22 -0
- data/lib/krikri/ldp/nr_source.rb~ +4 -0
- data/lib/krikri/ldp/rdf_source.rb~ +24 -0
- data/lib/krikri/ldp/resource.rb~ +49 -0
- data/lib/krikri/map_crosswalk.rb +1 -1
- data/lib/krikri/parsers/json_parser.rb~ +17 -0
- data/lib/krikri/parsers/oai_headers.rb~ +4 -0
- data/lib/krikri/parsers/oai_parser.rb~ +2 -0
- data/lib/krikri/parsers/oai_parser_headers.rb~ +4 -0
- data/lib/krikri/parsers/xml_parser.rb~ +61 -0
- data/lib/krikri/util/edtf_converter.rb~ +26 -0
- data/lib/krikri/util/extended_date_parser.rb~ +70 -0
- data/lib/krikri/version.rb +1 -1
- data/lib/tasks/jetty.rake~ +12 -0
- data/lib/tasks/krikri.rake~ +20 -0
- data/spec/controllers/application_controller_spec.rb~ +11 -0
- data/spec/controllers/qa_reports_controller_spec.rb~ +15 -0
- data/spec/controllers/records_controller_spec.rb~ +11 -0
- data/spec/controllers/reports_controller_spec.rb~ +6 -0
- data/spec/controllers/validation_reports_controller_spec.rb~ +15 -0
- data/spec/factories/krikri_original_record.rb~ +5 -0
- data/spec/factories/krikri_provider.rb~ +7 -0
- data/spec/factories/krikri_provider_spec.rb~ +7 -0
- data/spec/factories/krikri_qa_report.rb~ +8 -0
- data/spec/helpers/krikri/application_helper_spec.rb~ +16 -0
- data/spec/internal/Gemfile +2 -3
- data/spec/internal/Gemfile.lock +120 -143
- data/spec/internal/config/initializers/blacklight_initializer.rb +1 -1
- data/spec/internal/config/initializers/devise.rb +2 -2
- data/spec/internal/config/secrets.yml +2 -2
- data/spec/internal/db/development.sqlite3 +0 -0
- data/spec/internal/db/migrate/{20150812153900_devise_create_users.rb → 20151222175607_devise_create_users.rb} +0 -0
- data/spec/internal/db/migrate/{20150812153941_create_searches.blacklight.rb → 20151222175629_create_searches.blacklight.rb} +0 -0
- data/spec/internal/db/migrate/{20150812153942_create_bookmarks.blacklight.rb → 20151222175630_create_bookmarks.blacklight.rb} +0 -0
- data/spec/internal/db/migrate/{20150812153943_add_polymorphic_type_to_bookmarks.blacklight.rb → 20151222175631_add_polymorphic_type_to_bookmarks.blacklight.rb} +0 -0
- data/spec/internal/db/schema.rb +1 -1
- data/spec/internal/db/test.sqlite3 +0 -0
- data/spec/internal/db/test.sqlite3-journal +0 -0
- data/spec/internal/lib/generators/test_app_generator.rb~ +14 -0
- data/spec/internal/log/development.log +93 -93
- data/spec/internal/log/test.log +4313 -6427
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_alerts.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_background-variant.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_border-radius.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_buttons.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_center-block.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_clearfix.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_forms.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_gradients.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_grid-framework.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_grid.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_hide-text.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_image.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_labels.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_list-group.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_nav-divider.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_nav-vertical-align.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_opacity.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_pagination.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_panels.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_progress-bar.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_reset-filter.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_resize.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_responsive-visibility.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_size.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_tab-focus.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_table-row.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_text-emphasis.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_text-overflow.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_vendor-prefixes.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{0f463fae8ec59cbdc602859dac6f3131b47588e5 → 93e201cf4a11978a1f491a057a3bd569c3825210}/blacklight.css.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_alerts.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_badges.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_breadcrumbs.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_button-groups.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_buttons.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_carousel.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_close.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_code.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_component-animations.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_dropdowns.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_forms.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_glyphicons.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_grid.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_input-groups.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_jumbotron.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_labels.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_list-group.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_media.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_mixins.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_modals.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_navbar.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_navs.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_normalize.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_pager.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_pagination.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_panels.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_popovers.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_print.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_progress-bars.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_responsive-embed.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_responsive-utilities.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_scaffolding.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_tables.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_thumbnails.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_tooltip.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_type.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_utilities.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_variables.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_wells.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{c50f52d2eeadabb7c9bfad3246524fac09113575 → b28605b1c659cf09fc72f3c1fff32918869d28b8}/_bootstrap-sprockets.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{c50f52d2eeadabb7c9bfad3246524fac09113575 → b28605b1c659cf09fc72f3c1fff32918869d28b8}/_bootstrap.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{80ea3b25063dd984130d99a1c4278f3cd1b013f1 → ca8c12d03785e0d6cd4554f4d3939e7836d38282}/_blacklight_base.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/{80ea3b25063dd984130d99a1c4278f3cd1b013f1 → ca8c12d03785e0d6cd4554f4d3939e7836d38282}/blacklight.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/4052820c15af72ba690230a0f92bd75e +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/496a0d7dce1ff6bf4a9c3a089ea3a635 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/50b9db0b908b421a9b941a445dbaeacc +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/528c628cf107f8be6dd122e1154344be +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/8edfca9082e02111be92e79000667f22 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/90b54a819800edfa41b67722d1561040 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/9c653367feff82588eb6041d783a5809 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/b35e12934e9f05662777579549e31cd7 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/bb108ef3fc4c96d1c20cc41f97d943a0 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/dbba4bbc32c17ade3d618c5d0baeb371 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/e9f7ccc553ce1a217709cc7a08cfb032 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/f274b5f22db177b6464b50691d531688 +0 -0
- data/spec/krikri_spec.rb~ +30 -0
- data/spec/ldp/active_triples_spec.rb~ +15 -0
- data/spec/ldp/at_resource_spec.rb~ +41 -0
- data/spec/ldp/nr_source_spec.rb~ +3 -0
- data/spec/ldp/rdf_source_spec.rb~ +4 -0
- data/spec/ldp/resource_spec.rb~ +49 -0
- data/spec/lib/krikri/enrichment_agent_spec.rb~ +4 -0
- data/spec/lib/krikri/harvesters/api_harvester_spec.rb~ +47 -0
- data/spec/lib/krikri/harvesters/basic_save_behavior_spec.rb~ +12 -0
- data/spec/lib/krikri/harvesters/file_harvester_spec.rb~ +3 -0
- data/spec/lib/krikri/harvesters/harvest_behavior_spec.rb~ +5 -0
- data/spec/lib/krikri/harvesters/mdl_api_harvester_spec.rb~ +11 -0
- data/spec/lib/krikri/harvesters/mdl_harvester_spec.rb~ +8 -0
- data/spec/lib/krikri/harvesters/oai_skip_deleted_behavior.rb~ +7 -0
- data/spec/lib/krikri/harvesters/oai_skip_deleted_behavior_spec.rb~ +15 -0
- data/spec/lib/krikri/id_service_spec.rb~ +3 -0
- data/spec/lib/krikri/job_spec.rb~ +13 -0
- data/spec/lib/krikri/map_crosswalk_spec.rb +23 -0
- data/spec/lib/krikri/map_crosswalk_spec.rb~ +5 -0
- data/spec/lib/krikri/mapper_agent_spec.rb~ +64 -0
- data/spec/lib/krikri/mapper_spec.rb~ +5 -0
- data/spec/lib/krikri/mapping_dsl/parser_methods_spec.rb~ +65 -0
- data/spec/lib/krikri/mapping_dsl/property_declaration_spec.rb~ +87 -0
- data/spec/lib/krikri/mapping_dsl/rdf_subjects_spec.rb~ +16 -0
- data/spec/lib/krikri/mapping_dsl_spec.rb~ +10 -0
- data/spec/lib/krikri/mapping_job.rb~ +12 -0
- data/spec/lib/krikri/mapping_job_spec.rb~ +11 -0
- data/spec/lib/krikri/mapping_spec.rb~ +5 -0
- data/spec/lib/krikri/md5_minter_spec.rb~ +5 -0
- data/spec/lib/krikri/parser_value_array.rb~ +5 -0
- data/spec/lib/krikri/parsers/json_parser_spec.rb~ +17 -0
- data/spec/lib/krikri/parsers/xml_parser_spec.rb~ +21 -0
- data/spec/lib/krikri/provenance_query_client.rb~ +5 -0
- data/spec/lib/krikri/provenance_query_client_spec.rb~ +8 -0
- data/spec/lib/krikri/qa_query_client_spec.rb~ +9 -0
- data/spec/lib/krikri/random_search_index_docmument_builder_spec.rb~ +6 -0
- data/spec/lib/krikri/util/edtf_converter_spec.rb~ +17 -0
- data/spec/lib/krikri/util/extended_date_parser_spec.rb~ +102 -0
- data/spec/models/activity_spec.rb~ +41 -0
- data/spec/models/dpla/map/aggregation_spec.rb~ +67 -0
- data/spec/models/harvesters/oai_harvester_spec.rb~ +15 -0
- data/spec/models/mapper_spec.rb~ +5 -0
- data/spec/models/original_record_metadata_spec.rb~ +5 -0
- data/spec/models/original_record_spec.rb~ +5 -0
- data/spec/models/provider_spec.rb~ +33 -0
- data/spec/models/qa_report_spec.rb~ +64 -0
- data/spec/models/validation_report_spec.rb~ +15 -0
- data/spec/support/shared_contexts/indexed_item.rb~ +15 -0
- data/spec/support/shared_contexts/mapping_dsl.rb~ +12 -0
- data/spec/support/shared_contexts/provenance_query_client.rb~ +6 -0
- data/spec/support/shared_contexts/rake.rb~ +21 -0
- data/spec/support/shared_examples/enrichment.rb~ +5 -0
- data/spec/support/shared_examples/harvest_behavior.rb~ +13 -0
- data/spec/support/shared_examples/job.rb~ +20 -0
- data/spec/support/shared_examples/ldp_resource.rb~ +4 -0
- data/spec/support/shared_examples/oai_parser_headers.rb~ +12 -0
- data/spec/support/shared_examples/rdf_source.rb~ +1 -0
- data/spec/support/shared_examples/software_agent.rb~ +5 -0
- data/spec/support/shared_examples/string_enrichment.rb~ +12 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb~ +14 -0
- data/spec/views/krikri/providers/index.html.erb_spec.rb~ +3 -0
- data/spec/views/krikri/providers/show.html.erb.spec~ +12 -0
- data/spec/views/krikri/providers/show.html.erb_spec.rb~ +10 -0
- data/spec/views/krikri/qa_reports/index.html.erb_spec.rb~ +17 -0
- data/spec/views/krikri/qa_reports/show.html.erb_spec.rb~ +22 -0
- data/spec/views/krikri/records/index.html.erb_spec.rb~ +15 -0
- data/spec/views/krikri/records/show.html.erb_spec.rb~ +8 -0
- data/spec/views/krikri/reports/index.html.erb_spec.rb~ +5 -0
- data/spec/webmocks/oai.rb~ +13 -0
- metadata +516 -458
- data/spec/internal/tmp/cache/318/301/krikri%2Fapplication_helper%2Favailable_providers +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/80ea3b25063dd984130d99a1c4278f3cd1b013f1/_bookmark.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/80ea3b25063dd984130d99a1c4278f3cd1b013f1/_catalog.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/80ea3b25063dd984130d99a1c4278f3cd1b013f1/_facets.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/80ea3b25063dd984130d99a1c4278f3cd1b013f1/_group.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/80ea3b25063dd984130d99a1c4278f3cd1b013f1/_header.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/80ea3b25063dd984130d99a1c4278f3cd1b013f1/_layout.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/80ea3b25063dd984130d99a1c4278f3cd1b013f1/_modal.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/80ea3b25063dd984130d99a1c4278f3cd1b013f1/_search_history.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/80ea3b25063dd984130d99a1c4278f3cd1b013f1/blacklight_defaults.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/0a25eb99290a6b015dfe4c29d8585cec +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/0b3eca32a0c1d368e88a01be94ca7f6b +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/0fe9919db7899ede10068d0d9d3adfa8 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/1153a153512ddd535004623e0bbdc1c4 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/142790b68ce01969e4bbdd1d2a90b18c +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/154af7ce6de6c616d3c1c654904a88de +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/1a6f0128e8b6cc52594e7e16506dd476 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/30183a6c313ab79c8ffc2711dc633ea5 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/3290971c05649c7d11051df70b2fefbb +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/35c0cb4e1848557e53960891cf2bbc4c +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/3822d8965af2c63a9d8eb5be7d54a39e +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/39191bda3ba14fb0d5671ef5320e9e01 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/3a1636e712ea5450451f140a1e11ad6b +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/3af50e8108914b16e8005270444c23eb +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/3be5d7c0f4c216492f0aa28be003d004 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/43549442460e63625bfa01b300845db4 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/4aca32864569722d64f0355ab5dc65bb +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/4b2cab71b255f0bf4e45a6e317974ed0 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/4ffa695d373f85c9375cfeef7a7fa7b0 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/55c96cfe875a998dd83f861cec024cd8 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/5884f169a3cb492a556b12cf26d98512 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/5b4c0893fb6462116b5c893ee5067a7a +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/5ed91405d3e1d9c4d64964b23e2ddad5 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/5ee4ec5587fe5e6b2489c6df8444c3a3 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/66bc87f66d912cc874b361b58b063232 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/6a7000430a188e026e888de506892486 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/6e51639f97de2a9999b40c947cc2cce4 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/70678ea30b446b6e43c58cb504a38c5e +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/736b38c683d67eae78becf8bd03ccc03 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/74b2a1c32eb911fede6dbf691e2438fd +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/769e239a980f02fb5f0d31f2e47661b6 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/7ed2a89adfb413f382b9844cb60e004f +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/86aa4bb34763ef2ec398ce2948064feb +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/8e0a985f6d848652e6e2b69502089957 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/8e24ef751a813d86a3a2953ce9f31b1b +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/92440cff8e26faca6421a88212bf5cc5 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/93aaa9231a32901266b05632f3d35ecd +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/9aa82f96c9760fb5b052b29dfead27ee +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/9e3583b4a24bbae71c81cc89b31cf681 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/ad4a54c43c2a4c3874bfde1c9f08c248 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/addcc05c958d32994bbcc4df6b13c80a +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/b6fcc8843d7d36abc9183de7f3c09fdd +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/b783bb7bbb5960da9c2720974804b177 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/c94aa024045ec61aa3ce4de5c0ca7515 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/d04cedd870a36cb0ac8ad65bf032c556 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/d0ae540226d860c35ce84f64c67f40bb +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/d0d4fb263d72afa8341801f74e58939e +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/d54a9568f2db6442d0be17210a6d683e +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/d89eec758f13f7959ed8796e9b52469c +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/da16a797f7553f717a002525bea10cbf +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/da4e9efddf7d52d8de0c75b2f3ad571e +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/dec30531a16449cd84734053a70b3a77 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/f429314ed6a6b2b42d3141578c4ec023 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/f5e21f9266ec8eafa27c52d109a9a498 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/f642847460097a56a55c8716c4d7a072 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/f69f1290f72a81d63fb93e81ff44f8a1 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/f6dee0958594a314ea8f9a82a48c2a45 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/f8e9e8fcc081081c00dd69903ebcf709 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/f8fd1a8d086eb31f0df8de2ac3ab4517 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/fe00102a3b27990f149d71a23f06e32a +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fc07861777f021a9d02ccb7c9be507cd7f8681d
|
4
|
+
data.tar.gz: 894be25e402c7aea81b7f82708ee8971e86bf97f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9ef1dc88f88c4ac8e2ae167758549309c79b0332a29bad230d199fcc9518c03c07832900a51eed2e497b7283b1725c113c6e4080ee805303a7b1bb26370f7d5
|
7
|
+
data.tar.gz: 26b4f8a38a3bf313e8b2fce1a35474feb3fd19b6fe401817f05f98948b4ac99dae8d466134ae1c31f163facd1c7add886a5e8d67ab1d110659f5398f754efabe
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<h3>Validation Reports</h3>
|
2
|
+
<% if @validation_reports %>
|
3
|
+
<ul>
|
4
|
+
<% @validation_reports.each do |validation_report| %>
|
5
|
+
<li><%= render_validation_report(validation_report) %></li>
|
6
|
+
<% end %>
|
7
|
+
</ul>
|
8
|
+
<% else %>
|
9
|
+
<div>There was an error generating the QA reports.</div>
|
10
|
+
<% end %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Krikri
|
2
|
+
##
|
3
|
+
# Handles HTTP requests for QA Reports
|
4
|
+
class QAReportsController < ApplicationController
|
5
|
+
include Concerns::ProviderContext
|
6
|
+
|
7
|
+
before_action :authenticate_user!, :set_current_provider
|
8
|
+
|
9
|
+
def show
|
10
|
+
require 'pry'
|
11
|
+
binding.pry
|
12
|
+
respond_to do |format|
|
13
|
+
format.html
|
14
|
+
format.csv { render csv: 'test' }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<% # krikri/institutions/show %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
setting_files = [self.root.join('config', 'settings.yml'),
|
2
|
+
self.root.join('config', 'settings', "#{Rails.env}.yml"),
|
3
|
+
self.root.join('config', 'environments', "#{Rails.env}.yml"),
|
4
|
+
self.root.join('config', 'settings.local.yml'),
|
5
|
+
self.root.join('config', 'settings', "#{Rails.env}.local.yml"),
|
6
|
+
self.root.join('config', 'environments',
|
7
|
+
"#{Rails.env}.local.yml")
|
8
|
+
].map { |path| path.to_s }
|
9
|
+
|
10
|
+
settings_const = Kernel.const_get(RailsConfig.const_name)
|
11
|
+
|
12
|
+
source_paths = settings_const.add_source!('nil')[0..-2].map do |source|
|
13
|
+
source.path
|
14
|
+
end
|
15
|
+
|
16
|
+
source_paths = setting_files + source_paths
|
17
|
+
|
18
|
+
RailsConfig.load_and_set_settings(source_paths)
|
19
|
+
Krikri::Settings = Kernel.const_get(RailsConfig.const_name)
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Krikri::LDP
|
2
|
+
class Container < ActiveTriples::Resource
|
3
|
+
include Krikri::LDP::Resource
|
4
|
+
|
5
|
+
configure :type => RDF::URI('http://www.w3.org/ns/ldp#Container')
|
6
|
+
|
7
|
+
def initialize(uri, slug)
|
8
|
+
@ldp_uri = uri
|
9
|
+
@container_slug = slug
|
10
|
+
super("#{uri}/#{slug}")
|
11
|
+
end
|
12
|
+
|
13
|
+
def save(body = nil, opts = {})
|
14
|
+
opts[:Link] = "<#{type.first.to_s}>; rel='type'"
|
15
|
+
opts[:Slug] = @container_slug
|
16
|
+
opts[:method] = :post unless exists?
|
17
|
+
body ||= (dump :ttl)
|
18
|
+
opts['Content-Type'] ||= 'text/turtle'
|
19
|
+
super(body, opts)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Krikri::LDP
|
2
|
+
module RdfSource
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
include Krikri::LDP::Resource
|
5
|
+
|
6
|
+
def save(headers = {})
|
7
|
+
result = super(dump(:ttl))
|
8
|
+
get
|
9
|
+
result
|
10
|
+
end
|
11
|
+
|
12
|
+
def get(*args)
|
13
|
+
result = super
|
14
|
+
reload
|
15
|
+
result
|
16
|
+
end
|
17
|
+
|
18
|
+
def reload
|
19
|
+
return super unless !node? && exists?
|
20
|
+
clear
|
21
|
+
self << RDF::Reader.for(:ttl).new(@http_cache.body).statements
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'faraday_middleware'
|
3
|
+
|
4
|
+
module Krikri::LDP
|
5
|
+
module Resource
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
attr_accessor :rdf_subject, :connection_uri
|
9
|
+
|
10
|
+
def ldp_connection
|
11
|
+
@ldp_conn ||= Faraday.new(connection_uri) do |conn|
|
12
|
+
conn.use Faraday::Response::RaiseError
|
13
|
+
conn.use FaradayMiddleware::FollowRedirects, limit: 3
|
14
|
+
conn.adapter Faraday.default_adapter
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def etag
|
19
|
+
http_head.env['response_headers']['etag']
|
20
|
+
end
|
21
|
+
|
22
|
+
def http_head
|
23
|
+
raise 'No subject set for LDP resource.' if rdf_subject.nil?
|
24
|
+
@http_cache ||= ldp_connection.head { |request| request.url rdf_subject }
|
25
|
+
end
|
26
|
+
|
27
|
+
def exists?
|
28
|
+
return true if rdf_subject && http_head
|
29
|
+
false
|
30
|
+
rescue Faraday::ResourceNotFound
|
31
|
+
false
|
32
|
+
end
|
33
|
+
|
34
|
+
def save(uri, body = nil, opts = {})
|
35
|
+
require 'pry'
|
36
|
+
binding.pry
|
37
|
+
create(uri, body, opts)
|
38
|
+
end
|
39
|
+
|
40
|
+
def create(uri, body = nil, opts = {})
|
41
|
+
response = ldp_connection.post do |request|
|
42
|
+
request.url uri
|
43
|
+
request.headers = opts if opts
|
44
|
+
request.body = body
|
45
|
+
end
|
46
|
+
response
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/lib/krikri/map_crosswalk.rb
CHANGED
@@ -218,7 +218,7 @@ module Krikri
|
|
218
218
|
place = {}
|
219
219
|
place[:name] = source.label.first if source.label.any?
|
220
220
|
place[:name] ||= source.providedLabel.first if source.providedLabel.any?
|
221
|
-
place[:coordinates] = "#{source.lat}, #{source.long}" if
|
221
|
+
place[:coordinates] = "#{source.lat.first}, #{source.long.first}" if
|
222
222
|
source.lat.any? && source.long.any?
|
223
223
|
place.any? ? place : nil
|
224
224
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Krikri
|
2
|
+
##
|
3
|
+
# A parser for JSON records
|
4
|
+
# @see Krikri::Parser
|
5
|
+
class JsonParser < Krikri::Parser
|
6
|
+
def initialize(record)
|
7
|
+
@root = Value.new(JSON.parse(record.content))
|
8
|
+
super
|
9
|
+
end
|
10
|
+
|
11
|
+
class Value < Krikri::Parser::Value
|
12
|
+
def initialize(json)
|
13
|
+
@json = json
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module Krikri
|
2
|
+
##
|
3
|
+
# An XmlParser
|
4
|
+
# @see Krikri::Parser
|
5
|
+
class XmlParser < Krikri::Parser
|
6
|
+
def initialize(record, root_path = '/')
|
7
|
+
xml = Nokogiri::XML(record.to_s)
|
8
|
+
ns = namespaces_from_xml(xml)
|
9
|
+
@root = Value.new(xml.at_xpath(root_path, ns), ns)
|
10
|
+
super(record)
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def namespaces_from_xml(xml)
|
16
|
+
namespaces = xml.collect_namespaces.map do |k, v|
|
17
|
+
[k.gsub('xmlns:', ''), v]
|
18
|
+
end
|
19
|
+
namespaces.to_h
|
20
|
+
end
|
21
|
+
|
22
|
+
##
|
23
|
+
# An XML Parser Value node class
|
24
|
+
# @see Krikri::Parser::Value
|
25
|
+
class Value < Krikri::Parser::Value
|
26
|
+
def initialize(node, namespaces)
|
27
|
+
node = node.root if node.xml?
|
28
|
+
@node = node
|
29
|
+
@namespaces = namespaces
|
30
|
+
end
|
31
|
+
|
32
|
+
delegate :attributes, :xpath, :at_xpath, :css, :at_css, :to => :@node
|
33
|
+
|
34
|
+
def children
|
35
|
+
@node.element_children.map do |child|
|
36
|
+
return child.name unless child.namespace
|
37
|
+
"#{@namespaces.key(child.namespace.href)}:#{child.name}"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def values
|
42
|
+
select_values.map(&:text)
|
43
|
+
end
|
44
|
+
|
45
|
+
def values?
|
46
|
+
!select_values.empty?
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def get_child_nodes(name)
|
52
|
+
@node.xpath("#{@node.path}/#{name}", @namespaces)
|
53
|
+
.map { |node| self.class.new(node, @namespaces) }
|
54
|
+
end
|
55
|
+
|
56
|
+
def select_values
|
57
|
+
@node.children.select(&:text?)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Krikri::Util
|
2
|
+
module ExtendedDateParser
|
3
|
+
|
4
|
+
##
|
5
|
+
# e.g. 1990s or 199- or 199x
|
6
|
+
def decade(str)
|
7
|
+
decade
|
8
|
+
end
|
9
|
+
|
10
|
+
##
|
11
|
+
# e.g. 1990s
|
12
|
+
def decade_s(str)
|
13
|
+
/^(\d{3})0s$/.match(str) do |m|
|
14
|
+
Date.edtf("#{m[1]}x")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
##
|
19
|
+
# e.g. 199-
|
20
|
+
def decade_hyphen(str)
|
21
|
+
/^(\d{3})-$/.match(str) do |m|
|
22
|
+
Date.edtf("#{m[1]}x")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Krikri::Util
|
2
|
+
module ExtendedDateParser
|
3
|
+
module_function
|
4
|
+
|
5
|
+
def parse(date_str)
|
6
|
+
date = Date.edtf(date_str)
|
7
|
+
date ||= partial_edtf(date_str)
|
8
|
+
date ||= decade_hyphen(date_str)
|
9
|
+
date ||= month_year(date_str)
|
10
|
+
date ||= decade_s(date_str)
|
11
|
+
date ||= hyphenated_partial_range(date_str)
|
12
|
+
date ||= begin
|
13
|
+
Date.parse(date_str)
|
14
|
+
rescue ArgumentError
|
15
|
+
nil
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def range_match(str)
|
20
|
+
regexp = %r{
|
21
|
+
([\d\-\.xu\?\~]*\d{4}[\d\-\.xu\?\~]*)
|
22
|
+
\s*[-\.]+\s*
|
23
|
+
([\d\-\.xu\?\~]*\d{4}[\d\.\-xu\?\~]*)
|
24
|
+
}x
|
25
|
+
regexp.match(str) do |m|
|
26
|
+
[m[1], m[2]]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
##
|
31
|
+
# e.g. 01-2045
|
32
|
+
def month_year(str)
|
33
|
+
/(\d{2})-(\d{4})/.match(str) do |m|
|
34
|
+
Date.edtf("#{m[2]}-#{m[1]}")
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
##
|
39
|
+
# e.g. 1990-92
|
40
|
+
def hyphenated_partial_range(str)
|
41
|
+
/^(\d{2})(\d{2})-(\d{2})$/.match(str) do |m|
|
42
|
+
Date.edtf("#{m[1]}#{m[2]}/#{m[1]}#{m[3]}")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
##
|
47
|
+
# e.g. 1970-08-01/02 or 1970-12/10
|
48
|
+
def partial_edtf(str)
|
49
|
+
/^(\d{4}(-\d{2})*)-(\d{2})\/(\d{2})$/.match(str) do |m|
|
50
|
+
Date.edtf("#{m[1]}-#{m[3]}/#{m[1]}-#{m[4]}")
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
##
|
55
|
+
# e.g. 1990s
|
56
|
+
def decade_s(str)
|
57
|
+
/^(\d{3})0s$/.match(str) do |m|
|
58
|
+
Date.edtf("#{m[1]}x")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
##
|
63
|
+
# e.g. 199-
|
64
|
+
def decade_hyphen(str)
|
65
|
+
/^(\d{3})-$/.match(str) do |m|
|
66
|
+
Date.edtf("#{m[1]}x")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|