Skip to content

Commit

Permalink
Merge pull request #140 from collectionspace/v3
Browse files Browse the repository at this point in the history
Prepare v3.0.0 release
  • Loading branch information
kspurgin authored May 15, 2024
2 parents 5b480e4 + 4578077 commit f4a6cb5
Show file tree
Hide file tree
Showing 8 changed files with 180 additions and 158 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['3.1']
ruby: ['3.1']
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Ruby ${{ matrix.ruby-version }}
- name: Set up Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: ${{ matrix.ruby-version }}
ruby-version: ${{ matrix.ruby }}

- name: Configure bundle
run: bundle config unset deployment

- name: Install dependencies
run: bundle install
Expand Down
26 changes: 26 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,32 @@ These changes are merged into the `main` branch, but have not been released. Aft

== Releases

=== 3.0.0 - 2024-05-14
==== Breaking
* Fields controlled by a single authority vocabulary no longer have simplified header/column names. `default_single_authority_plain_last_versions` has been added in `lib/cspace_config_untangler.rb` and records the last UI config version of known/directly supported by Lyrasis profiles that will have simplified header/column names. This may need to be updated if you are using the Untangler for other profiles.
** The main thing to be concerned with here is that the CSV templates you use are generated with the same header/column names as the mappers you use in the CSV Importer or other tooling

==== Added

* Community-supported profile configs, mappers, mapper manifest, CSV templates, and reference documents for 8.0 release
* Handling of new field definition override pattern in form definition (show only one field from repeatable field group, and make it non-repeatable, materials_4-0-0 objectCount field)
* CLI commands
** forms subpaths
** forms props_type
** forms props_key_sigs

==== Changed

* Upgrade-related warnings now generated by a class that emits each warning only once per run
* Log more info/oddness

==== Dev/Internal
* Implement almost-standard for code formatting/style/linting
* Add Github workflow to run tests and lint on PRs
* Remove code obviated by fixes in CollectionSpace 8.0
* Major refactor of code that extracts field data from forms
* Update dependencies; remove unused dependencies

=== 2.0.1 - 2023-10-03
==== Bugfixes

Expand Down
7 changes: 2 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ GIT
PATH
remote: .
specs:
cspace_config_untangler (2.0.2)
cspace_config_untangler (3.0.0)
dry-configurable
facets
nokogiri
Expand All @@ -46,8 +46,6 @@ GEM
method_source (1.0.0)
nokogiri (1.16.5-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.5-x86_64-linux)
racc (~> 1.4)
parallel (1.24.0)
parser (3.3.1.0)
ast (~> 2.4.1)
Expand Down Expand Up @@ -118,8 +116,7 @@ GEM
zeitwerk (2.6.14)

PLATFORMS
x86_64-darwin-20
x86_64-linux
ruby

DEPENDENCIES
almost_standard!
Expand Down
6 changes: 3 additions & 3 deletions doc/ui_config_notes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,18 @@ The key signatures and counts shown above can be generated by running:

[source,shell]
----
ccu debug form_props_sig -p all
ccu forms props_key_sigs -p all
----

The same command can be used to view examples for a given key signature,
as shown in the examples below.

[source,shell]
----
ccu debug form_props_sig -p all -k _owner key props ref -e true
ccu forms props_key_sigs -p all -k _owner key props ref -e true
----

Do `+ccu debug help form_props_sig+` for details on command usage.
Do `+ccu forms help props_key_sigs+` for details on command usage.

==== _owner, key, props, ref

Expand Down
2 changes: 1 addition & 1 deletion lib/cspace_config_untangler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ module CspaceConfigUntangler
"fcart" => "6-0-0",
"herbarium" => "2-0-9",
"lhmc" => "6-0-0",
"hku" => "",
"hku" => "1-0-0",
"materials" => "3-2-0",
"ohc" => "1-0-19",
"omca" => "1-0-0-rc6",
Expand Down
144 changes: 0 additions & 144 deletions lib/cspace_config_untangler/cli/debug_cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,150 +7,6 @@ module Cli
class DebugCli < Thor
include CCU::Cli::Helpers

desc "form_subpaths",
"Get all form props subpath values used"
option :rectype,
desc: "Comma separated list (no spaces) of record types to include. "\
"Defaults to all.",
default: "all",
aliases: "-r"
option :mode,
desc: "Whether to output just list of subpath values, or to "\
"include occurrence counts",
enum: %w[value count code],
default: "value",
type: :string,
aliases: "-m"
def form_subpaths
props = get_profiles.map do |profile|
p = CCU::Profile.new(profile:)
p.rectypes
.map(&:forms)
.flatten
.map(&:values)
.flatten
.reject(&:disabled?)
.map { |form| form.send(:iterator).send(:allprops) }
.flatten
end.flatten
.select { |prop| prop.config.key?("subpath") }

case options[:mode]
when "value"
props.map { |prop| prop.config["subpath"] }
.uniq
.map { |val| val.is_a?(Array) ? val.inspect : val }
.sort
.each { |val| puts val }
when "count"
props.group_by { |prop| prop.config["subpath"] }
.map { |subpath, arr| [subpath, arr.length] }
.sort_by { |subarr| subarr[1] }
.reverse
.to_h
.each { |val, ct| puts "#{ct}\t#{val}" }
when "code"
result = props.map { |prop| prop.config["subpath"] }
.uniq
.sort_by { |val| val.is_a?(Array) ? val.inspect : val }
puts result.inspect
end
end

desc "form_props_types",
"Get all values of props/type used"
option :rectype,
desc: "Comma separated list (no spaces) of record types to include. "\
"Defaults to all.",
default: "all",
aliases: "-r"
def form_props_types
props = get_profiles.map do |profile|
p = CCU::Profile.new(profile:)
p.rectypes
.map(&:forms)
.flatten
.map(&:values)
.flatten
.reject(&:disabled?)
.map { |form| form.send(:iterator).send(:allprops) }
.flatten
end.flatten
.select { |prop| prop.config.key?("type") }

result = props.group_by { |prop| prop.config["type"] }
.map { |subpath, arr| [subpath, arr.length] }
.sort_by { |subarr| subarr[1] }
.reverse
.to_h

result.each { |val, ct| puts "#{ct}\t#{val}" }
end

desc "form_props_sigs",
"Get all used props key signature patterns"
option :keys, desc: "Key signature to find", type: :array,
required: false, aliases: "-k"
option :selector, desc: "CCU::Forms::Props method used to "\
"select specific props.", aliases: "-s", type: :string, required: false
option :rejector, desc: "CCU::Forms::Props method used to "\
"reject specific props.", aliases: "-r", type: :string, required: false
option :count, desc: "Whether to print count of props following pattern",
aliases: "-c", type: :boolean, default: true, required: false
option :example, desc: "Whether to print examples", aliases: "-e",
type: :boolean, default: false, required: false
option :maxex, desc: "Maximum number of examples to print", aliases: "-m",
type: :numeric, default: 10, required: false
option :rectype,
desc: "Comma separated list (no spaces) of record types to include. "\
"Defaults to all.",
default: "all",
aliases: "-r"
def form_props_sigs
all = get_profiles.map do |profile|
p = CCU::Profile.new(profile:)
p.rectypes
.map(&:forms)
.flatten
.map(&:values)
.flatten
.reject(&:disabled?)
.map { |form| form.send(:iterator).send(:allprops) }
.flatten
end.flatten

by_sig = if options[:keys]
all.select { |p| p.keys == options[:keys].sort }
else
all
end
selected = if options[:selector]
meth = options[:selector].to_sym
by_sig.select { |p| p.send(meth) }
else
by_sig
end
rejected = if options[:rejector]
selected.reject { |p| p.send(options[:rejector].to_sym) }
else
selected
end
grouped = rejected.group_by { |prop| prop.keys }

grouped.sort_by { |keys, props| props.length }
.reverse_each do |keys, props|
puts "#{props.length}\t#{keys.inspect}" if options[:count]
if options[:example]
props.first(options[:maxex]).each do |prop|
puts prop
puts prop.config
puts "\n"
end
puts "\n\n"
end
end
end

desc "check_xpath_depth",
"Reports fields with unusual xpath depth (i.e. not 0, 1, 2, 3, or 4)"
option :rectype,
Expand Down
Loading

0 comments on commit f4a6cb5

Please sign in to comment.