From f347e1d73193cae95273e76a5684e17bc1ad44bc Mon Sep 17 00:00:00 2001 From: Kristina Spurgin Date: Fri, 15 Jan 2021 19:34:38 -0500 Subject: [PATCH] use ruby 2.7.2 --- .ruby-version | 2 +- collectionspace-mapper.gemspec | 2 ++ doc/setup_for_development.adoc | 2 +- lib/collectionspace/mapper/tools/dates.rb | 10 ++++++++-- lib/collectionspace/mapper/version.rb | 2 +- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.ruby-version b/.ruby-version index 952f449f..fbafd6b6 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.6.6 \ No newline at end of file +2.7.2 \ No newline at end of file diff --git a/collectionspace-mapper.gemspec b/collectionspace-mapper.gemspec index 1dfc7a9d..72d224ee 100644 --- a/collectionspace-mapper.gemspec +++ b/collectionspace-mapper.gemspec @@ -13,6 +13,8 @@ Gem::Specification.new do |spec| spec.homepage = 'https://github.com/lyrasis/collectionspace-mapper' spec.license = 'MIT' + spec.required_ruby_version = '>= 2.7.2' + # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host' # to allow pushing to a single host or delete this section to allow pushing to any host. if spec.respond_to?(:metadata) diff --git a/doc/setup_for_development.adoc b/doc/setup_for_development.adoc index db52f41d..00d72850 100644 --- a/doc/setup_for_development.adoc +++ b/doc/setup_for_development.adoc @@ -1,6 +1,6 @@ = Setting up for development work -- You will need Ruby 2.6.6 in your development environment. (I recommend using https://rvm.io/[Ruby Version Manager (rvm)] to manage your Ruby development environment.) +- You will need Ruby 2.7.2 in your development environment. (I recommend using https://rvm.io/[Ruby Version Manager (rvm)] to manage your Ruby development environment.) - Do `bundle --version` - If the version of Bundler is lower than 2.1.2, do `gem update bundler` ** Bundler should come standard with Ruby 2.6.6, but I believe it comes by default with an older version. If you get an error that you don't have Bundler installed when you try to check the version, do `gem install bundler` diff --git a/lib/collectionspace/mapper/tools/dates.rb b/lib/collectionspace/mapper/tools/dates.rb index 2e7dee10..b2247136 100644 --- a/lib/collectionspace/mapper/tools/dates.rb +++ b/lib/collectionspace/mapper/tools/dates.rb @@ -44,7 +44,10 @@ def initialize(date_string, client, cache, config) '^\d{1,2}[-\/]\d{4}$' ].map{ |f| Regexp.new(f) } - if date_formats.any?{ |re| @date_string.match?(re) } + if date_string == '%NULLVALUE%' + + elsif + date_formats.any?{ |re| @date_string.match?(re) } try_chronic_parse(@date_string) @timestamp ? create_mappable_date : try_services_query elsif two_digit_year_date_formats.any?{ |re| @date_string.match?(re) } @@ -90,6 +93,10 @@ def try_chronic_parse(string) @timestamp = Chronic.parse(string) end end + + def create_mappable_passthrough + @mappable['dateDisplayDate'] = @date_string + end def create_mappable_date date = @timestamp.to_date @@ -157,7 +164,6 @@ def try_services_query end def fix_services_scalars(services_result) - # binding.pry new_hash = {} services_result.each do |k, v| if k.end_with?('ScalarValue') diff --git a/lib/collectionspace/mapper/version.rb b/lib/collectionspace/mapper/version.rb index dba3bdca..c14f6e29 100644 --- a/lib/collectionspace/mapper/version.rb +++ b/lib/collectionspace/mapper/version.rb @@ -1,5 +1,5 @@ module CollectionSpace module Mapper - VERSION = "2.0.1" + VERSION = "2.1.0" end end