Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
inherit_gem:
almost_standard: .rubocop.yml
AllCops:
TargetRubyVersion: 3.4
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.6
3.4.1
6 changes: 5 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ gem "collectionspace-client",
github: "collectionspace/collectionspace-client",
branch: "main"

gem "collectionspace-refcache",
github: "collectionspace/collectionspace-refcache",
branch: "data-toolkit"

gem "almost_standard",
github: "kspurgin/almost_standard",
tag: "1.0.0",
tag: "1.0.1",
group: :development

gemspec
172 changes: 102 additions & 70 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,21 @@ GIT
json
nokogiri

GIT
remote: https://github.com/collectionspace/collectionspace-refcache.git
revision: a95d1aa80a7a4c3cdb899ac52fc99aadb7debb97
branch: data-toolkit
specs:
collectionspace-refcache (1.0.1)
redis (~> 4.2.1)
zache (~> 0.12.0)

GIT
remote: https://github.com/kspurgin/almost_standard.git
revision: 418bea721ba1c0144d55f2588a4120c1eb4d4b1c
tag: 1.0.0
revision: 2778fd70246404e9f285a1a41eff3099cdade9ff
tag: 1.0.1
specs:
almost_standard (1.0.0)
almost_standard (1.0.1)
bundler
rubocop
rubocop-rspec
Expand All @@ -23,11 +32,10 @@ PATH
remote: .
specs:
collectionspace-mapper (6.2.0)
activesupport (= 6.0.4.7)
activesupport
chronic
collectionspace-refcache
dry-configurable (~> 0.14)
dry-monads (~> 1.4)
dry-configurable
dry-monads
memo_wise
net-http
nokogiri
Expand All @@ -37,30 +45,40 @@ PATH
GEM
remote: https://rubygems.org/
specs:
activesupport (6.0.4.7)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
activesupport (8.0.2)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
uri (>= 0.13.1)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
ast (2.4.3)
base64 (0.2.0)
benchmark (0.4.0)
bigdecimal (3.1.9)
chronic (0.10.2)
coderay (1.1.3)
collectionspace-refcache (1.0.0)
redis (~> 4.2.1)
zache (~> 0.12.0)
concurrent-ruby (1.2.2)
crack (0.4.5)
concurrent-ruby (1.3.5)
connection_pool (2.5.0)
crack (1.0.0)
bigdecimal
rexml
csv (3.3.5)
debug (1.8.0)
irb (>= 1.5.0)
reline (>= 0.3.1)
date (3.4.1)
diff-lcs (1.6.2)
docile (1.4.0)
debug (1.10.0)
irb (~> 1.10)
reline (>= 0.3.8)
docile (1.4.1)
drb (2.2.1)
dry-configurable (0.16.1)
dry-core (~> 0.6)
zeitwerk (~> 2.6)
Expand All @@ -71,51 +89,59 @@ GEM
concurrent-ruby (~> 1.0)
dry-core (~> 0.9, >= 0.9)
zeitwerk (~> 2.6)
hashdiff (1.0.1)
hashdiff (1.1.2)
httparty (0.23.1)
csv
mini_mime (>= 1.0.0)
multi_xml (>= 0.5.2)
i18n (1.12.0)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
io-console (0.6.0)
irb (1.8.0)
rdoc (~> 6.5)
reline (>= 0.3.6)
json (2.6.3)
language_server-protocol (3.17.0.3)
io-console (0.8.0)
irb (1.15.2)
pp (>= 0.6.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.10.2)
language_server-protocol (3.17.0.4)
lint_roller (1.1.0)
logger (1.7.0)
memo_wise (1.11.0)
method_source (1.1.0)
mini_mime (1.1.5)
minitest (5.18.0)
multi_xml (0.6.0)
minitest (5.25.5)
multi_xml (0.7.1)
bigdecimal (~> 3.1)
net-http (0.6.0)
uri
nokogiri (1.17.2-x86_64-darwin)
nokogiri (1.18.7-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.17.2-x86_64-linux)
nokogiri (1.18.7-x86_64-linux-gnu)
racc (~> 1.4)
parallel (1.26.3)
parser (3.3.4.2)
parser (3.3.7.4)
ast (~> 2.4.1)
racc
pp (0.6.2)
prettyprint
prettyprint (0.2.0)
prism (1.4.0)
pry (0.15.2)
coderay (~> 1.1)
method_source (~> 1.0)
psych (5.1.0)
psych (5.2.3)
date
stringio
public_suffix (5.0.1)
public_suffix (6.0.1)
racc (1.8.1)
rainbow (3.1.1)
rdoc (6.5.0)
rdoc (6.13.1)
psych (>= 4.0.0)
redis (4.2.5)
regexp_parser (2.9.2)
reline (0.3.8)
regexp_parser (2.10.0)
reline (0.6.1)
io-console (~> 0.5)
rexml (3.2.6)
rspec (3.13.1)
rexml (3.4.1)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
Expand All @@ -128,58 +154,63 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.5)
rubocop (1.65.1)
rubocop (1.75.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.4, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.44.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.32.1)
parser (>= 3.3.1.0)
rubocop-performance (1.21.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (3.0.4)
rubocop (~> 1.61)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.44.0)
parser (>= 3.3.7.2)
prism (~> 1.4)
rubocop-performance (1.25.0)
lint_roller (~> 1.1)
rubocop (>= 1.75.0, < 2.0)
rubocop-ast (>= 1.38.0, < 2.0)
rubocop-rspec (3.5.0)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
ruby-progressbar (1.13.0)
securerandom (0.4.1)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov-html (0.13.1)
simplecov_json_formatter (0.1.4)
standard (1.40.0)
standard (1.49.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.65.0)
rubocop (~> 1.75.2)
standard-custom (~> 1.0.0)
standard-performance (~> 1.4)
standard-performance (~> 1.8)
standard-custom (1.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.50)
standard-performance (1.4.0)
standard-performance (1.8.0)
lint_roller (~> 1.1)
rubocop-performance (~> 1.21.0)
stringio (3.0.8)
thread_safe (0.3.6)
tzinfo (1.2.10)
thread_safe (~> 0.1)
unicode-display_width (2.5.0)
rubocop-performance (~> 1.25.0)
stringio (3.1.6)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
uri (1.0.3)
vcr (6.3.1)
base64
webmock (3.18.1)
webmock (3.25.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
xxhash (0.6.0)
zache (0.12.0)
zeitwerk (2.6.18)
zeitwerk (2.7.2)

PLATFORMS
x86_64-darwin-20
Expand All @@ -190,6 +221,7 @@ DEPENDENCIES
almost_standard!
collectionspace-client!
collectionspace-mapper!
collectionspace-refcache!
debug
pry
rspec
Expand Down
8 changes: 5 additions & 3 deletions bin/rubocop
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ if File.file?(bundle_binstub)
)
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub "\
"cannot run. Replace `bin/bundle` by running `bundle binstubs "\
"bundler --force`, then run this command again.")
abort(
"Your `bin/bundle` was not generated by Bundler, so this binstub "\
"cannot run. Replace `bin/bundle` by running `bundle binstubs "\
"bundler --force`, then run this command again."
)
end
end

Expand Down
13 changes: 4 additions & 9 deletions collectionspace-mapper.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
spec.homepage = "https://github.com/lyrasis/collectionspace-mapper"
spec.license = "MIT"

spec.required_ruby_version = ">= 3.0.6"
spec.required_ruby_version = ">= 3.4.1"

# 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
Expand Down Expand Up @@ -45,15 +45,10 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]

# version used by collectionspace-csv-importer
spec.add_dependency "activesupport", "= 6.0.4.7"
spec.add_dependency "activesupport"
spec.add_dependency "chronic"
spec.add_dependency "collectionspace-refcache"

# pinned because updating causes "uninitialized constant
# ActiveSupport::LoggerThreadSafeLevel::Logger"
spec.add_dependency "dry-configurable", "~>0.14"
spec.add_dependency "dry-monads", "~>1.4"

spec.add_dependency "dry-configurable"
spec.add_dependency "dry-monads"
spec.add_dependency "memo_wise"
spec.add_dependency "net-http"
spec.add_dependency "nokogiri"
Expand Down
2 changes: 1 addition & 1 deletion doc/batch_configuration.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ Controls whether the status of each record is determined via querying the servic
====
**Do not** set this to `cache` unless:

* you know you have an up-to-date `CollectionSpace::RefCache` accurately populated with all CSIDs from the CollectionSpace instance you are working with
* you know you have an up-to-date `CollectionSpace::Refcache` accurately populated with all CSIDs from the CollectionSpace instance you are working with
* you know no one is adding or deleting any records from the CollectionSpace instance you are working with while you are preparing records to be transferred into it

If you use this in other circumstances, it is possible to inadvertently add duplicate records.
Expand Down
6 changes: 3 additions & 3 deletions doc/usage.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ cs_client_object = CollectionSpace::Client.new(
)

refname_cache_config = { domain: 'core.collectionspace.org' }
refname_cache = CollectionSpace::RefCache.new(config: refname_cache_config)
refname_cache = CollectionSpace::Refcache.new(config: refname_cache_config)

csid_cache_config = { domain: 'core.collectionspace.org' }
csid_cache = CollectionSpace::RefCache.new(config: csid_cache_config)
csid_cache = CollectionSpace::Refcache.new(config: csid_cache_config)

record_mapper = JSON.parse(File.read('spec/fixtures/files/mappers/release_6_1/core/core_6_1_0-collectionobject.json'))
----
Expand All @@ -53,7 +53,7 @@ record_mapper = JSON.parse(File.read('spec/fixtures/files/mappers/release_6_1/co
====
The above will create in-memory https://github.com/yegor256/zache[Zache] caches.

If using Redis as the CollectionSpace::RefCache backend, you need to make sure you are using two different Redis instances for the two caches, OR two different databases inside the same Redis instance.
If using Redis as the CollectionSpace::Refcache backend, you need to make sure you are using two different Redis instances for the two caches, OR two different databases inside the same Redis instance.
====

== Create DataHandler for batch
Expand Down
3 changes: 3 additions & 0 deletions lib/collectionspace/mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
require "json"
require "logger"

require "collectionspace/client"
require "collectionspace/refcache"
require "dry-configurable"
require "nokogiri"
require "xxhash"
Expand All @@ -21,6 +23,7 @@
loader.setup
loader.eager_load


module CollectionSpace
module Mapper
extend Dry::Configurable
Expand Down
1 change: 0 additions & 1 deletion lib/collectionspace/mapper/authority_hierarchy_prepper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class AuthorityHierarchyPrepper < CollectionSpace::Mapper::DataPrepper
# @param data [Hash, CollectionSpace::Mapper::Response]
def initialize(data, handler)
super
@cache = handler.termcache
@type = response.merged_data["term_type"]
@subtype = response.merged_data["term_subtype"]
end
Expand Down
Loading
Loading