relaton-oasis 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f220db8967faa301b9e1923d3238403ee10a3cef551a548dbd8c90edc2427db8
4
+ data.tar.gz: e662fc24b2f0df44491df9a4b1c13e7b323edfc8278f4e60f802ff12232f780e
5
+ SHA512:
6
+ metadata.gz: 93e431a62f1a75cd2ff19aaded3532dad653ab76c6c34da318a43c24b19482f59e1f68753809134ab332c99dfbf07eb0e7873cbe52df03aefeb30108578f713c
7
+ data.tar.gz: d92892eacf60da34285bbd988c98a070b961a6f7e77905e536c84e00622e0042f474ed77c1dd98a72d38eafa3d3302fc03cb11bf1cc814720d71044bd6b99240
@@ -0,0 +1,36 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ name: rake
4
+
5
+ on:
6
+ push:
7
+ branches: [ master, main ]
8
+ tags: [ v* ]
9
+ pull_request:
10
+
11
+ jobs:
12
+ rake:
13
+ name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
14
+ runs-on: ${{ matrix.os }}
15
+ continue-on-error: ${{ matrix.experimental }}
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ ruby: [ '3.0', '2.7', '2.6', '2.5' ]
20
+ os: [ ubuntu-latest, windows-latest, macos-latest ]
21
+ experimental: [ false ]
22
+ steps:
23
+ - uses: actions/checkout@v2
24
+ with:
25
+ submodules: true
26
+
27
+ # https://github.com/ruby-debug/debase/issues/89#issuecomment-686827382
28
+ - if: matrix.os == 'macos-latest' && matrix.ruby == '2.5'
29
+ run: echo BUNDLE_BUILD__DEBASE="--with-cflags=\"-Wno-error=implicit-function-declaration\"" >> $GITHUB_ENV
30
+
31
+ - uses: ruby/setup-ruby@v1
32
+ with:
33
+ ruby-version: ${{ matrix.ruby }}
34
+ bundler-cache: true
35
+
36
+ - run: bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ .rubocop-https---raw-githubusercontent-com-riboseinc-oss-guides-master-ci-rubocop-yml
13
+ Gemfile.lock
14
+ .vscode/
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,12 @@
1
+ # This project follows the Ribose OSS style guide.
2
+ # https://github.com/riboseinc/oss-guides
3
+ # All project-specific additions and overrides should be specified in this file.
4
+
5
+ require: rubocop-rails
6
+
7
+ inherit_from:
8
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
9
+ AllCops:
10
+ TargetRubyVersion: 2.5
11
+ Rails:
12
+ Enabled: false
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in relaton_oasis.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
11
+
12
+ gem "rubocop", "~> 1.7"
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Andrei Kislichenko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.adoc ADDED
@@ -0,0 +1,225 @@
1
+ = RelatonBipm: retrieve OASIS Standards for bibliographic use using the BibliographicItem model
2
+
3
+ image:https://img.shields.io/gem/v/relaton-oasis.svg["Gem Version", link="https://rubygems.org/gems/relaton-oasis"]
4
+ image:https://github.com/relaton/relaton-oasis/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/relaton/relaton-oasis/actions?workflow=macos"]
5
+ image:https://github.com/relaton/relaton-oasis/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/relaton/relaton-oasis/actions?workflow=windows"]
6
+ image:https://github.com/relaton/relaton-oasis/workflows/ubuntu/badge.svg["Build Status (Ubuntu)", link="https://github.com/relaton/relaton-oasis/actions?workflow=ubuntu"]
7
+ image:https://codeclimate.com/github/relaton/relaton-oasis/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/relaton/relaton-oasis"]
8
+ image:https://img.shields.io/github/issues-pr-raw/relaton/relaton-oasis.svg["Pull Requests", link="https://github.com/relaton/relaton-oasis/pulls"]
9
+ image:https://img.shields.io/github/commits-since/relaton/relaton-oasis/latest.svg["Commits since latest",link="https://github.com/relaton/relaton-oasis/releases"]
10
+
11
+ RelatonOasis is a Ruby gem that implements the https://github.com/metanorma/metanorma-model-iso#iso-bibliographic-item[IsoBibliographicItem model].
12
+
13
+ You can use it to retrieve metadata of OASIS Standards from https://www.oasis-open.org/standards/ and access such metadata through the `OasisBibliographicItem` object.
14
+
15
+ == Installation
16
+
17
+ Add this line to your application's Gemfile:
18
+
19
+ ```ruby
20
+ gem 'relaton-oasis'
21
+ ```
22
+
23
+ And then execute:
24
+
25
+ $ bundle install
26
+
27
+ Or install it yourself as:
28
+
29
+ $ gem install relaton-oasis
30
+
31
+ == Usage
32
+
33
+ === Get standard using reference.
34
+
35
+ All the OASIS documents are parsed from https://www.oasis-open.org/standards/ and stored into a GitHub repository https://github.com/relaton/relaton-data-oasis. You can find all possible refereces in the repository.
36
+
37
+ [source,ruby]
38
+ ----
39
+ require 'relaton-oasis'
40
+ => true
41
+
42
+ item = RelatonOasis::OasisBibliography.get "OASIS amqp-core"
43
+ [relaton-oasis] (OASIS amqp-core fetching...
44
+ [relaton-oasis] (OASIS amqp-core) found OASIS amqp-core
45
+ => #<RelatonOasis::OasisBibliographicItem:0x00007fceea1aecb0
46
+ ...
47
+ ----
48
+
49
+ === XML serialization
50
+
51
+ [source,ruby]
52
+ ----
53
+ item.to_xml
54
+ => "<bibitem id="OASISamqp-core" type="standard">
55
+ <fetched>2022-03-17</fetched>
56
+ <title type="main" format="text/plain" language="en" script="Latn">Advanced Message Queueing Protocol (AMQP) v1.0</title>
57
+ <docidentifier type="OASIS" primary="true">OASIS amqp-core</docidentifier>
58
+ <docnumber>amqp-core</docnumber>
59
+ <date type="issued">
60
+ <on>2012-10-30</on>
61
+ </date>
62
+ <language>en</language>
63
+ <script>Latn</script>
64
+ <abstract format="text/plain" language="en" script="Latn">An open internet protocol for business messaging.</abstract>
65
+ <relation type="hasPart">
66
+ <bibitem>
67
+ <formattedref format="text/plain">OASIS amqp-core-overview-v1.0-Pt0</formattedref>
68
+ </bibitem>
69
+ </relation>
70
+ <relation type="hasPart">
71
+ <bibitem>
72
+ <formattedref format="text/plain">OASIS amqp-core-types-v1.0-Pt1</formattedref>
73
+ </bibitem>
74
+ </relation>
75
+ <relation type="hasPart">
76
+ <bibitem>
77
+ <formattedref format="text/plain">OASIS amqp-core-transport-v1.0-Pt2</formattedref>
78
+ </bibitem>
79
+ </relation>
80
+ <relation type="hasPart">
81
+ <bibitem>
82
+ <formattedref format="text/plain">OASIS amqp-core-messaging-v1.0-Pt3</formattedref>
83
+ </bibitem>
84
+ </relation>
85
+ <relation type="hasPart">
86
+ <bibitem>
87
+ <formattedref format="text/plain">OASIS amqp-core-transactions-v1.0-Pt4</formattedref>
88
+ </bibitem>
89
+ </relation>
90
+ <relation type="hasPart">
91
+ <bibitem>
92
+ <formattedref format="text/plain">OASIS amqp-core-security-v1.0-Pt5</formattedref>
93
+ </bibitem>
94
+ </relation>
95
+ </bibitem>"
96
+ ----
97
+
98
+ With argument `bibdata: true` it ouputs XML wrapped by `bibdata` element and adds flavour `ext` element.
99
+
100
+ [source,ruby]
101
+ ----
102
+ item.to_xml bibdata: true
103
+ => "<bibdata type="standard">
104
+ <fetched>2022-03-17</fetched>
105
+ <title type="main" format="text/plain" language="en" script="Latn">Advanced Message Queueing Protocol (AMQP) v1.0</title>
106
+ <docidentifier type="OASIS" primary="true">OASIS amqp-core</docidentifier>
107
+ <docnumber>amqp-core</docnumber>
108
+ <date type="issued">
109
+ <on>2012-10-30</on>
110
+ </date>
111
+ <language>en</language>
112
+ <script>Latn</script>
113
+ <abstract format="text/plain" language="en" script="Latn">An open internet protocol for business messaging.</abstract>
114
+ <relation type="hasPart">
115
+ <bibitem>
116
+ <formattedref format="text/plain">OASIS amqp-core-overview-v1.0-Pt0</formattedref>
117
+ </bibitem>
118
+ </relation>
119
+ <relation type="hasPart">
120
+ <bibitem>
121
+ <formattedref format="text/plain">OASIS amqp-core-types-v1.0-Pt1</formattedref>
122
+ </bibitem>
123
+ </relation>
124
+ <relation type="hasPart">
125
+ <bibitem>
126
+ <formattedref format="text/plain">OASIS amqp-core-transport-v1.0-Pt2</formattedref>
127
+ </bibitem>
128
+ </relation>
129
+ <relation type="hasPart">
130
+ <bibitem>
131
+ <formattedref format="text/plain">OASIS amqp-core-messaging-v1.0-Pt3</formattedref>
132
+ </bibitem>
133
+ </relation>
134
+ <relation type="hasPart">
135
+ <bibitem>
136
+ <formattedref format="text/plain">OASIS amqp-core-transactions-v1.0-Pt4</formattedref>
137
+ </bibitem>
138
+ </relation>
139
+ <relation type="hasPart">
140
+ <bibitem>
141
+ <formattedref format="text/plain">OASIS amqp-core-security-v1.0-Pt5</formattedref>
142
+ </bibitem>
143
+ </relation>
144
+ <ext>
145
+ <doctype>standard</doctype>
146
+ <editorialgroup>
147
+ <technical-committee>OASIS Advanced Message Queuing Protocol (AMQP) TC</technical-committee>
148
+ </editorialgroup>
149
+ <technology-area>Messaging</technology-area>
150
+ </ext>
151
+ </bibdata>"
152
+ ----
153
+
154
+ === Typed links
155
+
156
+ Some OASIS documents have `src` type link.
157
+
158
+ [source,ruby]
159
+ ----
160
+ item = RelatonOasis::OasisBibliography.get "OASIS amqp-core-types-v1.0-Pt1"
161
+ [relaton-oasis] (OASIS amqp-core-types-v1.0-Pt1 fetching...
162
+ [relaton-oasis] (OASIS amqp-core-types-v1.0-Pt1) found OASIS amqp-core-types-v1.0-Pt1
163
+ => #<RelatonOasis::OasisBibliographicItem:0x00007fceda0c5e08
164
+ ...
165
+
166
+ item.link
167
+ => [#<RelatonBib::TypedUri:0x00007fceda0bf990
168
+ @content=#<Addressable::URI:0xbe00 URI:http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-types-v1.0-os.html>,
169
+ @type="src">]
170
+ ----
171
+
172
+ === Create bibliographic item from XML
173
+
174
+ [source,ruby]
175
+ ----
176
+ RelatonOasis::XMLParser.from_xml File.read("spec/fixtures/oasis_bibdata.xml")
177
+ => #<RelatonOasis::OasisBibliographicItem:0x00007f88ab9d1d78
178
+ ...
179
+ ----
180
+
181
+ === Create bibliographic item from YAML
182
+ [source,ruby]
183
+ ----
184
+ hash = YAML.load_file "spec/fixtures/oasis_bibdata.yaml"
185
+ => {"id"=>"OASISamqp-core",
186
+ ...
187
+
188
+ RelatonOasis::OasisBibliographicItem.from_hash hash
189
+ => #<RelatonOasis::OasisBibliographicItem:0x00007fceea0b6628
190
+ ...
191
+ ----
192
+
193
+ === Fetch data
194
+
195
+ The OASIS documents can be fetched from https://www.oasis-open.org/standards/ and converted into RelatonXML/BibXML/BibYAML formats:
196
+
197
+ The method `RelatonOasis::DataFetcher.fetch(output: "data", format: "yaml")` fethces and converts all the documents from the https://www.oasis-open.org/standards/ and save them to the `./data` folder in YAML format.
198
+
199
+ Arguments:
200
+
201
+ - `output` - folder to save documents (default './data').
202
+ - `format` - format in which the documents are saved. Possimle formats are: `yaml`, `xml`, `bibxml` (default `yaml`).
203
+
204
+ [source,ruby]
205
+ ----
206
+ RelatonOasis::DataFetcher.fetch
207
+ Started at: 2022-03-18 18:34:06 +0100
208
+ Stopped at: 2022-03-18 18:34:12 +0100
209
+ Done in: 5 sec.
210
+ => nil
211
+ ----
212
+
213
+ == Development
214
+
215
+ 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.
216
+
217
+ 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
218
+
219
+ == Contributing
220
+
221
+ Bug reports and pull requests are welcome on GitHub at https://github.com/relaton/relaton-oasis.
222
+
223
+ == License
224
+
225
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "relaton_oasis"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/rspec ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rspec-core", "rspec")
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here