ali 0.1.0 → 0.1.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/.github/workflows/rake.yml +5 -1
- data/.github/workflows/release.yml +5 -0
- data/.gitignore +2 -0
- data/.rubocop_todo.yml +1 -3
- data/CLAUDE.md +34 -0
- data/Gemfile +2 -1
- data/ali.gemspec +1 -1
- data/lib/ali/container.rb +3 -3
- data/lib/ali/free_to_read.rb +3 -3
- data/lib/ali/license_ref.rb +3 -3
- data/lib/ali/namespace.rb +8 -0
- data/lib/ali/version.rb +1 -1
- data/lib/ali.rb +5 -6
- metadata +8 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: eeb297b558c72b7706c4c675da5fe39006dc820e6f0cb8df9d86d736acd64f6e
|
|
4
|
+
data.tar.gz: 136e95f155e967005e362312bf3b595634e045c8a7463a6367e194bb7e0e01ff
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 635a1fb88345c73d0f6da4f1d678e165b238ba521d7b176c87eb5165f3d8ba74a68ebc32247dd18d5a7059010ee5549c4dfea04aed774377450be3babc592f04
|
|
7
|
+
data.tar.gz: eb532ef7c414c0bc6685fb250edc0dafc3d124703233168e69a8ad8d561854423d648c409a33685dd3e5b1d1a18b305d128d07f525b414644ba5ee90f837eb98
|
data/.github/workflows/rake.yml
CHANGED
data/.gitignore
CHANGED
data/.rubocop_todo.yml
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on
|
|
3
|
+
# on 2026-04-20 07:55:01 UTC using RuboCop version 1.86.1.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
|
8
8
|
|
|
9
9
|
# Offense count: 1
|
|
10
|
-
# Configuration parameters: Severity, Include.
|
|
11
|
-
# Include: **/*.gemspec
|
|
12
10
|
Gemspec/RequiredRubyVersion:
|
|
13
11
|
Exclude:
|
|
14
12
|
- 'ali.gemspec'
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
This is the `ali` Ruby gem — an implementation of the [NISO Access and License Indicators (ALI) Schemas](https://www.niso.org/schemas/ali/1.0) (NISO RP 22-2021). It parses and generates ALI data in both XML and JSON-LD formats. The gem is used by the `niso-jats` gem.
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
|
|
11
|
+
- **Run all tests and lint:** `bundle exec rake` (default task runs `spec` then `rubocop`)
|
|
12
|
+
- **Run tests only:** `bundle exec rspec`
|
|
13
|
+
- **Run a single test file:** `bundle exec rspec spec/ali/free_to_read_spec.rb`
|
|
14
|
+
- **Run a single test by line:** `bundle exec rspec spec/ali/free_to_read_spec.rb:15`
|
|
15
|
+
- **Lint only:** `bundle exec rubocop`
|
|
16
|
+
|
|
17
|
+
## Architecture
|
|
18
|
+
|
|
19
|
+
All model classes inherit from `Lutaml::Model::Serializable` (from the `lutaml-model` gem) and declare attributes + XML/JSON mappings using its DSL.
|
|
20
|
+
|
|
21
|
+
- **`Ali::FreeToRead`** — `free_to_read` element. Attributes: `start_date` (date), `end_date` (date).
|
|
22
|
+
- **`Ali::LicenseRef`** — `license_ref` element. Attributes: `start_date` (date), `applies_to` (string), `uri` (string, mapped from XML text content).
|
|
23
|
+
- **`Ali::Container`** — Root container for JSON-LD usage only (not part of the NISO ALI spec). Contains collections of `FreeToRead` and `LicenseRef`.
|
|
24
|
+
|
|
25
|
+
XML namespace for all elements: `http://www.niso.org/schemas/ali/1.0/`
|
|
26
|
+
|
|
27
|
+
The adapter configuration (Nokogiri for XML, standard library for JSON/YAML) is set up in `spec/spec_helper.rb`.
|
|
28
|
+
|
|
29
|
+
## Key Details
|
|
30
|
+
|
|
31
|
+
- `LicenseRef#uri` is mapped from XML element *content* (`map_content`), not an attribute.
|
|
32
|
+
- XML tests use `be_xml_equivalent_to` (from `lutaml-model`) for XML comparison; JSON tests use `eq` on strings.
|
|
33
|
+
- Ruby >= 3.0.0 required.
|
|
34
|
+
- CI uses reusable workflows from `metanorma/ci` (generic-rake, rubygems-release).
|
data/Gemfile
CHANGED
|
@@ -5,9 +5,10 @@ source "https://rubygems.org"
|
|
|
5
5
|
# Specify your gem's dependencies in reqif.gemspec
|
|
6
6
|
gemspec
|
|
7
7
|
|
|
8
|
+
gem "canon"
|
|
9
|
+
gem "lutaml-model", github: "lutaml/lutaml-model", branch: "main"
|
|
8
10
|
gem "nokogiri"
|
|
9
11
|
gem "rake", "~> 13.0"
|
|
10
12
|
gem "rspec", "~> 3.0"
|
|
11
13
|
gem "rubocop", "~> 1.21"
|
|
12
14
|
gem "rubocop-performance"
|
|
13
|
-
gem "xml-c14n"
|
data/ali.gemspec
CHANGED
data/lib/ali/container.rb
CHANGED
|
@@ -9,14 +9,14 @@ module Ali
|
|
|
9
9
|
attribute :license_ref, LicenseRef, collection: true
|
|
10
10
|
|
|
11
11
|
xml do
|
|
12
|
-
|
|
13
|
-
namespace
|
|
12
|
+
element "ali-container"
|
|
13
|
+
namespace Namespace
|
|
14
14
|
|
|
15
15
|
map_element "free_to_read", to: :free_to_read
|
|
16
16
|
map_element "license_ref", to: :license_ref
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
key_value do
|
|
20
20
|
map "free_to_read", to: :free_to_read
|
|
21
21
|
map "license_ref", to: :license_ref
|
|
22
22
|
end
|
data/lib/ali/free_to_read.rb
CHANGED
|
@@ -6,14 +6,14 @@ module Ali
|
|
|
6
6
|
attribute :end_date, :date
|
|
7
7
|
|
|
8
8
|
xml do
|
|
9
|
-
|
|
10
|
-
namespace
|
|
9
|
+
element "free_to_read"
|
|
10
|
+
namespace Namespace
|
|
11
11
|
|
|
12
12
|
map_attribute "start_date", to: :start_date
|
|
13
13
|
map_attribute "end_date", to: :end_date
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
key_value do
|
|
17
17
|
map "start_date", to: :start_date
|
|
18
18
|
map "end_date", to: :end_date
|
|
19
19
|
end
|
data/lib/ali/license_ref.rb
CHANGED
|
@@ -7,15 +7,15 @@ module Ali
|
|
|
7
7
|
attribute :uri, :string
|
|
8
8
|
|
|
9
9
|
xml do
|
|
10
|
-
|
|
11
|
-
namespace
|
|
10
|
+
element "license_ref"
|
|
11
|
+
namespace Namespace
|
|
12
12
|
|
|
13
13
|
map_attribute "start_date", to: :start_date
|
|
14
14
|
map_attribute "applies_to", to: :applies_to
|
|
15
15
|
map_content to: :uri
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
key_value do
|
|
19
19
|
map "start_date", to: :start_date
|
|
20
20
|
map "applies_to", to: :applies_to
|
|
21
21
|
map "uri", to: :uri
|
data/lib/ali/version.rb
CHANGED
data/lib/ali.rb
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative "ali/version"
|
|
4
3
|
require "lutaml/model"
|
|
5
4
|
|
|
6
5
|
module Ali
|
|
7
6
|
class Error < StandardError; end
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
autoload :FreeToRead, "ali/free_to_read"
|
|
9
|
+
autoload :LicenseRef, "ali/license_ref"
|
|
10
|
+
autoload :Container, "ali/container"
|
|
11
|
+
autoload :Namespace, "ali/namespace"
|
|
12
|
+
autoload :Version, "ali/version"
|
|
10
13
|
end
|
|
11
|
-
|
|
12
|
-
require_relative "ali/free_to_read"
|
|
13
|
-
require_relative "ali/license_ref"
|
|
14
|
-
require_relative "ali/container"
|
metadata
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ali
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-04-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: lutaml-model
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: 0.8.0
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- - "
|
|
24
|
+
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
26
|
+
version: 0.8.0
|
|
27
27
|
description: A Ruby library for parsing and generating NISO Access and License Indicators
|
|
28
28
|
(ALI) Schemas data
|
|
29
29
|
email:
|
|
@@ -38,6 +38,7 @@ files:
|
|
|
38
38
|
- ".rspec"
|
|
39
39
|
- ".rubocop.yml"
|
|
40
40
|
- ".rubocop_todo.yml"
|
|
41
|
+
- CLAUDE.md
|
|
41
42
|
- Gemfile
|
|
42
43
|
- README.adoc
|
|
43
44
|
- Rakefile
|
|
@@ -48,6 +49,7 @@ files:
|
|
|
48
49
|
- lib/ali/container.rb
|
|
49
50
|
- lib/ali/free_to_read.rb
|
|
50
51
|
- lib/ali/license_ref.rb
|
|
52
|
+
- lib/ali/namespace.rb
|
|
51
53
|
- lib/ali/version.rb
|
|
52
54
|
- sig/ali.rbs
|
|
53
55
|
homepage: https://github.com/lutaml/ali
|