relaton-cie 2.0.0.pre.alpha.3 → 2.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 69b71b734f820604e3f3f6ace17de60b9b8e4502f263e374fae88dfa8a48b781
4
- data.tar.gz: aaa0ae4e1837db334cc20d44a7fd7bc1fd5b381cfeb408e0e033f20deb97456a
3
+ metadata.gz: 6dbb109ece2a9d747bbec32bb76e87fb502549fb7559ec3b751c264c8788387b
4
+ data.tar.gz: 7bc24ddac6a905c4783f7f1350de7c697b2fb77052a621384320444b641c5fcf
5
5
  SHA512:
6
- metadata.gz: b62aa1655cbd39d73def4a93c998cac9d7818bc0d1ebd45d0543c43c472c60875c797b7b5f5233f52911f2e27bbaf99917d33a91646afcb37a84d89c417f1aa0
7
- data.tar.gz: 3f752a2a86b2b899eb6f99fad6ac823569b59eb5536422b936350dab65c7ebaab6e884de07896ce98930f1a2dca86dccbe31bd5887f789ff6d727b723afd3c85
6
+ metadata.gz: 1aedb30acab2edc9b4baa181748dbf87cfc9c368ca14f5dd49783688f0752704328c37de6cf67c4026f7ec26aa40a666b6f08b6617855d959efe95e0a04b7807
7
+ data.tar.gz: b3003609e4a4a68b8a6a5dd43449959201918b120b92d7ea29b07c23bddf9821297b0e3053ee64648f4c9491affaf95d7b4549bb6c37030c0adb24ef39e982e1
data/.gitignore CHANGED
@@ -13,3 +13,4 @@
13
13
  .rubocop-https---raw-githubusercontent-com-riboseinc-oss-guides-master-ci-rubocop-yml
14
14
  Gemfile.lock
15
15
  .vscode/
16
+ .claude/settings.local.json
data/CLAUDE.md ADDED
@@ -0,0 +1,13 @@
1
+ # CLAUDE.md
2
+
3
+ ## Development
4
+
5
+ - `bundle install` — install dependencies
6
+ - `bundle exec rake spec` — run tests
7
+ - `bundle exec rubocop` — lint
8
+
9
+ ## Testing
10
+
11
+ - **Framework:** RSpec with VCR cassettes and WebMock
12
+ - **Index fixture:** `spec/fixtures/index-v1.zip` is pre-loaded into `Relaton::Index` pool in `before(:suite)` (configured in `spec/support/webmock.rb`). Run `rake spec:update_index` to refresh from relaton-data-cie.
13
+ - **VCR cassettes:** `spec/vcr_cassettes/` — index download requests are ignored by VCR (handled by fixture).
data/Gemfile CHANGED
@@ -3,6 +3,7 @@ source "https://rubygems.org"
3
3
  # Specify your gem's dependencies in relaton_cie.gemspec
4
4
  gemspec
5
5
 
6
+
6
7
  gem "equivalent-xml", "~> 0.6"
7
8
  gem "pry-byebug"
8
9
  gem "rake", "~> 13.0"
data/README.adoc CHANGED
@@ -133,6 +133,8 @@ RelatonCie uses the relaton-logger gem for logging. By default, it logs to STDOU
133
133
 
134
134
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
135
135
 
136
+ To update the index test fixture (used by tests), run `rake spec:update_index`. This downloads the latest `index-v1.zip` from the https://github.com/relaton/relaton-data-cie[relaton-data-cie] repository.
137
+
136
138
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
137
139
 
138
140
  == Contributing
data/Rakefile CHANGED
@@ -4,3 +4,25 @@ require "rspec/core/rake_task"
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
6
  task :default => :spec
7
+
8
+ namespace :spec do
9
+ desc "Download latest CIE index fixture from relaton-data-cie"
10
+ task :update_index do
11
+ require "net/http"
12
+ require "uri"
13
+
14
+ url = "https://raw.githubusercontent.com/relaton/relaton-data-cie/data-v2/index-v1.zip"
15
+ dest = File.join(__dir__, "spec", "fixtures", "index-v1.zip")
16
+
17
+ puts "Downloading \#{url} ..."
18
+ uri = URI.parse(url)
19
+ response = Net::HTTP.get_response(uri)
20
+
21
+ if response.is_a?(Net::HTTPSuccess)
22
+ File.binwrite(dest, response.body)
23
+ puts "Updated \#{dest} (\#{response.body.bytesize} bytes)"
24
+ else
25
+ abort "Failed to download: HTTP \#{response.code}"
26
+ end
27
+ end
28
+ end
data/grammars/biblio.rng CHANGED
@@ -2015,15 +2015,11 @@ provided that it is not the entire bibliographic item that is so related</a:docu
2015
2015
  <a:documentation>A version of the bibliographic item (within an edition). Can be used for drafts</a:documentation>
2016
2016
  <element name="version">
2017
2017
  <optional>
2018
- <ref name="revision-date">
2019
- <a:documentation>The date at which the current version of the bibliographic item was produced</a:documentation>
2020
- </ref>
2021
- </optional>
2022
- <optional>
2023
- <ref name="draft">
2024
- <a:documentation>The identifier for the current draft of the bibliographic item</a:documentation>
2025
- </ref>
2018
+ <attribute name="type">
2019
+ <a:documentation>Versioning scheme, in case of multiple versioning schemes</a:documentation>
2020
+ </attribute>
2026
2021
  </optional>
2022
+ <text/>
2027
2023
  </element>
2028
2024
  </define>
2029
2025
  <define name="vedition">
@@ -1,6 +1,7 @@
1
1
  module Relaton
2
2
  module Cie
3
3
  class Bibdata < Item
4
+ model ItemData
4
5
  include Bib::BibdataShared
5
6
  end
6
7
  end
@@ -1,6 +1,7 @@
1
1
  module Relaton
2
2
  module Cie
3
3
  class Bibitem < Item
4
+ model ItemData
4
5
  include Bib::BibitemShared
5
6
  end
6
7
  end
@@ -224,8 +224,8 @@ module Relaton
224
224
 
225
225
  # @param bib [RelatonCie::BibliographicItem]
226
226
  def write_file(bib) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
227
- id = bib.docidentifier[0].content.gsub(%r{[/\s\-:.]}, "_")
228
- file = "#{@output}/#{id.upcase}.#{@format}"
227
+ id = bib.docidentifier[0].content
228
+ file = output_file id
229
229
  if @files.include? file
230
230
  Util.warn do
231
231
  "File #{file} exists. Docid: #{bib.docidentifier[0].content}\n" \
@@ -234,16 +234,12 @@ module Relaton
234
234
  else @files << file
235
235
  end
236
236
  index.add_or_update bib.docidentifier[0].content, file
237
- File.write file, content(bib), encoding: "UTF-8"
237
+ File.write file, serialize(bib), encoding: "UTF-8"
238
238
  end
239
239
 
240
- def content(bib)
241
- case @format
242
- when "xml" then bib.to_xml(bibdata: true)
243
- when "yaml" then bib.to_yaml
244
- when "bibxml" then bib.to_bibxml
245
- end
246
- end
240
+ def to_xml(bib) = bib.to_xml(bibdata: true)
241
+ def to_yaml(bib) = bib.to_yaml
242
+ def to_bibxml(bib) = bib.to_rfcxml
247
243
 
248
244
  # @param hit [Nokogiri::HTML::Element]
249
245
  def parse_page(hit) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
@@ -1,11 +1,7 @@
1
1
  module Relaton
2
2
  module Cie
3
3
  class Ext < Bib::Ext
4
- attribute :schema_version, method: :get_shema_version
5
-
6
- def get_shema_version
7
- Relaton.schema_versions["relaton-model-cie"]
8
- end
4
+ def get_schema_version = Relaton.schema_versions["relaton-model-cie"]
9
5
  end
10
6
  end
11
7
  end
@@ -1,5 +1,5 @@
1
1
  module Relaton
2
2
  module Cie
3
- VERSION = "2.0.0-alpha.3".freeze
3
+ VERSION = "2.1.0".freeze
4
4
  end
5
5
  end
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
 
32
32
  spec.add_dependency "mechanize", "~> 2.10"
33
33
  spec.add_dependency "parslet", "~> 2.0.0"
34
- spec.add_dependency "relaton-bib", "~> 2.0.0-alpha.7"
34
+ spec.add_dependency "relaton-bib", "~> 2.1.0"
35
35
  spec.add_dependency "relaton-core", "~> 0.0.12"
36
36
  spec.add_dependency "relaton-index", "~> 0.2.0"
37
37
  end
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-cie
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre.alpha.3
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
+ autorequire:
8
9
  bindir: exe
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2026-05-04 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: mechanize
@@ -43,14 +44,14 @@ dependencies:
43
44
  requirements:
44
45
  - - "~>"
45
46
  - !ruby/object:Gem::Version
46
- version: 2.0.0.pre.alpha.7
47
+ version: 2.1.0
47
48
  type: :runtime
48
49
  prerelease: false
49
50
  version_requirements: !ruby/object:Gem::Requirement
50
51
  requirements:
51
52
  - - "~>"
52
53
  - !ruby/object:Gem::Version
53
- version: 2.0.0.pre.alpha.7
54
+ version: 2.1.0
54
55
  - !ruby/object:Gem::Dependency
55
56
  name: relaton-core
56
57
  requirement: !ruby/object:Gem::Requirement
@@ -93,6 +94,7 @@ files:
93
94
  - ".gitignore"
94
95
  - ".rspec"
95
96
  - ".rubocop.yml"
97
+ - CLAUDE.md
96
98
  - Gemfile
97
99
  - LICENSE.txt
98
100
  - README.adoc
@@ -117,12 +119,13 @@ files:
117
119
  - lib/relaton/cie/scrapper.rb
118
120
  - lib/relaton/cie/util.rb
119
121
  - lib/relaton/cie/version.rb
120
- - relaton_cie.gemspec
122
+ - relaton-cie.gemspec
121
123
  homepage: https://github.com/metanorma/relaton-cie
122
124
  licenses:
123
125
  - BSD-2-Clause
124
126
  metadata:
125
127
  homepage_uri: https://github.com/metanorma/relaton-cie
128
+ post_install_message:
126
129
  rdoc_options: []
127
130
  require_paths:
128
131
  - lib
@@ -137,7 +140,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
140
  - !ruby/object:Gem::Version
138
141
  version: '0'
139
142
  requirements: []
140
- rubygems_version: 3.6.9
143
+ rubygems_version: 3.5.22
144
+ signing_key:
141
145
  specification_version: 4
142
146
  summary: 'Relaton::Cie: retrieve CIE Standards for bibliographic use using the BibliographicItem
143
147
  model.'